This commit is contained in:
4am 2019-09-26 13:03:41 -04:00
commit e54191d289
8 changed files with 77 additions and 67 deletions

View File

@ -41,7 +41,7 @@ FirstMover
Reenter
cld
cli
+READ_RAM2_WRITE_RAM2
jsr SwitchToBank2
jsr CloseHandles ; close any open handles to restore ProRWTS
jsr SaveOrRestoreScreenHoles ; restore original screen hole contents
ldx #5
@ -71,6 +71,7 @@ RestoreStackNextTime
bne -
ldx $DFF0 ; restore stack pointer
txs
SwitchToBank1
+READ_RAM1_WRITE_RAM1
rts ; and return to caller
ResetVector ; 6 bytes, copied to $100
@ -110,9 +111,6 @@ gGlobalPrefsStore
!word $D100
gGamesListStore
!word $FDFD ; SMC
SwitchToBank1
+READ_RAM1_WRITE_RAM1
rts
SwitchToBank2
+READ_RAM2_WRITE_RAM2
rts

View File

@ -9,7 +9,7 @@
; D000..E5F4 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore)
; ...unused...
; ECBA..FFF9 - main program code
; ECDC..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors
;
; LC RAM BANK 2

View File

@ -169,16 +169,15 @@ pref_set
ldy #0
lda ($00),y
beq +
tax
tay
clc
adc $FE
tax
- lda ($00),y
dey
sta ($FE),y
bne -
txa
clc
adc $FE
sta $FE
stx $FE
bcc +
inc $FF
+ rts

View File

@ -136,3 +136,7 @@ AddToPath
stx gPathname
@done
rts
!if >kTitleFile != >kCoverFile {
!error ">kTitleFile != >kCoverFile, uncomment LoadTitleOffscreen block in ui.offscreen and disable this check"
}

View File

@ -18,7 +18,7 @@
; out: never returns to caller (may JMP to other major modes)
;------------------------------------------------------------------------------
MegaAttractMode
+READ_RAM1_WRITE_RAM1
jsr SwitchToBank1
ldx #$FF
txs

View File

@ -23,6 +23,17 @@ BrowseMode
jsr WaitForKeyFor30Seconds
bit CLEARKBD
; indices into BrowseDispatchTable below
kBrowseSearch = 0
kBrowsePrevious = 1
kBrowseNext = 2
kBrowseExitToSearch = 3
kBrowseTab = 4
kBrowseLaunch = 5
kBrowseCredits = 6
kBrowseCheat = 7
kSoftBell = 8
ldy #kNumBrowseKeys
- dey
bmi @noKeyMatch
@ -34,10 +45,14 @@ BrowseMode
@noKeyMatch
jsr IsSearchKey
beq +
jsr SoftBell ; beep on invalid input
jmp @BrowseModeInputLoop ; and start over
ldx #kSoftBell ; beep on invalid input
!if kBrowseSearch > 0 {
+HIDE_NEXT_2_BYTES
+
ldx #kBrowseSearch
} else {
+
}
; execution falls through here
@BrowseDispatch
ldy BrowseDispatchTableLo,x
@ -99,16 +114,6 @@ OnBrowseChanged
;------------------------------------------------------------------------------
; indices into BrowseDispatchTable
kBrowseSearch = 0
kBrowsePrevious = 1
kBrowseNext = 2
kBrowseExitToSearch = 3
kBrowseTab = 4
kBrowseLaunch = 5
kBrowseCredits = 6
kBrowseCheat = 7
BrowseDispatchTableLo
!byte <OnBrowseSearch
!byte <OnBrowsePrevious
@ -118,6 +123,7 @@ BrowseDispatchTableLo
!byte <OnBrowseLaunch
!byte <Credits
!byte <OnBrowseCheat
!byte <SoftBell
BrowseDispatchTableHi
!byte >OnBrowseSearch
!byte >OnBrowsePrevious
@ -127,6 +133,7 @@ BrowseDispatchTableHi
!byte >OnBrowseLaunch
!byte >Credits
!byte >OnBrowseCheat
!byte >SoftBell
kNumBrowseKeys = 11 ; number of entries in next 2 tables (each)
BrowseKeys

View File

@ -46,11 +46,15 @@ GetOffscreenAddress
; out: all flags and registers clobbered
;------------------------------------------------------------------------------
LoadTitleOffscreen
+LDADDR kTitleFile
bne + ; Always branches, because Y is loaded
; last with the high byte of the address,
; which is never 0. I miss my 65c02.
;;!if >kTitleFile = >kCoverFile {
lda #<kTitleFile
+HIDE_NEXT_2_BYTES
;;} else {
;; +LDADDR kTitleFile
;; bne + ; Always branches, because Y is loaded
;; ; last with the high byte of the address,
;; ; which is never 0. I miss my 65c02.
;;}
;------------------------------------------------------------------------------
; LoadCoverOffscreen
; load cover screen in the HGR page that is currently not showing
@ -103,7 +107,7 @@ ClearOffscreen
jsr GetOffscreenAddress
+HIDE_NEXT_2_BYTES
ClearHGR1
lda #$20
lda #$20 ; note to self: LDX #$20 can't move here
sta @a+2
ldx #$20
lda #$80

View File

@ -8,6 +8,23 @@
; - IsSearchKey
;
.noKeyMatch
jsr IsSearchKey
beq .foundSearchKey
ldx #kInputError
+HIDE_NEXT_2_BYTES
.foundSearchKey
ldx #kInputSearch
; execution falls through here
.InputDispatch
ldy InputDispatchTableLo,x
sty .j+1
ldy InputDispatchTableHi,x
sty .j+2
.j jsr $FDFD ; SMC
bcc .SearchModeInputLoop ; if carry is clear, we're done
; fall through to force full redraw
;------------------------------------------------------------------------------
; SearchMode
; main entry point for Search Mode, which allows the user to search the game
@ -27,7 +44,7 @@ SearchMode
jsr HGRMode ; show HGR screen
bit CLEARKBD
@SearchModeInputLoop
.SearchModeInputLoop
jsr WaitForKeyFor30Seconds
; Don't clear keyboard strobe yet. If the user pressed an arrow key,
@ -41,52 +58,31 @@ SearchMode
cmp #$8A ; also down arrow
bne @notArrow
@arrow ldx #kInputBrowse
bne @InputDispatch ; always branches
bne .InputDispatch ; always branches
@notArrow
bit CLEARKBD
ldy #kNumBrowseKeys
- dey
bmi @noKeyMatch
bmi .noKeyMatch
cmp InputKeys,y
bne -
ldx InputKeyDispatch,y
bne @InputDispatch ; always branches
@noKeyMatch
jsr IsSearchKey
beq @foundSearchKey
ldx #kInputError
+HIDE_NEXT_2_BYTES
@foundSearchKey
ldx #kInputSearch
; execution falls through here
@InputDispatch
ldy InputDispatchTableLo,x
sty @j+1
ldy InputDispatchTableHi,x
sty @j+2
@j jsr $FDFD ; SMC
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.
bne .InputDispatch ; always branches
OnClear
ldx InputLength
bne +
jmp CoverFade ; Esc with no input transitions to
; mega attract mode
+ ldx #0 ; Esc with input clears the input
stx InputLength
beq OnInputChanged ; always branches
OnBack
ldx InputLength
beq OnError
dec InputLength
jmp OnInputChanged
+HIDE_NEXT_2_BYTES
+ ldx #1 ; Esc with input clears the input
dex
stx InputLength
bpl OnInputChanged ; always branches
OnTab
ldx gGameToLaunch
@ -94,15 +90,15 @@ OnTab
beq OnError
jsr MiniAttractMode
cmp #$8D ; if we exited mini attract mode
beq OnLaunch ; by pressing Enter, launch the game
sec ; tell caller to redraw UI
rts
bne .req_redraw ; by pressing Enter, launch the game
OnLaunch
ldx gGameToLaunch
cpx #$FF
beq OnError
jsr PlayGame
.req_redraw
sec ; tell caller to redraw UI
rts
@ -140,7 +136,10 @@ OnInputChanged
bne +
; no matches for this input buffer
dec InputLength ; ignore the last key typed
jmp OnError ; beep and return
OnError
jmp SoftBell ; Beep on invalid input and start over.
+
ldx BestMatchIndex ; check if the new best match is the same
cpx gGameToLaunch ; as the current best match
@ -176,7 +175,9 @@ IsSearchKey
cmp #$5B ; uppercase letters are good input
bcs +
ora #$20 ; convert uppercase letters to lowercase
bne @goodkey ; always branches
@goodkey
ldx #0
rts
+ cmp #$61 ; more punctuation (also ignored)
bcc @badkey
@ -185,9 +186,6 @@ IsSearchKey
@badkey
ldx #1
rts
@goodkey
ldx #0
rts
; indices into InputDispatchTable
kInputSearch = 0