-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHINT.ASM
83 lines (64 loc) · 928 Bytes
/
HINT.ASM
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
.model small
.stack 100h
.data
password db 'coaa'
len equ ($-password)
msg1 db 10,13,'Enter your password: $'
msg2 db 10,13,'Correct Password,Welcome!!$'
msg3 db 10,13,'Incorrect Password, Please try again!$'
msg4 db 10,13 , 'Hint: Subject$'
new db 10,13 , "$"
inst db 10 dup(0)
.code
mov cx,len
start:
mov ax,@data
mov ds,ax
lea dx,msg1
mov ah,09h
int 21h
mov si,00
up1:
mov ah,08h
int 21h
cmp al,0dh
je down
mov [inst+si],al
mov dl,'*'
mov ah,02h
int 21h
inc si
jmp up1
down:
mov bx,00
mov cx,len
dec cx
check:
mov al,[inst+bx]
mov dl,[password+bx]
cmp al,dl
jnz hint
inc bx
loop check
correct:
lea dx,msg2
mov ah,09h
int 21h
jmp finish
hint:
mov ah,09h
lea dx,msg4
int 21h
jmp start
loop hint
jmp fail
fail:
lea dx,msg3
mov ah,09h
int 21h
jmp finish
finish:
mov ah,4ch
int 21h
end start
end