mirror of https://github.com/a2-4am/4cade.git
refactoring
This commit is contained in:
parent
d28a84a6f6
commit
cc7ea09ec9
|
@ -9,8 +9,6 @@
|
|||
; - Launch
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
GetGameDisplayName
|
||||
; in: A/Y points to game filename
|
||||
; X = #$60 if we should only look in gGamesListStore for a match
|
||||
|
@ -173,4 +171,3 @@ Launch
|
|||
dey
|
||||
bne -
|
||||
jmp $106 ; jump to pre-launch code
|
||||
}
|
||||
|
|
|
@ -60,6 +60,22 @@ kStandardPrelaunch
|
|||
!byte 8
|
||||
!raw "STANDARD"
|
||||
|
||||
kFXConfFile
|
||||
!byte 7
|
||||
!text "FX.CONF"
|
||||
|
||||
kDFXConfFile
|
||||
!byte 8
|
||||
!text "DFX.CONF"
|
||||
|
||||
kCreditsFile
|
||||
!byte 7
|
||||
!text "CREDITS"
|
||||
|
||||
kCoverFadeFile
|
||||
!byte 9
|
||||
!text "COVERFADE"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; SetPath/AddToPath
|
||||
; append a length-prefixed string to gPathname
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
; - DHGRSingle
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
DHGRTitleSlideshow
|
||||
bit MachineStatus ; only run DHGR slideshow if we have 128K
|
||||
bvs +
|
||||
|
@ -86,9 +84,6 @@ DHGRSingle
|
|||
@filename !word $FDFD ; SMC
|
||||
!word $6000
|
||||
rts
|
||||
kDFXConfFile
|
||||
!byte 8
|
||||
!text "DFX.CONF"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; .DHGRTitleCallback [private]
|
||||
|
@ -162,5 +157,3 @@ kDFXConfFile
|
|||
|
||||
+LDADDR $6000
|
||||
jmp ExecuteTransitionAndWait
|
||||
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
; - GRSingle
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
GRActionSlideshow
|
||||
jsr .LoadGRTransition ; load transition effect code at $6000
|
||||
jsr BlankGR ; switch GR mode with initial blank screen
|
||||
|
@ -108,5 +106,3 @@ kGRFizzleFile
|
|||
|
||||
+LDADDR $6400
|
||||
jmp ExecuteTransitionAndWait
|
||||
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
; - HGRSingle
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
HGRTitleSlideshow
|
||||
jsr .LoadHGRTransition ; load transition effect code at $6000
|
||||
jsr okvs_iter ; cycle through all listed HGR files
|
||||
|
@ -187,7 +185,3 @@ HGRSingle
|
|||
@filename !word $FDFD ; SMC
|
||||
!word $6000
|
||||
rts
|
||||
kFXConfFile
|
||||
!byte 7
|
||||
!text "FX.CONF"
|
||||
}
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
; - SHRSingle
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
SHRSlideshow
|
||||
lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card
|
||||
and #SUPPORTS_SHR
|
||||
|
@ -137,5 +135,3 @@ kSFXFizzleFile
|
|||
sta NEWVIDEO
|
||||
|
||||
rts
|
||||
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
; - BrowseMode
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; BrowseMode
|
||||
; main entry point for Browse Mode, which allows the user to browse the game
|
||||
|
@ -21,44 +19,44 @@ BrowseMode
|
|||
ldx #$FF
|
||||
txs
|
||||
|
||||
.BrowseModeInputLoop
|
||||
@BrowseModeInputLoop
|
||||
jsr WaitForKeyFor30Seconds
|
||||
bit CLEARKBD
|
||||
|
||||
ldy #kNumBrowseKeys
|
||||
- dey
|
||||
bmi @noKeyMatch
|
||||
cmp .BrowseKeys,y
|
||||
cmp BrowseKeys,y
|
||||
bne -
|
||||
ldx .BrowseKeyDispatch,y
|
||||
ldx BrowseKeyDispatch,y
|
||||
bne @BrowseDispatch ; always branches
|
||||
|
||||
@noKeyMatch
|
||||
jsr IsSearchKey
|
||||
beq +
|
||||
jsr SoftBell ; beep on invalid input
|
||||
jmp .BrowseModeInputLoop ; and start over
|
||||
jmp @BrowseModeInputLoop ; and start over
|
||||
+
|
||||
ldx #kBrowseSearch
|
||||
; execution falls through here
|
||||
@BrowseDispatch
|
||||
ldy .BrowseDispatchTableLo,x
|
||||
ldy BrowseDispatchTableLo,x
|
||||
sty @j+1
|
||||
ldy .BrowseDispatchTableHi,x
|
||||
ldy BrowseDispatchTableHi,x
|
||||
sty @j+2
|
||||
@j jsr $FDFD ; SMC
|
||||
jmp .BrowseModeInputLoop
|
||||
jmp @BrowseModeInputLoop
|
||||
|
||||
.OnSearch
|
||||
OnBrowseSearch
|
||||
sta InputBuffer
|
||||
lda #$01
|
||||
sta InputLength
|
||||
jmp SearchMode
|
||||
|
||||
.OnPrevious
|
||||
OnBrowsePrevious
|
||||
dec gGameToLaunch
|
||||
jmp +
|
||||
.OnNext
|
||||
OnBrowseNext
|
||||
inc gGameToLaunch
|
||||
+
|
||||
ldx gGameToLaunch
|
||||
|
@ -73,27 +71,28 @@ GameCount = *+1
|
|||
bcc @done
|
||||
ldx #0
|
||||
@done stx gGameToLaunch
|
||||
jmp .OnBrowseChanged
|
||||
jmp OnBrowseChanged
|
||||
|
||||
.OnLaunch
|
||||
OnBrowseLaunch
|
||||
jsr PlayGame
|
||||
jsr BlankHGR
|
||||
jmp .ForceBrowseChanged
|
||||
jmp ForceBrowseChanged
|
||||
|
||||
.OnCheat
|
||||
OnBrowseCheat
|
||||
jsr ToggleCheat
|
||||
beq .ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat
|
||||
beq ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat
|
||||
|
||||
.OnTab
|
||||
OnBrowseTab
|
||||
ldx gGameToLaunch
|
||||
jsr MiniAttractMode
|
||||
cmp #$8D
|
||||
beq .OnLaunch
|
||||
.ForceBrowseChanged
|
||||
beq OnBrowseLaunch
|
||||
; execution falls through here
|
||||
ForceBrowseChanged
|
||||
bit CLEARKBD
|
||||
ldx gGameToLaunch
|
||||
; execution falls through here
|
||||
.OnBrowseChanged
|
||||
OnBrowseChanged
|
||||
; in: X = game index
|
||||
jsr LoadGameTitleOffscreen
|
||||
jmp DrawUIWithoutDots
|
||||
|
@ -110,27 +109,27 @@ kBrowseLaunch = 5
|
|||
kBrowseCredits = 6
|
||||
kBrowseCheat = 7
|
||||
|
||||
.BrowseDispatchTableLo
|
||||
!byte <.OnSearch
|
||||
!byte <.OnPrevious
|
||||
!byte <.OnNext
|
||||
BrowseDispatchTableLo
|
||||
!byte <OnBrowseSearch
|
||||
!byte <OnBrowsePrevious
|
||||
!byte <OnBrowseNext
|
||||
!byte <SearchMode
|
||||
!byte <.OnTab
|
||||
!byte <.OnLaunch
|
||||
!byte <OnBrowseTab
|
||||
!byte <OnBrowseLaunch
|
||||
!byte <Credits
|
||||
!byte <.OnCheat
|
||||
.BrowseDispatchTableHi
|
||||
!byte >.OnSearch
|
||||
!byte >.OnPrevious
|
||||
!byte >.OnNext
|
||||
!byte <OnBrowseCheat
|
||||
BrowseDispatchTableHi
|
||||
!byte >OnBrowseSearch
|
||||
!byte >OnBrowsePrevious
|
||||
!byte >OnBrowseNext
|
||||
!byte >SearchMode
|
||||
!byte >.OnTab
|
||||
!byte >.OnLaunch
|
||||
!byte >OnBrowseTab
|
||||
!byte >OnBrowseLaunch
|
||||
!byte >Credits
|
||||
!byte >.OnCheat
|
||||
!byte >OnBrowseCheat
|
||||
|
||||
kNumBrowseKeys = 11 ; number of entries in next 2 tables (each)
|
||||
.BrowseKeys
|
||||
BrowseKeys
|
||||
!byte $83 ; Ctrl-C = toggle cheat mode
|
||||
!byte $AF ; '/' = credits
|
||||
!byte $BF ; '?' = credits
|
||||
|
@ -142,7 +141,7 @@ kNumBrowseKeys = 11 ; number of entries in next 2 tables (each)
|
|||
!byte $95 ; right arrow = next
|
||||
!byte $8B ; up arrow = previous
|
||||
!byte $88 ; left arrow = previous
|
||||
.BrowseKeyDispatch
|
||||
BrowseKeyDispatch
|
||||
!byte kBrowseCheat
|
||||
!byte kBrowseCredits
|
||||
!byte kBrowseCredits
|
||||
|
@ -154,4 +153,3 @@ kNumBrowseKeys = 11 ; number of entries in next 2 tables (each)
|
|||
!byte kBrowseNext
|
||||
!byte kBrowsePrevious
|
||||
!byte kBrowsePrevious
|
||||
}
|
||||
|
|
|
@ -13,22 +13,20 @@
|
|||
; - DrawSearchUI
|
||||
; - ShowOtherPage
|
||||
; - ToggleOffscreenPage
|
||||
; - CoverFade
|
||||
; - SoftBell
|
||||
; - Home
|
||||
; - BlankHGR
|
||||
; - BlankDHGR
|
||||
; - ClearOffscreen
|
||||
; - ExecuteTransitionAndWait
|
||||
; - IsSearchKey
|
||||
; - ExecuteTransitionAndWait
|
||||
; - CoverFade
|
||||
|
||||
; Public variables
|
||||
; - OffscreenPage
|
||||
; - VisibleGameCount (set during init)
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
OffscreenPage
|
||||
!byte 1 ; 0 = currently showing HGR page 2
|
||||
; (so offscreen is page 1 @ $2000)
|
||||
|
@ -159,30 +157,6 @@ LoadGameTitleOffscreen
|
|||
+ !byte $FD ; SMC
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; CoverFade
|
||||
; load cover screen and animate per-character fade
|
||||
;
|
||||
; in: none
|
||||
; out: all flags and registers clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
CoverFade
|
||||
jsr LoadCoverOffscreen
|
||||
jsr ShowOtherPage
|
||||
lda OffscreenPage
|
||||
bne +
|
||||
jsr LoadCoverOffscreen
|
||||
jsr ShowOtherPage
|
||||
+
|
||||
jsr LoadFile ; load transition effect code at $6000
|
||||
!word kFXDirectory
|
||||
!word @CoverFadeFile
|
||||
!word $6000
|
||||
jmp $6000 ; exit via loaded code
|
||||
@CoverFadeFile
|
||||
!byte 9
|
||||
!text "COVERFADE"
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; DrawUIWithoutDots/DrawUI
|
||||
; draw 2- or 4-line UI on the HGR page that is not currently showing, then
|
||||
|
@ -630,7 +604,17 @@ WaitForKeyFor30Seconds
|
|||
bne @loop ; on every keypress (whether or not
|
||||
dec Timeout+2 ; the key leads to an action)
|
||||
bne @loop
|
||||
jsr CoverFade ; no input for ~30 seconds, switch to
|
||||
jmp MegaAttractMode ; mega-attract mode
|
||||
|
||||
}
|
||||
; execution falls through here
|
||||
CoverFade
|
||||
jsr LoadCoverOffscreen
|
||||
jsr ShowOtherPage
|
||||
lda OffscreenPage
|
||||
bne +
|
||||
jsr LoadCoverOffscreen
|
||||
jsr ShowOtherPage
|
||||
+ jsr LoadFile ; load transition effect code at $6000
|
||||
!word kFXDirectory
|
||||
!word kCoverFadeFile
|
||||
!word $6000
|
||||
jsr $6000 ; call transition effect
|
||||
jmp MegaAttractMode ; exit via mega attract mode
|
||||
|
|
|
@ -6,13 +6,11 @@
|
|||
; Public functions
|
||||
; - Credits
|
||||
|
||||
!zone {
|
||||
|
||||
Credits
|
||||
; clobbers all
|
||||
jsr LoadFile ; load credits text into $8000
|
||||
!word kRootDirectory
|
||||
!word .CreditsFile
|
||||
!word kCreditsFile
|
||||
!word $8000
|
||||
jsr ClearOffscreen
|
||||
lda OffscreenPage
|
||||
|
@ -25,7 +23,3 @@ Credits
|
|||
jsr ShowOtherPage ; back to previous page
|
||||
clc ; if called from search mode, tell caller not to refresh
|
||||
rts
|
||||
.CreditsFile
|
||||
!byte 7
|
||||
!text "CREDITS"
|
||||
}
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
; - SearchMode
|
||||
;
|
||||
|
||||
!zone {
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; SearchMode
|
||||
; main entry point for Search Mode, which allows the user to search the game
|
||||
|
@ -24,11 +22,11 @@ SearchMode
|
|||
inx
|
||||
stx OffscreenPage ; $00 = currently showing HGR page 2
|
||||
jsr Home ; clear screen (switches to text mode)
|
||||
jsr .OnInputChanged ; draw UI on HGR page 1
|
||||
jsr OnInputChanged ; draw UI on HGR page 1
|
||||
jsr HGRMode ; show HGR screen
|
||||
bit CLEARKBD
|
||||
|
||||
.SearchModeInputLoop
|
||||
@SearchModeInputLoop
|
||||
jsr WaitForKeyFor30Seconds
|
||||
|
||||
; Don't clear keyboard strobe yet. If the user pressed an arrow key,
|
||||
|
@ -49,9 +47,9 @@ SearchMode
|
|||
ldy #kNumBrowseKeys
|
||||
- dey
|
||||
bmi @noKeyMatch
|
||||
cmp .InputKeys,y
|
||||
cmp InputKeys,y
|
||||
bne -
|
||||
ldx .InputKeyDispatch,y
|
||||
ldx InputKeyDispatch,y
|
||||
bne @InputDispatch ; always branches
|
||||
|
||||
@noKeyMatch
|
||||
|
@ -63,63 +61,63 @@ SearchMode
|
|||
ldx #kInputSearch
|
||||
; execution falls through here
|
||||
@InputDispatch
|
||||
ldy .InputDispatchTableLo,x
|
||||
ldy InputDispatchTableLo,x
|
||||
sty @j+1
|
||||
ldy .InputDispatchTableHi,x
|
||||
ldy InputDispatchTableHi,x
|
||||
sty @j+2
|
||||
@j jsr $FDFD ; SMC
|
||||
bcc .SearchModeInputLoop ; if carry is clear, we're done
|
||||
bcc @SearchModeInputLoop ; if carry is clear, we're done
|
||||
bcs SearchMode ; if carry is set, force full redraw
|
||||
|
||||
.OnError
|
||||
OnError
|
||||
jmp SoftBell ; Beep on invalid input and start over.
|
||||
|
||||
.OnClear
|
||||
OnClear
|
||||
ldx InputLength
|
||||
bne +
|
||||
jsr CoverFade ; Esc with no input switches to
|
||||
jmp MegaAttractMode ; mega-attract mode
|
||||
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
|
||||
beq OnInputChanged ; always branches
|
||||
|
||||
.OnBack
|
||||
OnBack
|
||||
ldx InputLength
|
||||
beq .OnError
|
||||
beq OnError
|
||||
dec InputLength
|
||||
jmp .OnInputChanged
|
||||
jmp OnInputChanged
|
||||
|
||||
.OnTab
|
||||
OnTab
|
||||
ldx gGameToLaunch
|
||||
cpx #$FF
|
||||
beq .OnError
|
||||
beq OnError
|
||||
jsr MiniAttractMode
|
||||
cmp #$8D ; if we exited mini attract mode
|
||||
beq .OnLaunch ; by pressing Enter, launch the game
|
||||
beq OnLaunch ; by pressing Enter, launch the game
|
||||
sec ; tell caller to redraw UI
|
||||
rts
|
||||
|
||||
.OnLaunch
|
||||
OnLaunch
|
||||
ldx gGameToLaunch
|
||||
cpx #$FF
|
||||
beq .OnError
|
||||
beq OnError
|
||||
jsr PlayGame
|
||||
sec ; tell caller to redraw UI
|
||||
rts
|
||||
|
||||
.OnCheat
|
||||
dec gGameToLaunch ; force reload (will be reset to correct value in .OnInputChanged)
|
||||
OnCheat
|
||||
dec gGameToLaunch ; force reload (will be reset to correct value in OnInputChanged)
|
||||
jsr ToggleCheat
|
||||
beq .OnInputChanged ; always branches because Z=1 on exit from ToggleCheat
|
||||
beq OnInputChanged ; always branches because Z=1 on exit from ToggleCheat
|
||||
|
||||
.OnSearch
|
||||
OnSearch
|
||||
ldx InputLength
|
||||
cpx #MaxInputLength
|
||||
beq .OnError
|
||||
beq OnError
|
||||
sta InputBuffer,x
|
||||
inc InputLength
|
||||
; execution falls through here
|
||||
.OnInputChanged
|
||||
OnInputChanged
|
||||
lda InputLength
|
||||
bne @findMatchingTitle
|
||||
; no input, reset params and UI
|
||||
|
@ -141,7 +139,7 @@ SearchMode
|
|||
bne +
|
||||
; no matches for this input buffer
|
||||
dec InputLength ; ignore the last key typed
|
||||
jmp .OnError ; beep and return
|
||||
jmp OnError ; beep and return
|
||||
+
|
||||
ldx BestMatchIndex ; check if the new best match is the same
|
||||
cpx gGameToLaunch ; as the current best match
|
||||
|
@ -167,29 +165,29 @@ kInputCredits = 6
|
|||
kInputCheat = 7
|
||||
kInputError = 8
|
||||
|
||||
.InputDispatchTableLo
|
||||
!byte <.OnSearch
|
||||
!byte <.OnClear
|
||||
!byte <.OnBack
|
||||
InputDispatchTableLo
|
||||
!byte <OnSearch
|
||||
!byte <OnClear
|
||||
!byte <OnBack
|
||||
!byte <BrowseMode
|
||||
!byte <.OnTab
|
||||
!byte <.OnLaunch
|
||||
!byte <OnTab
|
||||
!byte <OnLaunch
|
||||
!byte <Credits
|
||||
!byte <.OnCheat
|
||||
!byte <.OnError
|
||||
.InputDispatchTableHi
|
||||
!byte >.OnSearch
|
||||
!byte >.OnClear
|
||||
!byte >.OnBack
|
||||
!byte <OnCheat
|
||||
!byte <OnError
|
||||
InputDispatchTableHi
|
||||
!byte >OnSearch
|
||||
!byte >OnClear
|
||||
!byte >OnBack
|
||||
!byte >BrowseMode
|
||||
!byte >.OnTab
|
||||
!byte >.OnLaunch
|
||||
!byte >OnTab
|
||||
!byte >OnLaunch
|
||||
!byte >Credits
|
||||
!byte >.OnCheat
|
||||
!byte >.OnError
|
||||
!byte >OnCheat
|
||||
!byte >OnError
|
||||
|
||||
kNumInputKeys = 9 ; number of entries in next 2 tables (each)
|
||||
.InputKeys
|
||||
InputKeys
|
||||
!byte $83 ; Ctrl-C = toggle cheat mode
|
||||
!byte $AF ; '/' = credits
|
||||
!byte $BF ; '?' = credits
|
||||
|
@ -201,7 +199,7 @@ kNumInputKeys = 9 ; number of entries in next 2 tables (each)
|
|||
!byte $8D ; ENTER = launch current game (if any)
|
||||
!byte $9B ; Esc = clear input buffer (if any)
|
||||
; or switch to mega attract mode
|
||||
.InputKeyDispatch
|
||||
InputKeyDispatch
|
||||
!byte kInputCheat
|
||||
!byte kInputCredits
|
||||
!byte kInputCredits
|
||||
|
@ -211,4 +209,3 @@ kNumInputKeys = 9 ; number of entries in next 2 tables (each)
|
|||
!byte kInputBack
|
||||
!byte kInputLaunch
|
||||
!byte kInputClear
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue