2019-07-03 18:31:50 -04:00
|
|
|
;license:MIT
|
2020-03-16 21:58:05 -04:00
|
|
|
;(c) 2018-2020 by 4am
|
2019-07-03 18:31:50 -04:00
|
|
|
;
|
|
|
|
; Browse Mode - main UI
|
|
|
|
;
|
|
|
|
; Public functions
|
|
|
|
; - BrowseMode
|
|
|
|
;
|
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; BrowseMode
|
|
|
|
; main entry point for Browse Mode, which allows the user to browse the game
|
|
|
|
; catalog in alphabetical order and launch games
|
|
|
|
;
|
|
|
|
; in: none
|
|
|
|
; out: never returns to caller (may JMP to other major modes)
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
BrowseMode
|
|
|
|
ldx #$FF
|
|
|
|
txs
|
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
@BrowseModeInputLoop
|
2019-07-03 22:27:46 -04:00
|
|
|
jsr WaitForKeyFor30Seconds
|
2019-09-10 00:04:16 -04:00
|
|
|
bit CLEARKBD
|
2019-07-03 18:31:50 -04:00
|
|
|
|
2019-09-25 20:01:59 -07:00
|
|
|
; indices into BrowseDispatchTable below
|
|
|
|
kBrowseSearch = 0
|
|
|
|
kBrowsePrevious = 1
|
|
|
|
kBrowseNext = 2
|
|
|
|
kBrowseExitToSearch = 3
|
|
|
|
kBrowseTab = 4
|
|
|
|
kBrowseLaunch = 5
|
2019-09-26 13:46:13 -04:00
|
|
|
kBrowseHelp = 6
|
|
|
|
kBrowseCredits = 7
|
|
|
|
kBrowseCheat = 8
|
2019-11-27 13:51:43 -08:00
|
|
|
kSoftBell = 9 ; must match kInputError
|
2020-06-15 12:44:46 -04:00
|
|
|
kBrowseJoystick = 10
|
2020-07-29 12:15:22 -04:00
|
|
|
kBrowseQuit = 11
|
2019-09-25 20:01:59 -07:00
|
|
|
|
2019-09-06 15:21:38 -04:00
|
|
|
ldy #kNumBrowseKeys
|
|
|
|
- dey
|
|
|
|
bmi @noKeyMatch
|
2019-09-21 18:04:38 -04:00
|
|
|
cmp BrowseKeys,y
|
2019-09-06 15:21:38 -04:00
|
|
|
bne -
|
2019-09-21 18:04:38 -04:00
|
|
|
ldx BrowseKeyDispatch,y
|
2019-07-10 13:37:59 -04:00
|
|
|
bne @BrowseDispatch ; always branches
|
|
|
|
|
2019-09-06 15:21:38 -04:00
|
|
|
@noKeyMatch
|
2019-07-03 22:27:46 -04:00
|
|
|
jsr IsSearchKey
|
2021-10-13 15:58:26 -07:00
|
|
|
!if kBrowseSearch > 0 {
|
2019-11-27 13:51:43 -08:00
|
|
|
bne @BrowseDispatch
|
2019-07-03 18:31:50 -04:00
|
|
|
ldx #kBrowseSearch
|
2021-10-13 15:58:26 -07:00
|
|
|
}
|
2019-11-27 13:51:43 -08:00
|
|
|
|
2019-07-03 18:31:50 -04:00
|
|
|
; execution falls through here
|
|
|
|
@BrowseDispatch
|
2019-09-21 18:04:38 -04:00
|
|
|
ldy BrowseDispatchTableLo,x
|
2019-09-06 15:21:38 -04:00
|
|
|
sty @j+1
|
2019-09-21 18:04:38 -04:00
|
|
|
ldy BrowseDispatchTableHi,x
|
2019-09-06 15:21:38 -04:00
|
|
|
sty @j+2
|
2019-07-03 18:31:50 -04:00
|
|
|
@j jsr $FDFD ; SMC
|
2019-09-21 18:04:38 -04:00
|
|
|
jmp @BrowseModeInputLoop
|
2019-07-03 18:31:50 -04:00
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowseSearch
|
2019-07-03 18:31:50 -04:00
|
|
|
sta InputBuffer
|
|
|
|
lda #$01
|
|
|
|
sta InputLength
|
|
|
|
jmp SearchMode
|
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowsePrevious
|
2020-11-09 10:45:03 -08:00
|
|
|
+LDX16 gGameToLaunch
|
2021-10-13 15:58:26 -07:00
|
|
|
+CPX16_0_NE @notFirstGame
|
2020-11-09 10:45:03 -08:00
|
|
|
+LDX16 GameCount
|
2020-03-24 16:30:14 -04:00
|
|
|
@notFirstGame
|
2020-11-09 10:45:03 -08:00
|
|
|
+DEX16
|
|
|
|
jmp notLastGame
|
2019-10-09 18:02:46 -07:00
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowseNext
|
2020-11-09 10:45:03 -08:00
|
|
|
+LDX16 gGameToLaunch
|
|
|
|
+INX16
|
2021-10-13 15:58:26 -07:00
|
|
|
+CPX16ADDR_NE GameCount, notLastGame
|
2020-11-09 10:45:03 -08:00
|
|
|
ldx #0
|
|
|
|
ldy #0
|
|
|
|
notLastGame
|
|
|
|
+STX16 gGameToLaunch
|
2020-03-24 16:30:14 -04:00
|
|
|
jmp OnBrowseChanged
|
2019-07-03 18:31:50 -04:00
|
|
|
|
2021-11-12 20:46:05 -05:00
|
|
|
ReloadIndexAndLaunch
|
|
|
|
jsr ReloadSearchIndex
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowseLaunch
|
2019-09-20 23:26:32 -04:00
|
|
|
jsr PlayGame
|
2019-07-03 22:27:46 -04:00
|
|
|
jsr BlankHGR
|
2019-09-21 18:04:38 -04:00
|
|
|
jmp ForceBrowseChanged
|
2019-09-16 13:36:48 -04:00
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowseCheat
|
2019-09-16 13:36:48 -04:00
|
|
|
jsr ToggleCheat
|
2019-09-21 18:04:38 -04:00
|
|
|
beq ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat
|
2019-07-03 22:27:46 -04:00
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowseTab
|
2019-07-03 18:31:50 -04:00
|
|
|
jsr MiniAttractMode
|
|
|
|
cmp #$8D
|
2021-11-12 20:46:05 -05:00
|
|
|
beq ReloadIndexAndLaunch
|
2019-09-21 18:04:38 -04:00
|
|
|
; execution falls through here
|
|
|
|
ForceBrowseChanged
|
2021-11-12 20:46:05 -05:00
|
|
|
jsr ReloadSearchIndex
|
2019-09-16 13:36:48 -04:00
|
|
|
bit CLEARKBD
|
2019-07-03 22:27:46 -04:00
|
|
|
; execution falls through here
|
2019-09-21 18:04:38 -04:00
|
|
|
OnBrowseChanged
|
2020-03-24 16:30:14 -04:00
|
|
|
; in: gGameToLaunch = game index (word)
|
2021-11-11 22:20:06 -05:00
|
|
|
; gSearchStore populated
|
2019-10-05 16:40:19 -04:00
|
|
|
jsr SwitchToBank2
|
|
|
|
jsr EnableAcceleratorAndSwitchToBank1
|
2019-09-21 17:35:49 -04:00
|
|
|
jsr LoadGameTitleOffscreen
|
2019-09-28 08:35:48 -04:00
|
|
|
jsr DrawUIWithoutDots
|
|
|
|
jmp MaybeAnimateTitle
|
2020-03-09 18:05:01 -04:00
|
|
|
BrowseCreditsWrapper
|
|
|
|
jsr Credits
|
|
|
|
jmp ForceBrowseChanged
|
|
|
|
BrowseHelpWrapper
|
|
|
|
jsr Help
|
|
|
|
jmp ForceBrowseChanged
|
2019-07-03 18:31:50 -04:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
2019-09-21 18:04:38 -04:00
|
|
|
BrowseDispatchTableLo
|
|
|
|
!byte <OnBrowseSearch
|
|
|
|
!byte <OnBrowsePrevious
|
|
|
|
!byte <OnBrowseNext
|
2019-09-06 15:21:38 -04:00
|
|
|
!byte <SearchMode
|
2019-09-21 18:04:38 -04:00
|
|
|
!byte <OnBrowseTab
|
|
|
|
!byte <OnBrowseLaunch
|
2020-03-09 18:05:01 -04:00
|
|
|
!byte <BrowseHelpWrapper
|
|
|
|
!byte <BrowseCreditsWrapper
|
2019-09-21 18:04:38 -04:00
|
|
|
!byte <OnBrowseCheat
|
2019-09-25 20:01:59 -07:00
|
|
|
!byte <SoftBell
|
2020-06-15 12:44:46 -04:00
|
|
|
!byte <Joystick
|
2020-07-29 12:15:22 -04:00
|
|
|
!byte <OnQuit
|
2019-09-21 18:04:38 -04:00
|
|
|
BrowseDispatchTableHi
|
|
|
|
!byte >OnBrowseSearch
|
|
|
|
!byte >OnBrowsePrevious
|
|
|
|
!byte >OnBrowseNext
|
2019-09-06 15:21:38 -04:00
|
|
|
!byte >SearchMode
|
2019-09-21 18:04:38 -04:00
|
|
|
!byte >OnBrowseTab
|
|
|
|
!byte >OnBrowseLaunch
|
2020-03-09 18:05:01 -04:00
|
|
|
!byte >BrowseHelpWrapper
|
|
|
|
!byte >BrowseCreditsWrapper
|
2019-09-21 18:04:38 -04:00
|
|
|
!byte >OnBrowseCheat
|
2019-09-25 20:01:59 -07:00
|
|
|
!byte >SoftBell
|
2020-06-15 12:44:46 -04:00
|
|
|
!byte >Joystick
|
2020-07-29 12:15:22 -04:00
|
|
|
!byte >OnQuit
|
2019-09-06 15:21:38 -04:00
|
|
|
|
2020-07-28 18:06:36 -07:00
|
|
|
kNumBrowseKeys = 14
|
|
|
|
; number of entries in next 2 tables (each)
|
2019-09-21 18:04:38 -04:00
|
|
|
BrowseKeys
|
2019-09-16 13:36:48 -04:00
|
|
|
!byte $83 ; Ctrl-C = toggle cheat mode
|
2019-12-20 10:25:30 -05:00
|
|
|
!byte $81 ; Ctrl-A = about
|
2019-09-26 13:46:13 -04:00
|
|
|
!byte $AF ; '/' = help
|
|
|
|
!byte $BF ; '?' = help
|
2019-09-06 15:21:38 -04:00
|
|
|
!byte $A0 ; Space = mini attract mode
|
|
|
|
!byte $89 ; TAB = mini attract mode
|
|
|
|
!byte $8D ; ENTER = launch current game
|
|
|
|
!byte $9B ; Esc = switch to search mode
|
|
|
|
!byte $8A ; down arrow = next
|
|
|
|
!byte $95 ; right arrow = next
|
|
|
|
!byte $8B ; up arrow = previous
|
|
|
|
!byte $88 ; left arrow = previous
|
2020-06-15 12:44:46 -04:00
|
|
|
!byte $90 ; Ctrl-P = launch joystick calibration program
|
2020-07-29 12:15:22 -04:00
|
|
|
!byte $91 ; Ctrl-Q = quit
|
2019-09-21 18:04:38 -04:00
|
|
|
BrowseKeyDispatch
|
2019-09-16 13:36:48 -04:00
|
|
|
!byte kBrowseCheat
|
2019-09-06 15:21:38 -04:00
|
|
|
!byte kBrowseCredits
|
2019-09-26 13:46:13 -04:00
|
|
|
!byte kBrowseHelp
|
|
|
|
!byte kBrowseHelp
|
2019-09-06 15:21:38 -04:00
|
|
|
!byte kBrowseTab
|
|
|
|
!byte kBrowseTab
|
|
|
|
!byte kBrowseLaunch
|
|
|
|
!byte kBrowseExitToSearch
|
|
|
|
!byte kBrowseNext
|
|
|
|
!byte kBrowseNext
|
|
|
|
!byte kBrowsePrevious
|
|
|
|
!byte kBrowsePrevious
|
2020-06-15 12:44:46 -04:00
|
|
|
!byte kBrowseJoystick
|
2020-07-29 12:15:22 -04:00
|
|
|
!byte kBrowseQuit
|
2020-03-24 16:30:14 -04:00
|
|
|
|
|
|
|
GameCount
|
|
|
|
!word 0
|