From d1152995087544432268a349055a247488a6b99e Mon Sep 17 00:00:00 2001 From: Ry Date: Thu, 3 Nov 2022 19:10:54 -0700 Subject: [PATCH] Implement int 0x21 AH = 0x02, write character to stdout --- src/int21/0.s | 18 ++++++++++++++++-- src/vga.s | 17 +++++++++++++++++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/int21/0.s b/src/int21/0.s index 9fab32e..ce2c3e1 100644 --- a/src/int21/0.s +++ b/src/int21/0.s @@ -7,9 +7,23 @@ ; outputs: ; AL: character read from stdin rdin_echo: - push ax mov ah, 8 int 0x21 ; TODO does echo go to stdout or to screen? - pop ax + ret + +; AH = 0x02 +; write character to stdout +; inputs: +; DL: character +; outputs: +; AL: last character output +wrout: + ; TODO handle ^C and stuff + ; TODO handle stdout properly + push bx + mov al, dl + mov bl, 0x70 + call print_character + pop bx ret diff --git a/src/vga.s b/src/vga.s index 32aa442..46389e3 100644 --- a/src/vga.s +++ b/src/vga.s @@ -1,3 +1,20 @@ +; print a character to the screen +; inputs: +; AL: ASCII character +; outputs: +; none +print_character: + push ax + push bx + + mov ah, 0x0E + mov bh, 0x00 + int 0x10 + + pop bx + pop ax + ret + ; print a string to the screen ; inputs: ; DS:SI: pointer to '$'-terminated string