-
Notifications
You must be signed in to change notification settings - Fork 0
/
input.asm
60 lines (46 loc) · 933 Bytes
/
input.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
org 0x7c00
bits 16
mov ax, 0
mov ds, ax
cli
mov si, pergunta
call prints
mov di, 0x7e00
call gets
mov si, 0x7e00
call prints
jmp fim
gets: push ax
push di
loopg: mov ah, 0
int 0x16
cmp al, 13 ; byte 13 = ENTER
je fimgs
mov [ds:di], al
mov ah, 0x0e
int 0x10
inc di
jmp loopg
fimgs: mov [ds:di], byte 0 ; byte 0 to determine end of string
pop di
pop ax
ret
prints:
push si
push ax
mov ah, 0x0e
loop:
lodsb
or al, al
jz retorno
int 0x10
jmp loop
retorno:
pop ax
pop si
ret
fim: hlt
pergunta: db "What is your name? ", 0
times 510 - ($ - $$) db 0
db 0x55
db 0xaa