57 lines
776 B
NASM
57 lines
776 B
NASM
console_hide_cursor:
|
|
push ax
|
|
push cx
|
|
mov ah, 1
|
|
mov cx, 0x1F1F
|
|
int 0x10
|
|
pop cx
|
|
pop ax
|
|
ret
|
|
|
|
console_show_cursor:
|
|
push ax
|
|
push cx
|
|
mov ah, 1
|
|
mov cx, 0x001F
|
|
int 0x10
|
|
pop cx
|
|
pop ax
|
|
ret
|
|
|
|
; Raw console i/o without echo
|
|
; IN DL character to output or FF
|
|
; OUT ZF if DL=FF: zero if character input
|
|
; AL if not ZF: ascii char, otherwise corrupt
|
|
console_io:
|
|
cmp dl, 0xFF
|
|
je .read
|
|
push ax
|
|
push bx
|
|
mov al, dl
|
|
mov ah, 0x0e
|
|
xor bx, bx
|
|
int 0x10
|
|
pop bx
|
|
pop ax
|
|
ret
|
|
.read:
|
|
call console_show_cursor
|
|
|
|
; if no character avail, exit with leaving
|
|
; cursor displayed
|
|
mov ah, 1
|
|
int 0x16
|
|
jz .end
|
|
pushf
|
|
|
|
; actually read character
|
|
xor ax, ax
|
|
int 0x16
|
|
|
|
call console_hide_cursor
|
|
|
|
; restore zero flag
|
|
popf
|
|
.end:
|
|
ret
|