This commit is contained in:
Peter Ferrie 2019-09-25 20:01:59 -07:00
parent 85299ef44a
commit 5ff9030b64
8 changed files with 77 additions and 67 deletions

View File

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

View File

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

View File

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

View File

@ -136,3 +136,7 @@ AddToPath
stx gPathname stx gPathname
@done @done
rts 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) ; out: never returns to caller (may JMP to other major modes)
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
MegaAttractMode MegaAttractMode
+READ_RAM1_WRITE_RAM1 jsr SwitchToBank1
ldx #$FF ldx #$FF
txs txs

View File

@ -23,6 +23,17 @@ BrowseMode
jsr WaitForKeyFor30Seconds jsr WaitForKeyFor30Seconds
bit CLEARKBD 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 ldy #kNumBrowseKeys
- dey - dey
bmi @noKeyMatch bmi @noKeyMatch
@ -34,10 +45,14 @@ BrowseMode
@noKeyMatch @noKeyMatch
jsr IsSearchKey jsr IsSearchKey
beq + beq +
jsr SoftBell ; beep on invalid input ldx #kSoftBell ; beep on invalid input
jmp @BrowseModeInputLoop ; and start over !if kBrowseSearch > 0 {
+HIDE_NEXT_2_BYTES
+ +
ldx #kBrowseSearch ldx #kBrowseSearch
} else {
+
}
; execution falls through here ; execution falls through here
@BrowseDispatch @BrowseDispatch
ldy BrowseDispatchTableLo,x 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 BrowseDispatchTableLo
!byte <OnBrowseSearch !byte <OnBrowseSearch
!byte <OnBrowsePrevious !byte <OnBrowsePrevious
@ -118,6 +123,7 @@ BrowseDispatchTableLo
!byte <OnBrowseLaunch !byte <OnBrowseLaunch
!byte <Credits !byte <Credits
!byte <OnBrowseCheat !byte <OnBrowseCheat
!byte <SoftBell
BrowseDispatchTableHi BrowseDispatchTableHi
!byte >OnBrowseSearch !byte >OnBrowseSearch
!byte >OnBrowsePrevious !byte >OnBrowsePrevious
@ -127,6 +133,7 @@ BrowseDispatchTableHi
!byte >OnBrowseLaunch !byte >OnBrowseLaunch
!byte >Credits !byte >Credits
!byte >OnBrowseCheat !byte >OnBrowseCheat
!byte >SoftBell
kNumBrowseKeys = 11 ; number of entries in next 2 tables (each) kNumBrowseKeys = 11 ; number of entries in next 2 tables (each)
BrowseKeys BrowseKeys

View File

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

View File

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