fix crash on invalid keypress when sound is off

This commit is contained in:
4am 2022-01-17 22:29:27 -05:00
parent 4111ed55d8
commit 1252f054b0
1 changed files with 9 additions and 6 deletions

View File

@ -71,21 +71,24 @@ MainMenuEventLoop
jsr DrawMainMenuTitle
+ jsr DrawMainMenuText
bit CLEARKBD
-
@musicloop
+LDADDR kMainMenuKeys
+ST16 $EE
+LDADDR MainMenuMusic
jsr PlaySound
bpl - ; music played to completion, no keypress, so start over
bpl @musicloop ; music played to completion, no keypress, so start over
bit CLEARKBD
sta gLastKeyPressed
ldx #0
- ldy kMainMenuKeys, x
@keyloop
ldy kMainMenuKeys, x
beq @musicloop
cpy gLastKeyPressed
beq +
beq @dispatch
inx
bne -
+ lda kMainMenuKeyHandlersLo, x
bne @keyloop
@dispatch
lda kMainMenuKeyHandlersLo, x
sta @j+1
lda kMainMenuKeyHandlersHi, x
sta @j+2