2019-07-03 22:31:50 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018-9 by 4am
|
|
|
|
;
|
|
|
|
; 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 22:04:38 +00:00
|
|
|
@BrowseModeInputLoop
|
2019-07-04 02:27:46 +00:00
|
|
|
jsr WaitForKeyFor30Seconds
|
2019-09-10 04:04:16 +00:00
|
|
|
bit CLEARKBD
|
2019-07-03 22:31:50 +00:00
|
|
|
|
2019-09-26 03:01:59 +00:00
|
|
|
; indices into BrowseDispatchTable below
|
|
|
|
kBrowseSearch = 0
|
|
|
|
kBrowsePrevious = 1
|
|
|
|
kBrowseNext = 2
|
|
|
|
kBrowseExitToSearch = 3
|
|
|
|
kBrowseTab = 4
|
|
|
|
kBrowseLaunch = 5
|
2019-09-26 17:46:13 +00:00
|
|
|
kBrowseHelp = 6
|
|
|
|
kBrowseCredits = 7
|
|
|
|
kBrowseCheat = 8
|
2019-11-27 21:51:43 +00:00
|
|
|
kSoftBell = 9 ; must match kInputError
|
2019-09-26 03:01:59 +00:00
|
|
|
|
2019-09-06 19:21:38 +00:00
|
|
|
ldy #kNumBrowseKeys
|
|
|
|
- dey
|
|
|
|
bmi @noKeyMatch
|
2019-09-21 22:04:38 +00:00
|
|
|
cmp BrowseKeys,y
|
2019-09-06 19:21:38 +00:00
|
|
|
bne -
|
2019-09-21 22:04:38 +00:00
|
|
|
ldx BrowseKeyDispatch,y
|
2019-07-10 17:37:59 +00:00
|
|
|
bne @BrowseDispatch ; always branches
|
|
|
|
|
2019-09-06 19:21:38 +00:00
|
|
|
@noKeyMatch
|
2019-07-04 02:27:46 +00:00
|
|
|
jsr IsSearchKey
|
2019-11-27 21:51:43 +00:00
|
|
|
bne @BrowseDispatch
|
2019-07-03 22:31:50 +00:00
|
|
|
ldx #kBrowseSearch
|
2019-11-27 21:51:43 +00:00
|
|
|
|
2019-07-03 22:31:50 +00:00
|
|
|
; execution falls through here
|
|
|
|
@BrowseDispatch
|
2019-09-21 22:04:38 +00:00
|
|
|
ldy BrowseDispatchTableLo,x
|
2019-09-06 19:21:38 +00:00
|
|
|
sty @j+1
|
2019-09-21 22:04:38 +00:00
|
|
|
ldy BrowseDispatchTableHi,x
|
2019-09-06 19:21:38 +00:00
|
|
|
sty @j+2
|
2019-07-03 22:31:50 +00:00
|
|
|
@j jsr $FDFD ; SMC
|
2019-09-21 22:04:38 +00:00
|
|
|
jmp @BrowseModeInputLoop
|
2019-07-03 22:31:50 +00:00
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowseSearch
|
2019-07-03 22:31:50 +00:00
|
|
|
sta InputBuffer
|
|
|
|
lda #$01
|
|
|
|
sta InputLength
|
|
|
|
jmp SearchMode
|
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowsePrevious
|
2019-10-10 01:02:46 +00:00
|
|
|
ldx gGameToLaunch
|
2019-10-14 02:22:40 +00:00
|
|
|
inx ; Slightly pathological case: there may be no
|
|
|
|
; current game by the time we get here, e.g.
|
|
|
|
; if we entered browse mode by pressing left
|
|
|
|
; or up arrow from the global help screen.
|
|
|
|
; In this case, pretend we were at game 0 and
|
|
|
|
; continue with the key handler logic.
|
|
|
|
beq +
|
|
|
|
dex
|
2019-10-10 01:02:46 +00:00
|
|
|
bne .decindex
|
2019-10-14 02:22:40 +00:00
|
|
|
+ ldx GameCount
|
2019-10-10 01:02:46 +00:00
|
|
|
|
|
|
|
.decindex
|
|
|
|
dex
|
|
|
|
|
|
|
|
.setindex
|
|
|
|
stx gGameToLaunch
|
|
|
|
jmp OnBrowseChanged
|
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowseNext
|
2019-09-21 03:26:32 +00:00
|
|
|
ldx gGameToLaunch
|
2019-10-10 01:02:46 +00:00
|
|
|
inx
|
2019-09-11 04:26:00 +00:00
|
|
|
GameCount = *+1
|
2019-10-10 01:02:46 +00:00
|
|
|
cpx #$D1 ; SMC
|
|
|
|
bne .setindex
|
2019-07-03 22:31:50 +00:00
|
|
|
ldx #0
|
2019-10-10 01:02:46 +00:00
|
|
|
beq .setindex ; branch always
|
2019-07-03 22:31:50 +00:00
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowseLaunch
|
2019-09-21 03:26:32 +00:00
|
|
|
jsr PlayGame
|
2019-07-04 02:27:46 +00:00
|
|
|
jsr BlankHGR
|
2019-09-21 22:04:38 +00:00
|
|
|
jmp ForceBrowseChanged
|
2019-09-16 17:36:48 +00:00
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowseCheat
|
2019-09-16 17:36:48 +00:00
|
|
|
jsr ToggleCheat
|
2019-09-21 22:04:38 +00:00
|
|
|
beq ForceBrowseChanged ; always branches because Z=1 on exit from ToggleCheat
|
2019-07-04 02:27:46 +00:00
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowseTab
|
2019-07-03 22:31:50 +00:00
|
|
|
jsr MiniAttractMode
|
|
|
|
cmp #$8D
|
2019-09-21 22:04:38 +00:00
|
|
|
beq OnBrowseLaunch
|
|
|
|
; execution falls through here
|
|
|
|
ForceBrowseChanged
|
2019-09-16 17:36:48 +00:00
|
|
|
bit CLEARKBD
|
2019-07-04 02:27:46 +00:00
|
|
|
; execution falls through here
|
2019-09-21 22:04:38 +00:00
|
|
|
OnBrowseChanged
|
2019-10-05 20:40:19 +00:00
|
|
|
; in: gGameToLaunch = game index
|
|
|
|
jsr SwitchToBank2
|
|
|
|
jsr EnableAcceleratorAndSwitchToBank1
|
2019-09-21 21:35:49 +00:00
|
|
|
jsr LoadGameTitleOffscreen
|
2019-09-28 12:35:48 +00:00
|
|
|
jsr DrawUIWithoutDots
|
|
|
|
jmp MaybeAnimateTitle
|
2019-07-03 22:31:50 +00:00
|
|
|
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
2019-09-21 22:04:38 +00:00
|
|
|
BrowseDispatchTableLo
|
|
|
|
!byte <OnBrowseSearch
|
|
|
|
!byte <OnBrowsePrevious
|
|
|
|
!byte <OnBrowseNext
|
2019-09-06 19:21:38 +00:00
|
|
|
!byte <SearchMode
|
2019-09-21 22:04:38 +00:00
|
|
|
!byte <OnBrowseTab
|
|
|
|
!byte <OnBrowseLaunch
|
2019-09-26 17:46:13 +00:00
|
|
|
!byte <Help
|
2019-09-06 19:21:38 +00:00
|
|
|
!byte <Credits
|
2019-09-21 22:04:38 +00:00
|
|
|
!byte <OnBrowseCheat
|
2019-09-26 03:01:59 +00:00
|
|
|
!byte <SoftBell
|
2019-09-21 22:04:38 +00:00
|
|
|
BrowseDispatchTableHi
|
|
|
|
!byte >OnBrowseSearch
|
|
|
|
!byte >OnBrowsePrevious
|
|
|
|
!byte >OnBrowseNext
|
2019-09-06 19:21:38 +00:00
|
|
|
!byte >SearchMode
|
2019-09-21 22:04:38 +00:00
|
|
|
!byte >OnBrowseTab
|
|
|
|
!byte >OnBrowseLaunch
|
2019-09-26 17:46:13 +00:00
|
|
|
!byte >Help
|
2019-09-06 19:21:38 +00:00
|
|
|
!byte >Credits
|
2019-09-21 22:04:38 +00:00
|
|
|
!byte >OnBrowseCheat
|
2019-09-26 03:01:59 +00:00
|
|
|
!byte >SoftBell
|
2019-09-06 19:21:38 +00:00
|
|
|
|
2019-09-26 17:46:13 +00:00
|
|
|
kNumBrowseKeys = 12 ; number of entries in next 2 tables (each)
|
2019-09-21 22:04:38 +00:00
|
|
|
BrowseKeys
|
2019-09-16 17:36:48 +00:00
|
|
|
!byte $83 ; Ctrl-C = toggle cheat mode
|
2019-12-20 15:25:30 +00:00
|
|
|
!byte $81 ; Ctrl-A = about
|
2019-09-26 17:46:13 +00:00
|
|
|
!byte $AF ; '/' = help
|
|
|
|
!byte $BF ; '?' = help
|
2019-09-06 19:21:38 +00: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
|
2019-09-21 22:04:38 +00:00
|
|
|
BrowseKeyDispatch
|
2019-09-16 17:36:48 +00:00
|
|
|
!byte kBrowseCheat
|
2019-09-06 19:21:38 +00:00
|
|
|
!byte kBrowseCredits
|
2019-09-26 17:46:13 +00:00
|
|
|
!byte kBrowseHelp
|
|
|
|
!byte kBrowseHelp
|
2019-09-06 19:21:38 +00:00
|
|
|
!byte kBrowseTab
|
|
|
|
!byte kBrowseTab
|
|
|
|
!byte kBrowseLaunch
|
|
|
|
!byte kBrowseExitToSearch
|
|
|
|
!byte kBrowseNext
|
|
|
|
!byte kBrowseNext
|
|
|
|
!byte kBrowsePrevious
|
|
|
|
!byte kBrowsePrevious
|