inline read_duration function

This commit is contained in:
Tibo Ulens 2021-10-08 13:58:38 +02:00
parent f42ac8bafd
commit 4b385cf8f0

View file

@ -158,7 +158,14 @@ 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
@ -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