From 1d00d5f3938fc45b467bbcbd97a729f3165a5ca5 Mon Sep 17 00:00:00 2001 From: Tibo Ulens Date: Fri, 8 Oct 2021 14:37:32 +0200 Subject: [PATCH] fix duration reading code --- messages.asm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/messages.asm b/messages.asm index 27583ec..0ee0a69 100644 --- a/messages.asm +++ b/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