WIP of asm86

This commit is contained in:
Nero 2020-09-15 20:38:34 +02:00
parent 79c902c197
commit 4b5993cfa9

View File

@ -7,16 +7,23 @@
mov [fd], ax mov [fd], ax
loop: call getc call getline
jc end
cmp dl, 26 mov dx, [line_length]
je end call dumpdx
mov si, line_buffer
mov cx, [line_length]
mov ah, 2 mov ah, 2
l03: lodsb
mov dl, al
int 0x21 int 0x21
jmp loop loop l03
end: ret end: ret
line_num: dw 1
err: mov dx, ax err: mov dx, ax
dumpdx: ; setup bx and ah for int 10h call dumpdx: ; setup bx and ah for int 10h call
@ -53,6 +60,29 @@ getc: mov dl, 26
pop dx pop dx
ret ret
getline: mov word [line_length], 0
mov di, line_buffer
mov cx, line_buflen
l02: push cx
call getc
pop cx
mov al, dl
cmp al, 0x0A
je l01
cmp al, 0x0D
je l01
cmp al, 0x1A
je l01
inc word [line_length]
loop l02
l01: ret
infile: db "com/a86.asm", 0 infile: db "com/a86.asm", 0
line_buflen: equ 0x100
line_length: dw 0 ; valid bytes in buffer
line_prefix: times 16 db " "
line_buffer: times line_buflen db 0
fd: dw 0 fd: dw 0