Implement some console i/o

This commit is contained in:
Nero 2020-04-23 21:35:28 +02:00
parent 035b69db10
commit 3619a20703

View File

@ -41,8 +41,8 @@ iret: iret
sfptr: dw 0
; Subfunction table
sftab: dw sferr, sferr, putc, sferr
dw sferr, sferr, sferr, sferr
sftab: dw sferr, getc, putc, sferr
dw sferr, sferr, conout, conin
dw sferr, puts, sferr, sferr
dw sferr, sferr, sferr, sferr
; 10
@ -61,18 +61,56 @@ sftab: dw sferr, sferr, putc, sferr
dw sferr, sferr, sferr, sferr
dw sferr, sferr, sferr, sferr
; DOS 1+ 2h - WRITE CHARACTER TO STANDARD OUTPUT
; OUT al character read
getc: xor ax, ax
int 0x16
push ax
jmp putc.2
; IN dl character to write
putc: push ax
push bx
mov ah, 0x0E
mov al, dl
xor bx, bx
int 0x10
pop bx
.2: int 0x29
pop ax
ret
; console output
; IN dl character
conout: cmp dl, 0xFF
je conine
push ax
mov al, dl
int 0x29
pop ax
ret
; console input with echo
; OUT al character
; zf clear when character available
conine: mov ah, 1
int 0x16
jnz .has
xor al, al
ret
.has: xor ax, ax
int 0x16
int 0x29
test ax, ax
ret
; console input without echo
; OUT al character
; zf clear when character available
conin: mov ah, 1
int 0x16
jnz .has
xor al, al
ret
.has: xor ax, ax
int 0x16
test ax, ax
ret
; DOS 1+ 9h - WRITE STRING TO STANDARD OUTPUT
; IN ds:dx '$'-terminated string
puts: push si