Implement int 0x21 AH = 0x09, write string to stdout

This commit is contained in:
Ry 2022-11-04 21:14:36 -07:00
parent 3b417b1794
commit a36708e476
3 changed files with 24 additions and 8 deletions

View File

@ -27,7 +27,27 @@ wrout:
mov dl, ' ' ; "tabs are expanded to blanks" mov dl, ' ' ; "tabs are expanded to blanks"
.print: .print:
mov al, dl mov al, dl
mov bl, 0x70
call print_character call print_character
pop bx pop bx
ret ret
; AH = 0x09
; write string to stdout
; inputs:
; DS:DX: pointer to '$'-terminated string
; outputs:
; AL: 0x24 ('$')
wrout_str:
push si
mov si, dx
jmp .start_loop
.print_loop:
mov dl, byte [si]
call wrout
inc si
.start_loop:
cmp byte [si], '$'
jnz .print_loop
mov al, '$'
pop si
ret

View File

@ -30,7 +30,7 @@ nul: stc
; TODO figure out a way to format this table. maybe it can be autogenerated? ; TODO figure out a way to format this table. maybe it can be autogenerated?
; this table is misaligned for me and im the one who made it ; this table is misaligned for me and im the one who made it
; x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF ; x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF
fn: dw nul, rdin_echo, wrout, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul ; 0x fn: dw nul, rdin_echo, wrout, nul, nul, nul, nul, nul, nul, wrout_str, nul, nul, nul, nul, nul, nul ; 0x
dw nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul ; 1x dw nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul ; 1x
dw nul, nul, nul, nul, nul, setint, nul, nul, nul, nul, nul, nul, gettime, settime, setverify, nul ; 2x dw nul, nul, nul, nul, nul, setint, nul, nul, nul, nul, nul, nul, gettime, settime, setverify, nul ; 2x
dw getver, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul ; 3x dw getver, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul, nul ; 3x

View File

@ -7,12 +7,8 @@ kjmp: ; MUST be a jmp due to loader config
%include "int21/int21.s" %include "int21/int21.s"
kernel_entry: kernel_entry:
mov si, hello_string mov ah, 0x9
mov bl, 0x70 mov dx, hello_string
call print_string
mov ah, 0x2
mov dl, '!'
int 0x21 int 0x21
jmp $ jmp $