fix duration reading code
This commit is contained in:
parent
e2747fc424
commit
1d00d5f393
1 changed files with 9 additions and 1 deletions
10
messages.asm
10
messages.asm
|
@ -162,7 +162,12 @@ beep:
|
|||
mov ah, 0x00 ; read keypress
|
||||
int 0x16
|
||||
;; Read ASCII character is in al
|
||||
sub al, 'a' ; normalise (a=0, b=1, c=...)
|
||||
;; the character must be normalised to a=1, b=2, ...
|
||||
;; and not a=0, b=1, ... because during the waiting loop
|
||||
;; see #NOTE_LOOP
|
||||
;; the duration counter gets decremented BEFORE
|
||||
;; it gets compared to zero
|
||||
sub al, 'b' ; normalise (a=1, b=2, c=...)
|
||||
|
||||
;; interrupt 0x16, ah=0 returns the read scancode in ah
|
||||
;; so ah must be reset
|
||||
|
@ -207,6 +212,9 @@ beep:
|
|||
dec cx ; count down
|
||||
jne .pause2 ; if not zero keep counting down
|
||||
|
||||
;; #NOTE_LOOP
|
||||
;; the duration gets decremented before being checked
|
||||
;; hence why it was normalised to 'b' and not 'a'
|
||||
dec ax ; decrement duration counter
|
||||
jne .pause1 ; keep doing that until it is 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue