Implement console IO
This commit is contained in:
parent
24e82f0fcd
commit
9a7e047d57
68
io.asm
68
io.asm
|
@ -27,19 +27,19 @@ org 0
|
||||||
|
|
||||||
; Jump table
|
; Jump table
|
||||||
jmp init ; 0000
|
jmp init ; 0000
|
||||||
jmp status ; 0003
|
jmp near ptr status ; 0003
|
||||||
jmp getch ; 0006
|
jmp near ptr getch ; 0006
|
||||||
jmp putch ; 0009
|
jmp near ptr putch ; 0009
|
||||||
jmp unimplemented ; 000c Output to printer
|
jmp unimplemented ; 000c Output to printer
|
||||||
jmp unimplemented ; 000f Serial read
|
jmp unimplemented ; 000f Serial read
|
||||||
jmp unimplemented ; 0012 Serial write
|
jmp unimplemented ; 0012 Serial write
|
||||||
jmp diskread ; 0015
|
jmp near ptr diskread ; 0015
|
||||||
jmp diskwrite ; 0018
|
jmp diskwrite ; 0018
|
||||||
jmp near ptr diskchange ; 001b
|
jmp near ptr diskchange ; 001b
|
||||||
jmp setdate ; 001e
|
jmp setdate ; 001e
|
||||||
jmp settime ; 0021
|
jmp settime ; 0021
|
||||||
jmp gettime ; 0024
|
jmp gettime ; 0024
|
||||||
jmp flush ; 0027
|
jmp near ptr flush ; 0027
|
||||||
jmp near ptr mapdev ; 002a
|
jmp near ptr mapdev ; 002a
|
||||||
|
|
||||||
init:
|
init:
|
||||||
|
@ -98,23 +98,33 @@ init:
|
||||||
; al = character if any
|
; al = character if any
|
||||||
; zf = there were no characters
|
; zf = there were no characters
|
||||||
status proc far
|
status proc far
|
||||||
|
push bx
|
||||||
push ax
|
push ax
|
||||||
mov ax, 0e00h + 's'
|
mov ah, 1
|
||||||
int 10h
|
int 16h
|
||||||
|
mov bl, al
|
||||||
pop ax
|
pop ax
|
||||||
call far_caller
|
mov al, bl
|
||||||
; TODO: Implement
|
pop bx
|
||||||
xor ax, ax
|
|
||||||
test ax, ax
|
|
||||||
ret
|
ret
|
||||||
status endp
|
status endp
|
||||||
|
|
||||||
getch:
|
; OUT:
|
||||||
mov al, 'g'
|
; al = character
|
||||||
jmp error
|
getch proc far
|
||||||
|
push bx
|
||||||
|
push ax
|
||||||
|
xor ah, ah
|
||||||
|
int 16h
|
||||||
|
mov bl, al
|
||||||
|
pop ax
|
||||||
|
mov al, bl
|
||||||
|
pop bx
|
||||||
|
ret
|
||||||
|
getch endp
|
||||||
|
|
||||||
; IN:
|
; IN:
|
||||||
; ax = character
|
; al = character
|
||||||
putch proc far
|
putch proc far
|
||||||
push ax
|
push ax
|
||||||
mov ah, 0eh
|
mov ah, 0eh
|
||||||
|
@ -290,17 +300,27 @@ settime:
|
||||||
gettime:
|
gettime:
|
||||||
mov al, 'T'
|
mov al, 'T'
|
||||||
jmp error
|
jmp error
|
||||||
flush:
|
|
||||||
mov al, 'f'
|
flush proc far
|
||||||
jmp error
|
push ax
|
||||||
|
|
||||||
|
flush_loop:
|
||||||
|
mov ah, 1
|
||||||
|
int 16h
|
||||||
|
jz flush_ret
|
||||||
|
|
||||||
|
xor ah, ah
|
||||||
|
int 16h
|
||||||
|
jmp flush_loop
|
||||||
|
|
||||||
|
flush_ret:
|
||||||
|
pop ax
|
||||||
|
ret
|
||||||
|
flush endp
|
||||||
|
|
||||||
mapdev proc far
|
mapdev proc far
|
||||||
push ax
|
; TODO: Implement
|
||||||
mov ax, 0e00h + 'm'
|
xor al, al
|
||||||
int 10h
|
|
||||||
pop ax
|
|
||||||
call far_caller
|
|
||||||
; TODO: Figure out if this does anything?
|
|
||||||
ret
|
ret
|
||||||
mapdev endp
|
mapdev endp
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue