From: Robert Pengelly Date: Mon, 12 Aug 2024 04:46:10 +0000 (+0100) Subject: Implemented int 21h/AH=01 X-Git-Url: https://git.candlhat.org/?a=commitdiff_plain;h=6cbb73f2e1b5b85f97a1da15c91ceb7655338529;p=chimaera.git Implemented int 21h/AH=01 --- diff --git a/build/chimaera.img b/build/chimaera.img index 1a20b31..a28c536 100644 Binary files a/build/chimaera.img and b/build/chimaera.img differ diff --git a/build/chimaera.vhd b/build/chimaera.vhd index 3868ac9..2321841 100644 Binary files a/build/chimaera.vhd and b/build/chimaera.vhd differ diff --git a/src/apps/hello/hello.asm b/src/apps/hello/hello.asm index 5f26689..6180d5f 100644 --- a/src/apps/hello/hello.asm +++ b/src/apps/hello/hello.asm @@ -18,7 +18,14 @@ _main: mov bx, offset _msg_hello call _writestr - + +;.console_loop: +; +; mov ah, HEX (01) +; int HEX (21) +; +; jmp .console_loop +; ; mov ax, offset _flags ; push ax ; diff --git a/src/kernel/int21.asm b/src/kernel/int21.asm index eb28c8f..257d2b7 100644 --- a/src/kernel/int21.asm +++ b/src/kernel/int21.asm @@ -750,6 +750,12 @@ _int21_dispatch.list: db HEX (00) dw _int21_00 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + ;; Console Input With Echo. + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + db HEX (01) + dw _int21_01 + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Display Output. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -970,6 +976,102 @@ _int21_00: xor al, al jmp _int21_4C +;****************************************************************************** +; @function _int21_01 +; @brief Console Input With Echo +;****************************************************************************** +_int21_01: + + mov al, cs:[_int21_01.scan] + + and al, al + jz _int21_01.wait + + mov byte ptr cs:[_int21_01.scan], 0 + jmp _int21_01.output + +_int21_01.wait: + + xor ah, ah + int HEX (16) + + cmp ax, HEX (2E03) + jne _int21_01.char_ok + + mov al, '^' + call _writechr + + mov al, 'C' + call _writechr + + mov al, HEX (0D) + call _writechr + + mov al, HEX (0A) + call _writechr + + jmp _spawn_int23 + +_int21_01.char_ok: + + mov cs:[_int21_01.scan], ah + + and al, al + jz _int21_01.output + + mov byte ptr cs:[_int21_01.scan], 0 + +_int21_01.output: + + cmp al, HEX (09) + jne _int21_01.no_tab + + push ax + push bx + push cx + push dx + + mov ah, HEX (03) + xor bh, bh + int HEX (10) + + xor ah, ah + mov al, dl + xor dx, dx + + mov cx, 4 + div cx + + mov cx, 4 + sub cx, dx + +_int21_01.tab_loop: + + mov al, ' ' + call _writechr + + loop _int21_01.tab_loop + +_int21_01.tab_done: + + pop dx + pop cx + pop bx + pop ax + + jmp _int21_01.done + +_int21_01.no_tab: + + call _writechr + +_int21_01.done: + + mov ah, HEX (01) + iret + +_int21_01.scan: db HEX (00) + ;****************************************************************************** ; @function _int21_02 ; @brief Display Ouput