-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreadnprint.asm
More file actions
73 lines (60 loc) · 856 Bytes
/
readnprint.asm
File metadata and controls
73 lines (60 loc) · 856 Bytes
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
org 0x7c00
jmp 0x0000:start
string times 30 db 0
endl db ' ', 13, 10, 0
video_mode:
mov ax, 0013h
mov bh, 0
mov bl, 13 ;cor da fonte
int 10h
ret
putc:
mov ah, 0x0e
int 10h
ret
readc:
mov ah, 0x00
int 16h
ret
prints:
.loop:
lodsb
cmp al, 0
je .endloop
call putc
jmp .loop
.endloop:
ret
gets:
mov al, 0
.for:
call readc
stosb
cmp al, 13
je .fim
call putc
jmp .for
.fim:
dec di
mov al, 0
stosb
mov si, endl
call prints
ret
end:
jmp $
start:
xor ax, ax
mov ds, ax
mov es, ax
call video_mode
init:
mov di, string
call gets
mov si, string
call prints
mov si, endl
call prints
jmp init
times 510-($-$$) db 0
dw 0xaa55