inline read_duration function
This commit is contained in:
parent
f42ac8bafd
commit
4b385cf8f0
1 changed files with 18 additions and 11 deletions
29
messages.asm
29
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
|
||||
|
|
Loading…
Reference in a new issue