Implement int 29h: Fast console output

This commit is contained in:
Nero 2020-04-20 19:13:06 +02:00
parent c5088789f9
commit 40065266f3

View File

@ -6,7 +6,11 @@
banner: db "rdos", 0xA, 0xD, '$' banner: db "rdos", 0xA, 0xD, '$'
; Alias for Int 21h,AH=0h
int20h: xor ah, ah int20h: xor ah, ah
; allow extenders to get away with only hooking 21h
jmp [cs:(0x21 * 4)]
int21h: ; inside of kernel, direction always goes up int21h: ; inside of kernel, direction always goes up
; the iret will restore it to the user value later ; the iret will restore it to the user value later
cld cld
@ -30,7 +34,7 @@ int21h: ; inside of kernel, direction always goes up
pop bp pop bp
pop ax pop ax
; iret frame: IP CS FLAGS ; iret frame: IP CS FLAGS
iret iret: iret
; Subfunction ptr ; Subfunction ptr
; this is used as extra register in int21h ; this is used as extra register in int21h
@ -72,12 +76,10 @@ putc: push ax
; DOS 1+ 9h - WRITE STRING TO STANDARD OUTPUT ; DOS 1+ 9h - WRITE STRING TO STANDARD OUTPUT
; IN ds:dx '$'-terminated string ; IN ds:dx '$'-terminated string
puts: push si puts: push si
mov ah, 0x0E
xor bx, bx
.loop: lodsb .loop: lodsb
cmp al, '$' cmp al, '$'
je .end je .end
int 0x10 int 0x29
jmp .loop jmp .loop
.end: pop si .end: pop si
ret ret
@ -202,11 +204,19 @@ ldbpb: push ds
pop ds pop ds
ret ret
main: mov si, banner ; DOS 2+ - FAST CONSOLE OUTPUT
mov ah, 0x09 ; IN al character to print
int 0x21 fputc: push ax
end: hlt push bx
jmp end mov ah, 0x0E
xor bx, bx
int 0x10
pop bx
pop ax
iret
main: hlt
jmp main
init: cli init: cli
xor ax, ax xor ax, ax
@ -220,14 +230,28 @@ init: cli
mov cx, (init-$$) mov cx, (init-$$)
rep movsb rep movsb
; Set boot drive as current drive
call dnconv call dnconv
call select call select
; Set int 0x20 to 0x2F
mov bx, ivects+0x7C00-$$
mov cx, 0x10
mov al, 0x20 mov al, 0x20
mov dx, int20h .loop: mov dx, [bx]
call setint
mov al, 0x21
mov dx, int21h
call setint call setint
inc al
inc bx
inc bx
loop .loop
mov si, banner
mov ah, 0x09
int 0x21
jmp 0:main jmp 0:main
ivects: dw int20h, int21h, iret, iret
dw iret, iret, iret, iret
dw iret, fputc, iret, iret
dw iret, iret, iret, iret