From a36708e476d4c5c2926c8e117ec2d0ef3ae3f547 Mon Sep 17 00:00:00 2001 From: Ry Date: Fri, 4 Nov 2022 21:14:36 -0700 Subject: [PATCH] Implement int 0x21 AH = 0x09, write string to stdout --- src/int21/0.s | 22 +++++++++++++++++++++- src/int21/int21.s | 2 +- src/kernel.s | 8 ++------ 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/int21/0.s b/src/int21/0.s index 3aca334..c4c227c 100644 --- a/src/int21/0.s +++ b/src/int21/0.s @@ -27,7 +27,27 @@ wrout: mov dl, ' ' ; "tabs are expanded to blanks" .print: mov al, dl - mov bl, 0x70 call print_character pop bx 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 diff --git a/src/int21/int21.s b/src/int21/int21.s index 7867ecb..d10833a 100644 --- a/src/int21/int21.s +++ b/src/int21/int21.s @@ -30,7 +30,7 @@ nul: stc ; 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 ; 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, 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 diff --git a/src/kernel.s b/src/kernel.s index b49eae8..cb59762 100644 --- a/src/kernel.s +++ b/src/kernel.s @@ -7,12 +7,8 @@ kjmp: ; MUST be a jmp due to loader config %include "int21/int21.s" kernel_entry: - mov si, hello_string - mov bl, 0x70 - call print_string - - mov ah, 0x2 - mov dl, '!' + mov ah, 0x9 + mov dx, hello_string int 0x21 jmp $