From 4b385cf8f08825b01037d4fb94fa4723d94f30c7 Mon Sep 17 00:00:00 2001 From: Tibo Ulens Date: Fri, 8 Oct 2021 13:58:38 +0200 Subject: [PATCH] inline read_duration function --- messages.asm | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/messages.asm b/messages.asm index cde24a9..6792af4 100644 --- a/messages.asm +++ b/messages.asm @@ -158,9 +158,16 @@ newline: ;; - bx ;; - cx beep: - call read_duration ; get duration from keyboard (in al) + ;; Read duration (0-16 supported) + mov ah, 0x00 ; read keypress + int 0x16 + ;; Read ASCII character is in al + sub al, 'a' ; normalise (a=0, b=1, c=...) + + ;; interrupt 0x16, ah=0 returns the read scancode in ah + ;; so ah must be reset mov ah, 0 - push ax ; store on stack + push ax ; store on stack ;; move 182 (0b10 11 011 0) into al ;; bit 7-6 = channel select (2, PC speaker) @@ -299,15 +306,15 @@ readbyte: ;; ;; CLOBBERS ;; - ax -read_duration: - ;; Read duration (0-16 supported) - mov ah, 0x00 ; read keypress - int 0x16 - - ;; Read character is in al - sub al, 'a' ; normalise - - ret +;read_duration: +; ;; Read duration (0-16 supported) +; mov ah, 0x00 ; read keypress +; int 0x16 +; +; ;; Read character is in al +; sub al, 'a' ; normalise +; +; ret ;; Variable to store color mode information for writing to the screen color_mode: db 0x02