mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-28 03:29:59 +00:00
move parse.games to init, update dates, other comments
This commit is contained in:
parent
5bb7d559f9
commit
74f6cebac4
11
src/4cade.a
11
src/4cade.a
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
!cpu 6502
|
||||
!to "build/LAUNCHER.SYSTEM",plain
|
||||
@ -9,7 +9,7 @@
|
||||
RELBASE=$2000
|
||||
}
|
||||
|
||||
!source "src/constants.a"
|
||||
!source "src/constants.a" ; no code in these
|
||||
!source "src/macros.a"
|
||||
|
||||
; first-run initialization, relocates code to language card and jumps
|
||||
@ -35,7 +35,7 @@ FirstMover
|
||||
;
|
||||
; If there is no stack to restore, this exits via SearchMode.
|
||||
;
|
||||
; in: no parameters
|
||||
; in: none
|
||||
; out: see above
|
||||
;------------------------------------------------------------------------------
|
||||
Reenter
|
||||
@ -61,7 +61,7 @@ RestoreStackNextTime
|
||||
bne -
|
||||
ldx $DF00 ; restore stack pointer
|
||||
txs
|
||||
rts
|
||||
rts ; and return to caller
|
||||
|
||||
; these routines will only be called after relocating to language card
|
||||
!source "src/ui.search.mode.a"
|
||||
@ -77,11 +77,12 @@ RestoreStackNextTime
|
||||
!source "src/textrank.a"
|
||||
!source "src/parse.common.a"
|
||||
!source "src/parse.prefs.a"
|
||||
!source "src/parse.games.a"
|
||||
!source "src/ui.sound.a"
|
||||
!source "src/ui.font.a"
|
||||
gGlobalPrefsStore
|
||||
!word $D000 ; address of first okvs store
|
||||
gGamesListStore
|
||||
!word $FDFD ; SMC
|
||||
!word Reenter ; NMI vector ($FFFA-B)
|
||||
!word Reenter ; reset vector ($FFFC-D)
|
||||
!word Reenter ; IRQ vector ($FFFE-F)
|
||||
|
@ -1,8 +1,11 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; first-run initialization code
|
||||
;
|
||||
; This file is included directly and is run from $2000/main as soon as the
|
||||
; .SYSTEM file is loaded
|
||||
;
|
||||
|
||||
; this file is included directly and is run from $2000/main as soon as the .SYSTEM file is loaded
|
||||
|
||||
sta $C00E ; 40-column
|
||||
sta $C00C
|
||||
@ -73,6 +76,10 @@ ProRWTSBuffer
|
||||
*=ProRWTSBuffer+512 ; ProRWTS needs a 512-byte buffer for its init function
|
||||
; so we reuse as much of the 1-time code as possible
|
||||
; and fill the rest with zeros
|
||||
|
||||
!source "src/parse.games.a" ; this needs to be outside the buffer because it's not used
|
||||
; until after ProRWTS initialization
|
||||
|
||||
OneTimeSetup
|
||||
lda MachineStatus
|
||||
sta oldstatus
|
||||
@ -136,20 +143,22 @@ OneTimeSetup
|
||||
cpy #$03
|
||||
bcc @outer
|
||||
|
||||
bit $C010 ; clear keyboard strobe so we don't mistakenly think we just tried to run something
|
||||
|
||||
ldx #5
|
||||
- lda Prelaunch,x ; copy reentry wrapper to bottom of stack
|
||||
sta $100,x ; (many self-running demos use this)
|
||||
dex
|
||||
sta $100,x ; (used as reset vector because ][+ always
|
||||
dex ; switches to ROM on Ctrl-Reset)
|
||||
bpl -
|
||||
|
||||
inx
|
||||
stx $3F2 ; page 3 reset vector to ($100)
|
||||
inx
|
||||
stx $3F3
|
||||
ldx #$A4
|
||||
stx $3F4
|
||||
jmp $100 ; continue execution from LC RAM bank
|
||||
|
||||
bit $C010
|
||||
|
||||
jmp ($FFFC) ; continue from |Reentry| in LC RAM bank
|
||||
|
||||
kGameListConfFile
|
||||
!byte 10
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Functions to launch games and self-running demos
|
||||
;
|
||||
|
@ -1,3 +1,9 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; IIgs support functions
|
||||
;
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; IsGS
|
||||
; detect IIgs by running CPU-specific magic
|
||||
|
@ -1,3 +1,9 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; VidHD support functions
|
||||
;
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; HasVidHDCard
|
||||
; detect VidHD card by searching for magic bytes across all slots
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; common assembler macros (6502 compatible)
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Ordered key/value store (6502 compatible)
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; generic key/value text parser
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; GAMES.CONF parser
|
||||
;
|
||||
@ -7,9 +7,6 @@
|
||||
; - ParseGamesList
|
||||
;
|
||||
|
||||
gGamesListStore
|
||||
!word $FDFD ; SMC
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; ParseGamesList
|
||||
; parse buffer with AB,KEY=VALUE lines of text into an okvs
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Parser for global preferences file
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; ProDOS - functions for constructing and passing around ProDOS pathnames
|
||||
;
|
||||
|
@ -1,6 +1,6 @@
|
||||
;license:BSD-3-Clause
|
||||
;extended open/read/write binary file in ProDOS filesystem, with random access
|
||||
;copyright (c) Peter Ferrie 2013-18
|
||||
;copyright (c) Peter Ferrie 2013-19
|
||||
|
||||
ver_02 = 1
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am & qkumba
|
||||
;
|
||||
; text rank - an implementation of the Quicksilver search rank algorithm
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Double hi-res slideshows
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; HGR title and action slideshows
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Mega Attract Mode - cycle through slideshows and self-running demos
|
||||
;
|
||||
@ -19,14 +19,13 @@
|
||||
; self-terminating game demos
|
||||
;
|
||||
; in: gGlobalPrefsStore must be initialized
|
||||
; out: exits to caller (note that some attract mode modules never return but
|
||||
; instead call |Reenter|, in which case this routine technically never
|
||||
; returns)
|
||||
; if this routine returns, everything is clobbered (zero page, main
|
||||
; memory, unused portions of the stack page, all registers, all flags)
|
||||
; out: never returns to caller (may JMP to other major modes)
|
||||
;------------------------------------------------------------------------------
|
||||
MegaAttractMode
|
||||
jsr BlankHGR
|
||||
ldx #$FF
|
||||
txs
|
||||
|
||||
jsr BlankHGR ; switch to HGR page 1 (once cleared)
|
||||
|
||||
+LDADDR kAttractModeConfFile
|
||||
jsr SetPath
|
||||
@ -92,7 +91,6 @@ gAttractIndex
|
||||
cmp #$8D
|
||||
bne @jmpsearch
|
||||
jsr PlayGameFromAttract
|
||||
; execution falls through here
|
||||
@jmpattract
|
||||
jmp MegaAttractMode
|
||||
@jmpsearch
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Super hi-res slideshows
|
||||
;
|
||||
|
@ -1,24 +1,14 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; hi-res font drawing routines
|
||||
;
|
||||
; Public functions
|
||||
; - DrawPage
|
||||
; - Draw40Chars
|
||||
; - DrawString
|
||||
; - DrawBuffer
|
||||
;
|
||||
|
||||
DrawPage
|
||||
; A/Y contains address of text buffer
|
||||
; no special characters are drawn (0x20..0x7F only)
|
||||
; 0x0A acts as carriage return
|
||||
; drawing starts at HTAB 0, VTAB 0
|
||||
; drawing ends after 24 lines have been drawn
|
||||
|
||||
; TODO
|
||||
|
||||
Draw40Chars
|
||||
; A/Y contains address of character buffer
|
||||
; carry bit clear -> draw on page 1
|
||||
|
@ -1,3 +1,9 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; 'Circuitous' hi-res font data
|
||||
;
|
||||
|
||||
!pseudopc $D600 {
|
||||
FontDataRow0
|
||||
!byte $80
|
||||
|
@ -1,36 +1,31 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; Search Mode - UI to search game catalog, see game assets, and launch games
|
||||
; Search Mode - main UI
|
||||
;
|
||||
; Public functions
|
||||
; - SearchMode
|
||||
;
|
||||
|
||||
; indices into InputDispatchTable
|
||||
kInputSearch = 0
|
||||
kInputClear = 1
|
||||
kInputBack = 2
|
||||
kInputLaunch = 3
|
||||
|
||||
InputDispatchTable
|
||||
!word OnSearch
|
||||
!word OnClear
|
||||
!word OnBack
|
||||
!word OnLaunch
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; SearchMode
|
||||
; main entry point for Search Mode, which allows the user to search the game
|
||||
; catalog and launch games
|
||||
;
|
||||
; in: none
|
||||
; out: never returns to caller (may JMP to other major modes)
|
||||
;------------------------------------------------------------------------------
|
||||
SearchMode
|
||||
ldx #0
|
||||
stx OffscreenPage
|
||||
dex
|
||||
stx SelectedIndex ; no game selected
|
||||
ldx #$FF
|
||||
txs
|
||||
stx SelectedIndex ; no game selected
|
||||
inx
|
||||
stx OffscreenPage
|
||||
jsr Home ; clear screen
|
||||
lda #$FF
|
||||
jsr OnInputChanged ; draw UI on HGR page 1, set $C054
|
||||
jsr OnInputChanged ; draw UI on HGR page 1
|
||||
bit $C052
|
||||
bit $C057
|
||||
bit $C050
|
||||
bit $C050 ; show HGR page 1
|
||||
bit $C010
|
||||
jsr _ResetInputTimeout
|
||||
|
||||
@ -39,8 +34,8 @@ _SearchModeInputLoop
|
||||
bmi @gotKey
|
||||
|
||||
inc $4F ; these are only ever incremented, never
|
||||
bne + ; reset (used as a pseudorandom seed)
|
||||
inc $4E
|
||||
bne + ; reset (may be used as a pseudorandom
|
||||
inc $4E ; seed)
|
||||
+
|
||||
dec Timeout ; these are a 3-byte timeout counter
|
||||
bne _SearchModeInputLoop ; that counts down from a number set
|
||||
@ -48,8 +43,8 @@ _SearchModeInputLoop
|
||||
bne _SearchModeInputLoop ; on every keypress (whether or not
|
||||
dec Timeout+2 ; the key leads to an action)
|
||||
bne _SearchModeInputLoop
|
||||
jsr _CoverFade ; no input for ~30 seconds, so switch
|
||||
jmp MegaAttractMode ; to mega-attract mode
|
||||
jsr _CoverFade ; no input for ~30 seconds, switch to
|
||||
jmp MegaAttractMode ; mega-attract mode
|
||||
|
||||
@gotKey
|
||||
bit $C010
|
||||
@ -65,16 +60,15 @@ _SearchModeInputLoop
|
||||
ldx #kInputLaunch
|
||||
bne InputDispatch ; always branches
|
||||
+
|
||||
and #$7F
|
||||
|
||||
cmp #$7F ; delete key
|
||||
cmp #$FF ; delete key
|
||||
bne +
|
||||
- ldx #kInputBack
|
||||
bne InputDispatch ; always branches
|
||||
|
||||
+ cmp #$08 ; left arrow = delete
|
||||
+ cmp #$88 ; left arrow = delete
|
||||
beq -
|
||||
|
||||
and #$7F ; strip high bit for search characters
|
||||
cmp #$30 ; control keys and punctuation ignored
|
||||
bcc @badkey
|
||||
cmp #$3A ; numbers are good input
|
||||
@ -90,7 +84,6 @@ _SearchModeInputLoop
|
||||
bcc @badkey
|
||||
cmp #$7B ; lowercase letters are good input
|
||||
bcc @goodkey
|
||||
; execution falls through here
|
||||
@badkey
|
||||
jsr SoftBell ; beep on invalid input
|
||||
jmp _SearchModeInputLoop ; and start over
|
||||
@ -109,9 +102,8 @@ InputDispatch
|
||||
sta @j+2
|
||||
pla ; restore key pressed
|
||||
@j jsr $FDFD ; SMC
|
||||
bcc +
|
||||
jmp SearchMode
|
||||
+ jmp _SearchModeInputLoop
|
||||
bcc _SearchModeInputLoop
|
||||
jmp SearchMode ; if carry is set, force full redraw
|
||||
|
||||
OnClear
|
||||
ldx InputLength
|
||||
@ -149,7 +141,6 @@ OnSearch
|
||||
+ sta InputBuffer,x
|
||||
inc InputLength
|
||||
; execution falls through here
|
||||
|
||||
OnInputChanged
|
||||
lda InputLength
|
||||
bne @findMatchingTitle
|
||||
@ -168,13 +159,11 @@ OnInputChanged
|
||||
bne -
|
||||
lda #$7F
|
||||
sta UILine2+1
|
||||
|
||||
jsr _LoadCoverOffscreen
|
||||
jsr _DrawSearchBarOffscreen
|
||||
jsr _ShowOtherPage
|
||||
clc
|
||||
rts
|
||||
|
||||
@findMatchingTitle
|
||||
jsr ResetTextRank
|
||||
|
||||
@ -191,22 +180,19 @@ OnInputChanged
|
||||
lda BestMatchIndex ; check if the new best match is the same
|
||||
cmp SelectedIndex ; as the current best match
|
||||
php ; (we'll use this later to skip reloading)
|
||||
|
||||
sta SelectedIndex
|
||||
sta @index
|
||||
jsr okvs_nth
|
||||
!word gGamesListStore
|
||||
@index !byte $FD
|
||||
+STAY @key
|
||||
|
||||
plp
|
||||
bne +
|
||||
lda OffscreenPage
|
||||
eor #$01
|
||||
sta OffscreenPage
|
||||
jmp @skipload
|
||||
+
|
||||
lda OffscreenPage ; we have a new best match, so load the
|
||||
+ lda OffscreenPage ; we have a new best match, so load the
|
||||
beq + ; new title screenshot (offscreen)
|
||||
lda #$40
|
||||
+HIDE_NEXT_2_BYTES
|
||||
@ -243,7 +229,6 @@ OnInputChanged
|
||||
sta UILine2,y
|
||||
cpy #MaxInputLength+1
|
||||
bcc -
|
||||
|
||||
ldx #40
|
||||
lda #0
|
||||
- sta UILine1-1,x ; reset search bar
|
||||
@ -270,6 +255,7 @@ OnInputChanged
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
_LoadCoverOffscreen
|
||||
; clobbers all
|
||||
lda OffscreenPage
|
||||
beq +
|
||||
lda #$40
|
||||
@ -284,6 +270,7 @@ _LoadCoverOffscreen
|
||||
rts
|
||||
|
||||
_DrawSearchBarOffscreen
|
||||
; clobbers all
|
||||
lda #22 ; draw visible search bar
|
||||
sta VTAB
|
||||
lda OffscreenPage
|
||||
@ -296,6 +283,7 @@ _DrawSearchBarOffscreen
|
||||
jmp Draw40Chars
|
||||
|
||||
_ShowOtherPage
|
||||
; clobbers A, preserves X/Y
|
||||
lda OffscreenPage
|
||||
eor #$01
|
||||
sta OffscreenPage
|
||||
@ -314,6 +302,7 @@ _ResetInputTimeout
|
||||
rts
|
||||
|
||||
_CoverFade
|
||||
; clobbers all
|
||||
jsr _LoadCoverOffscreen
|
||||
jsr _ShowOtherPage
|
||||
lda OffscreenPage
|
||||
@ -356,3 +345,15 @@ OffscreenPage
|
||||
; (so offscreen is page 1 @ $2000)
|
||||
; 1 = currently showing HGR page 1
|
||||
; (so offscreen is page 2 @ $4000)
|
||||
|
||||
; indices into InputDispatchTable
|
||||
kInputSearch = 0
|
||||
kInputClear = 1
|
||||
kInputBack = 2
|
||||
kInputLaunch = 3
|
||||
|
||||
InputDispatchTable
|
||||
!word OnSearch
|
||||
!word OnClear
|
||||
!word OnBack
|
||||
!word OnLaunch
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2019 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
; sound effects
|
||||
;
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018 by 4am
|
||||
;(c) 2018-9 by 4am
|
||||
;
|
||||
|
||||
; This file is included from multiple assembly targets,
|
||||
|
Loading…
Reference in New Issue
Block a user