shave some bytes

This commit is contained in:
4am 2019-09-07 14:15:53 -04:00
parent fe33d88140
commit f150dc0673
2 changed files with 16 additions and 22 deletions

View File

@ -178,13 +178,13 @@ WaitForKeyFor30Seconds
; yell at the user, but, like, gently
;
; in: none
; out: all registers and flags preserved
; out: C clear
; Y preserved
; A=0
; X=0
; all flags preserved
;------------------------------------------------------------------------------
SoftBell
php
pha
txa
pha
ldx #32
- lda #2
jsr @wait
@ -194,10 +194,7 @@ SoftBell
bit SPEAKER
dex
bne -
pla
tax
pla
plp
clc
rts
@wait ; identical to $FCA8 ROM routine, but ROM is switched out when we need it
sec

View File

@ -73,6 +73,9 @@ SearchMode
bcc .SearchModeInputLoop ; if carry is clear, we're done
bcs SearchMode ; if carry is set, force full redraw
.OnError
jmp SoftBell ; Beep on invalid input and start over.
.OnClear
ldx InputLength
bne +
@ -80,19 +83,18 @@ SearchMode
jmp MegaAttractMode ; mega-attract mode
+ ldx #0 ; Esc with input clears the input
stx InputLength
jmp .OnInputChanged
beq .OnInputChanged ; always branches
.OnBack
ldx InputLength
bne +
jmp SoftBell
+ dec InputLength
beq .OnError
dec InputLength
jmp .OnInputChanged
.OnTab
ldx SelectedIndex
cpx #$FF
beq .ClearAndReturn
beq .OnError
jsr MiniAttractMode
cmp #$8D ; if we exited mini attract mode
beq .OnLaunch ; by pressing Enter, launch the game
@ -102,7 +104,7 @@ SearchMode
.OnLaunch
ldx SelectedIndex
cpx #$FF
beq .ClearAndReturn
beq .OnError
jsr PlayGameFromSearch
sec ; tell caller to redraw UI
rts
@ -110,13 +112,8 @@ SearchMode
.OnSearch
ldx InputLength
cpx #MaxInputLength
bne +
.OnError
jsr SoftBell ; Beep on invalid input and start over.
.ClearAndReturn
clc
rts
+ sta InputBuffer,x
beq .OnError
sta InputBuffer,x
inc InputLength
; execution falls through here
.OnInputChanged