diff --git a/src/4cade.a b/src/4cade.a index 69ff1f9cf..581b056a1 100644 --- a/src/4cade.a +++ b/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) diff --git a/src/4cade.init.a b/src/4cade.init.a index 18d965254..846cf7bad 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -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 diff --git a/src/glue.launch.a b/src/glue.launch.a index 8247f1d0f..7ac00ff1f 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; Functions to launch games and self-running demos ; diff --git a/src/hw.iigs.a b/src/hw.iigs.a index 4d3b0fcd2..6a45a6f22 100644 --- a/src/hw.iigs.a +++ b/src/hw.iigs.a @@ -1,3 +1,9 @@ +;license:MIT +;(c) 2018-9 by 4am +; +; IIgs support functions +; + ;------------------------------------------------------------------------------ ; IsGS ; detect IIgs by running CPU-specific magic diff --git a/src/hw.vidhd.a b/src/hw.vidhd.a index 3b6f67ea7..72412dce6 100644 --- a/src/hw.vidhd.a +++ b/src/hw.vidhd.a @@ -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 diff --git a/src/macros.a b/src/macros.a index 840b1cd8f..3d3b2b120 100644 --- a/src/macros.a +++ b/src/macros.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; common assembler macros (6502 compatible) ; diff --git a/src/okvs.a b/src/okvs.a index ca02c17c0..06fa1119e 100644 --- a/src/okvs.a +++ b/src/okvs.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; Ordered key/value store (6502 compatible) ; diff --git a/src/parse.common.a b/src/parse.common.a index 2f1447ebc..6f8c11e74 100644 --- a/src/parse.common.a +++ b/src/parse.common.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; generic key/value text parser ; diff --git a/src/parse.games.a b/src/parse.games.a index 06d79b14b..8f5d637e4 100644 --- a/src/parse.games.a +++ b/src/parse.games.a @@ -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 diff --git a/src/parse.prefs.a b/src/parse.prefs.a index 5d8232c00..c19c2a323 100644 --- a/src/parse.prefs.a +++ b/src/parse.prefs.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; Parser for global preferences file ; diff --git a/src/prodos.path.a b/src/prodos.path.a index eda4ed34d..703894c07 100644 --- a/src/prodos.path.a +++ b/src/prodos.path.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; ProDOS - functions for constructing and passing around ProDOS pathnames ; diff --git a/src/prorwts2.a b/src/prorwts2.a index 6221ed068..fa1e1048d 100644 --- a/src/prorwts2.a +++ b/src/prorwts2.a @@ -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 diff --git a/src/textrank.a b/src/textrank.a index f98e6fd9a..b88b8450c 100644 --- a/src/textrank.a +++ b/src/textrank.a @@ -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 ; diff --git a/src/ui.attract.dhgr.a b/src/ui.attract.dhgr.a index 4515c6274..98a2e1a83 100644 --- a/src/ui.attract.dhgr.a +++ b/src/ui.attract.dhgr.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; Double hi-res slideshows ; diff --git a/src/ui.attract.hgr.a b/src/ui.attract.hgr.a index 1a579f5a5..bfbc6eaa2 100644 --- a/src/ui.attract.hgr.a +++ b/src/ui.attract.hgr.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; HGR title and action slideshows ; diff --git a/src/ui.attract.mode.a b/src/ui.attract.mode.a index 9c15bb995..25a38b790 100644 --- a/src/ui.attract.mode.a +++ b/src/ui.attract.mode.a @@ -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 diff --git a/src/ui.attract.shr.a b/src/ui.attract.shr.a index a7ff4d748..1cf0b86d1 100644 --- a/src/ui.attract.shr.a +++ b/src/ui.attract.shr.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; Super hi-res slideshows ; diff --git a/src/ui.font.a b/src/ui.font.a index 63290c777..b9d038115 100644 --- a/src/ui.font.a +++ b/src/ui.font.a @@ -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 diff --git a/src/ui.font.data.a b/src/ui.font.data.a index 94c4598a0..a19cf287e 100644 --- a/src/ui.font.data.a +++ b/src/ui.font.data.a @@ -1,3 +1,9 @@ +;license:MIT +;(c) 2018-9 by 4am +; +; 'Circuitous' hi-res font data +; + !pseudopc $D600 { FontDataRow0 !byte $80 diff --git a/src/ui.search.mode.a b/src/ui.search.mode.a index 73e2ff9f7..7b7af96d8 100644 --- a/src/ui.search.mode.a +++ b/src/ui.search.mode.a @@ -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 diff --git a/src/ui.sound.a b/src/ui.sound.a index d368ca9e3..6f792f104 100644 --- a/src/ui.sound.a +++ b/src/ui.sound.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2019 by 4am +;(c) 2018-9 by 4am ; ; sound effects ; diff --git a/src/wait.a b/src/wait.a index acda0a775..594834e63 100644 --- a/src/wait.a +++ b/src/wait.a @@ -1,5 +1,5 @@ ;license:MIT -;(c) 2018 by 4am +;(c) 2018-9 by 4am ; ; This file is included from multiple assembly targets,