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 ;; - bx
;; - cx ;; - cx
beep: 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 mov ah, 0
push ax ; store on stack push ax ; store on stack
@ -299,15 +306,15 @@ readbyte:
;; ;;
;; CLOBBERS ;; CLOBBERS
;; - ax ;; - ax
read_duration: ;read_duration:
;; Read duration (0-16 supported) ; ;; Read duration (0-16 supported)
mov ah, 0x00 ; read keypress ; mov ah, 0x00 ; read keypress
int 0x16 ; int 0x16
;
;; Read character is in al ; ;; Read character is in al
sub al, 'a' ; normalise ; sub al, 'a' ; normalise
;
ret ; ret
;; Variable to store color mode information for writing to the screen ;; Variable to store color mode information for writing to the screen
color_mode: db 0x02 color_mode: db 0x02