move parse.games to init, update dates, other comments

This commit is contained in:
4am 2019-06-23 22:32:18 -04:00
parent 5bb7d559f9
commit 74f6cebac4
22 changed files with 104 additions and 90 deletions

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
!cpu 6502 !cpu 6502
!to "build/LAUNCHER.SYSTEM",plain !to "build/LAUNCHER.SYSTEM",plain
@ -9,7 +9,7 @@
RELBASE=$2000 RELBASE=$2000
} }
!source "src/constants.a" !source "src/constants.a" ; no code in these
!source "src/macros.a" !source "src/macros.a"
; first-run initialization, relocates code to language card and jumps ; 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. ; If there is no stack to restore, this exits via SearchMode.
; ;
; in: no parameters ; in: none
; out: see above ; out: see above
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
Reenter Reenter
@ -61,7 +61,7 @@ RestoreStackNextTime
bne - bne -
ldx $DF00 ; restore stack pointer ldx $DF00 ; restore stack pointer
txs txs
rts rts ; and return to caller
; these routines will only be called after relocating to language card ; these routines will only be called after relocating to language card
!source "src/ui.search.mode.a" !source "src/ui.search.mode.a"
@ -77,11 +77,12 @@ RestoreStackNextTime
!source "src/textrank.a" !source "src/textrank.a"
!source "src/parse.common.a" !source "src/parse.common.a"
!source "src/parse.prefs.a" !source "src/parse.prefs.a"
!source "src/parse.games.a"
!source "src/ui.sound.a" !source "src/ui.sound.a"
!source "src/ui.font.a" !source "src/ui.font.a"
gGlobalPrefsStore gGlobalPrefsStore
!word $D000 ; address of first okvs store !word $D000 ; address of first okvs store
gGamesListStore
!word $FDFD ; SMC
!word Reenter ; NMI vector ($FFFA-B) !word Reenter ; NMI vector ($FFFA-B)
!word Reenter ; reset vector ($FFFC-D) !word Reenter ; reset vector ($FFFC-D)
!word Reenter ; IRQ vector ($FFFE-F) !word Reenter ; IRQ vector ($FFFE-F)

View File

@ -1,8 +1,11 @@
;license:MIT ;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 $C00E ; 40-column
sta $C00C sta $C00C
@ -73,6 +76,10 @@ ProRWTSBuffer
*=ProRWTSBuffer+512 ; ProRWTS needs a 512-byte buffer for its init function *=ProRWTSBuffer+512 ; ProRWTS needs a 512-byte buffer for its init function
; so we reuse as much of the 1-time code as possible ; so we reuse as much of the 1-time code as possible
; and fill the rest with zeros ; 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 OneTimeSetup
lda MachineStatus lda MachineStatus
sta oldstatus sta oldstatus
@ -136,20 +143,22 @@ OneTimeSetup
cpy #$03 cpy #$03
bcc @outer bcc @outer
bit $C010 ; clear keyboard strobe so we don't mistakenly think we just tried to run something
ldx #5 ldx #5
- lda Prelaunch,x ; copy reentry wrapper to bottom of stack - lda Prelaunch,x ; copy reentry wrapper to bottom of stack
sta $100,x ; (many self-running demos use this) sta $100,x ; (used as reset vector because ][+ always
dex dex ; switches to ROM on Ctrl-Reset)
bpl - bpl -
inx inx
stx $3F2 ; page 3 reset vector to ($100) stx $3F2 ; page 3 reset vector to ($100)
inx inx
stx $3F3 stx $3F3
ldx #$A4 ldx #$A4
stx $3F4 stx $3F4
jmp $100 ; continue execution from LC RAM bank
bit $C010
jmp ($FFFC) ; continue from |Reentry| in LC RAM bank
kGameListConfFile kGameListConfFile
!byte 10 !byte 10

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; Functions to launch games and self-running demos ; Functions to launch games and self-running demos
; ;

View File

@ -1,3 +1,9 @@
;license:MIT
;(c) 2018-9 by 4am
;
; IIgs support functions
;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; IsGS ; IsGS
; detect IIgs by running CPU-specific magic ; detect IIgs by running CPU-specific magic

View File

@ -1,3 +1,9 @@
;license:MIT
;(c) 2018-9 by 4am
;
; VidHD support functions
;
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; HasVidHDCard ; HasVidHDCard
; detect VidHD card by searching for magic bytes across all slots ; detect VidHD card by searching for magic bytes across all slots

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; common assembler macros (6502 compatible) ; common assembler macros (6502 compatible)
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; Ordered key/value store (6502 compatible) ; Ordered key/value store (6502 compatible)
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; generic key/value text parser ; generic key/value text parser
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; GAMES.CONF parser ; GAMES.CONF parser
; ;
@ -7,9 +7,6 @@
; - ParseGamesList ; - ParseGamesList
; ;
gGamesListStore
!word $FDFD ; SMC
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; ParseGamesList ; ParseGamesList
; parse buffer with AB,KEY=VALUE lines of text into an okvs ; parse buffer with AB,KEY=VALUE lines of text into an okvs

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; Parser for global preferences file ; Parser for global preferences file
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; ProDOS - functions for constructing and passing around ProDOS pathnames ; ProDOS - functions for constructing and passing around ProDOS pathnames
; ;

View File

@ -1,6 +1,6 @@
;license:BSD-3-Clause ;license:BSD-3-Clause
;extended open/read/write binary file in ProDOS filesystem, with random access ;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 ver_02 = 1

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am & qkumba
; ;
; text rank - an implementation of the Quicksilver search rank algorithm ; text rank - an implementation of the Quicksilver search rank algorithm
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; Double hi-res slideshows ; Double hi-res slideshows
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; HGR title and action slideshows ; HGR title and action slideshows
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; Mega Attract Mode - cycle through slideshows and self-running demos ; Mega Attract Mode - cycle through slideshows and self-running demos
; ;
@ -19,14 +19,13 @@
; self-terminating game demos ; self-terminating game demos
; ;
; in: gGlobalPrefsStore must be initialized ; in: gGlobalPrefsStore must be initialized
; out: exits to caller (note that some attract mode modules never return but ; out: never returns to caller (may JMP to other major modes)
; 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)
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
MegaAttractMode MegaAttractMode
jsr BlankHGR ldx #$FF
txs
jsr BlankHGR ; switch to HGR page 1 (once cleared)
+LDADDR kAttractModeConfFile +LDADDR kAttractModeConfFile
jsr SetPath jsr SetPath
@ -92,7 +91,6 @@ gAttractIndex
cmp #$8D cmp #$8D
bne @jmpsearch bne @jmpsearch
jsr PlayGameFromAttract jsr PlayGameFromAttract
; execution falls through here
@jmpattract @jmpattract
jmp MegaAttractMode jmp MegaAttractMode
@jmpsearch @jmpsearch

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; Super hi-res slideshows ; Super hi-res slideshows
; ;

View File

@ -1,24 +1,14 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; hi-res font drawing routines ; hi-res font drawing routines
; ;
; Public functions ; Public functions
; - DrawPage
; - Draw40Chars ; - Draw40Chars
; - DrawString ; - DrawString
; - DrawBuffer ; - 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 Draw40Chars
; A/Y contains address of character buffer ; A/Y contains address of character buffer
; carry bit clear -> draw on page 1 ; carry bit clear -> draw on page 1

View File

@ -1,3 +1,9 @@
;license:MIT
;(c) 2018-9 by 4am
;
; 'Circuitous' hi-res font data
;
!pseudopc $D600 { !pseudopc $D600 {
FontDataRow0 FontDataRow0
!byte $80 !byte $80

View File

@ -1,36 +1,31 @@
;license:MIT ;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 ; Public functions
; - SearchMode ; - SearchMode
; ;
; indices into InputDispatchTable ;------------------------------------------------------------------------------
kInputSearch = 0 ; SearchMode
kInputClear = 1 ; main entry point for Search Mode, which allows the user to search the game
kInputBack = 2 ; catalog and launch games
kInputLaunch = 3 ;
; in: none
InputDispatchTable ; out: never returns to caller (may JMP to other major modes)
!word OnSearch ;------------------------------------------------------------------------------
!word OnClear
!word OnBack
!word OnLaunch
SearchMode SearchMode
ldx #0 ldx #$FF
stx OffscreenPage
dex
stx SelectedIndex ; no game selected
txs txs
stx SelectedIndex ; no game selected
inx
stx OffscreenPage
jsr Home ; clear screen jsr Home ; clear screen
lda #$FF jsr OnInputChanged ; draw UI on HGR page 1
jsr OnInputChanged ; draw UI on HGR page 1, set $C054
bit $C052 bit $C052
bit $C057 bit $C057
bit $C050 bit $C050 ; show HGR page 1
bit $C010 bit $C010
jsr _ResetInputTimeout jsr _ResetInputTimeout
@ -39,8 +34,8 @@ _SearchModeInputLoop
bmi @gotKey bmi @gotKey
inc $4F ; these are only ever incremented, never inc $4F ; these are only ever incremented, never
bne + ; reset (used as a pseudorandom seed) bne + ; reset (may be used as a pseudorandom
inc $4E inc $4E ; seed)
+ +
dec Timeout ; these are a 3-byte timeout counter dec Timeout ; these are a 3-byte timeout counter
bne _SearchModeInputLoop ; that counts down from a number set bne _SearchModeInputLoop ; that counts down from a number set
@ -48,8 +43,8 @@ _SearchModeInputLoop
bne _SearchModeInputLoop ; on every keypress (whether or not bne _SearchModeInputLoop ; on every keypress (whether or not
dec Timeout+2 ; the key leads to an action) dec Timeout+2 ; the key leads to an action)
bne _SearchModeInputLoop bne _SearchModeInputLoop
jsr _CoverFade ; no input for ~30 seconds, so switch jsr _CoverFade ; no input for ~30 seconds, switch to
jmp MegaAttractMode ; to mega-attract mode jmp MegaAttractMode ; mega-attract mode
@gotKey @gotKey
bit $C010 bit $C010
@ -65,16 +60,15 @@ _SearchModeInputLoop
ldx #kInputLaunch ldx #kInputLaunch
bne InputDispatch ; always branches bne InputDispatch ; always branches
+ +
and #$7F cmp #$FF ; delete key
cmp #$7F ; delete key
bne + bne +
- ldx #kInputBack - ldx #kInputBack
bne InputDispatch ; always branches bne InputDispatch ; always branches
+ cmp #$08 ; left arrow = delete + cmp #$88 ; left arrow = delete
beq - beq -
and #$7F ; strip high bit for search characters
cmp #$30 ; control keys and punctuation ignored cmp #$30 ; control keys and punctuation ignored
bcc @badkey bcc @badkey
cmp #$3A ; numbers are good input cmp #$3A ; numbers are good input
@ -90,7 +84,6 @@ _SearchModeInputLoop
bcc @badkey bcc @badkey
cmp #$7B ; lowercase letters are good input cmp #$7B ; lowercase letters are good input
bcc @goodkey bcc @goodkey
; execution falls through here
@badkey @badkey
jsr SoftBell ; beep on invalid input jsr SoftBell ; beep on invalid input
jmp _SearchModeInputLoop ; and start over jmp _SearchModeInputLoop ; and start over
@ -109,9 +102,8 @@ InputDispatch
sta @j+2 sta @j+2
pla ; restore key pressed pla ; restore key pressed
@j jsr $FDFD ; SMC @j jsr $FDFD ; SMC
bcc + bcc _SearchModeInputLoop
jmp SearchMode jmp SearchMode ; if carry is set, force full redraw
+ jmp _SearchModeInputLoop
OnClear OnClear
ldx InputLength ldx InputLength
@ -149,7 +141,6 @@ OnSearch
+ sta InputBuffer,x + sta InputBuffer,x
inc InputLength inc InputLength
; execution falls through here ; execution falls through here
OnInputChanged OnInputChanged
lda InputLength lda InputLength
bne @findMatchingTitle bne @findMatchingTitle
@ -168,13 +159,11 @@ OnInputChanged
bne - bne -
lda #$7F lda #$7F
sta UILine2+1 sta UILine2+1
jsr _LoadCoverOffscreen jsr _LoadCoverOffscreen
jsr _DrawSearchBarOffscreen jsr _DrawSearchBarOffscreen
jsr _ShowOtherPage jsr _ShowOtherPage
clc clc
rts rts
@findMatchingTitle @findMatchingTitle
jsr ResetTextRank jsr ResetTextRank
@ -191,22 +180,19 @@ OnInputChanged
lda BestMatchIndex ; check if the new best match is the same lda BestMatchIndex ; check if the new best match is the same
cmp SelectedIndex ; as the current best match cmp SelectedIndex ; as the current best match
php ; (we'll use this later to skip reloading) php ; (we'll use this later to skip reloading)
sta SelectedIndex sta SelectedIndex
sta @index sta @index
jsr okvs_nth jsr okvs_nth
!word gGamesListStore !word gGamesListStore
@index !byte $FD @index !byte $FD
+STAY @key +STAY @key
plp plp
bne + bne +
lda OffscreenPage lda OffscreenPage
eor #$01 eor #$01
sta OffscreenPage sta OffscreenPage
jmp @skipload 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) beq + ; new title screenshot (offscreen)
lda #$40 lda #$40
+HIDE_NEXT_2_BYTES +HIDE_NEXT_2_BYTES
@ -243,7 +229,6 @@ OnInputChanged
sta UILine2,y sta UILine2,y
cpy #MaxInputLength+1 cpy #MaxInputLength+1
bcc - bcc -
ldx #40 ldx #40
lda #0 lda #0
- sta UILine1-1,x ; reset search bar - sta UILine1-1,x ; reset search bar
@ -270,6 +255,7 @@ OnInputChanged
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
_LoadCoverOffscreen _LoadCoverOffscreen
; clobbers all
lda OffscreenPage lda OffscreenPage
beq + beq +
lda #$40 lda #$40
@ -284,6 +270,7 @@ _LoadCoverOffscreen
rts rts
_DrawSearchBarOffscreen _DrawSearchBarOffscreen
; clobbers all
lda #22 ; draw visible search bar lda #22 ; draw visible search bar
sta VTAB sta VTAB
lda OffscreenPage lda OffscreenPage
@ -296,6 +283,7 @@ _DrawSearchBarOffscreen
jmp Draw40Chars jmp Draw40Chars
_ShowOtherPage _ShowOtherPage
; clobbers A, preserves X/Y
lda OffscreenPage lda OffscreenPage
eor #$01 eor #$01
sta OffscreenPage sta OffscreenPage
@ -314,6 +302,7 @@ _ResetInputTimeout
rts rts
_CoverFade _CoverFade
; clobbers all
jsr _LoadCoverOffscreen jsr _LoadCoverOffscreen
jsr _ShowOtherPage jsr _ShowOtherPage
lda OffscreenPage lda OffscreenPage
@ -356,3 +345,15 @@ OffscreenPage
; (so offscreen is page 1 @ $2000) ; (so offscreen is page 1 @ $2000)
; 1 = currently showing HGR page 1 ; 1 = currently showing HGR page 1
; (so offscreen is page 2 @ $4000) ; (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

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2019 by 4am ;(c) 2018-9 by 4am
; ;
; sound effects ; sound effects
; ;

View File

@ -1,5 +1,5 @@
;license:MIT ;license:MIT
;(c) 2018 by 4am ;(c) 2018-9 by 4am
; ;
; This file is included from multiple assembly targets, ; This file is included from multiple assembly targets,