diff --git a/Makefile b/Makefile index 2d44e5df1..15aa99925 100644 --- a/Makefile +++ b/Makefile @@ -137,10 +137,10 @@ index: md asmfx asmprelaunch # create gSearchStore indexes # [ -f build/DISPLAY.CONF ] || (bin/builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF) - [ -f build/SEARCH00.IDX ] || (grep "^00" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH00.IDX) - [ -f build/SEARCH01.IDX ] || (grep "^0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH01.IDX) - [ -f build/SEARCH10.IDX ] || (grep "^.0" < build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH10.IDX) - [ -f build/SEARCH11.IDX ] || (cat build/DISPLAY.CONF | cut -d"," -f2 | bin/buildokvs.sh > build/SEARCH11.IDX) + [ -f build/SEARCH00.IDX ] || (grep "^00" < build/DISPLAY.CONF | bin/buildsearch.sh > build/SEARCH00.IDX) + [ -f build/SEARCH01.IDX ] || (grep "^0" < build/DISPLAY.CONF | bin/buildsearch.sh > build/SEARCH01.IDX) + [ -f build/SEARCH10.IDX ] || (grep "^.0" < build/DISPLAY.CONF | bin/buildsearch.sh > build/SEARCH10.IDX) + [ -f build/SEARCH11.IDX ] || (bin/buildsearch.sh < build/DISPLAY.CONF > build/SEARCH11.IDX) # # create a sorted list of game filenames, without metadata or display names # diff --git a/bin/buildgamesstore.sh b/bin/buildsearch.sh similarity index 87% rename from bin/buildgamesstore.sh rename to bin/buildsearch.sh index dfdbb1dc3..75daec3b2 100755 --- a/bin/buildgamesstore.sh +++ b/bin/buildsearch.sh @@ -12,11 +12,12 @@ source=$(mktemp) dhgr=$(echo "$key" | cut -c3) # 'has DHGR title screen' flag (0 or 1) cheat=$(echo "$key" | cut -c4) # 'cheat category' (0..5) key=$(echo "$key" | cut -d"," -f2) - echo "!byte ${#key}+${#value}+4" # OKVS record length + echo "!byte ${#key}+${#value}+5" # OKVS record length echo "!byte ${#key}" # OKVS key length echo "!text \"$key\"" # OKVS key - echo "!byte ${#value}+1" # OKVS value length + echo "!byte ${#value}" # OKVS value length echo "!text \"$value\"" # OKVS value + echo "!byte 1" echo "!byte $((dhgr*128))+$cheat" done < "$records") > "$source" diff --git a/src/4cade.init.a b/src/4cade.init.a index d45c9e11a..42494335a 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -386,11 +386,12 @@ CopyDevs jsr stepptr +LD16 PTR ; (PTR) points to free space after the OKVS data structure we just created +ST16 gGamesListStore ; save pointer to free space for next store - jsr LoadFile ; load games list file into $8200 !word kRootDirectory !word @kGameListConfFile - !word $8200 + lda #$EA + sta AddValueDuringAppend jsr ParseGamesList ; parse games list into OKVS data structure in LC RAM bank !word gGamesListStore !word - diff --git a/src/constants.a b/src/constants.a index 3bbcbedf3..45625195f 100644 --- a/src/constants.a +++ b/src/constants.a @@ -6,9 +6,9 @@ ; YE OLDE GRAND UNIFIED MEMORY MAP ; ; LC RAM BANK 1 -; D000..E2F8 - persistent data structures (gGlobalPrefsStore, gGamesListStore) +; D000..DFDE - persistent data structures (gGlobalPrefsStore, gGamesListStore) ; ...unused... -; EA2A..FFEE - main program code +; EA23..FFEE - main program code ; FFEF..FFF9 - API functions and global constants available for main program ; code, prelaunchers, transition effects, &c. ; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) diff --git a/src/parse.common.a b/src/parse.common.a index 6ec7d5e99..15c222836 100644 --- a/src/parse.common.a +++ b/src/parse.common.a @@ -210,6 +210,7 @@ okvs_append tay lda (SRC),y ; no max, use actual length instead tax +AddValueDuringAppend + inx tay - lda (SRC),y diff --git a/src/parse.games.a b/src/parse.games.a index 970565bff..1508e0a6e 100644 --- a/src/parse.games.a +++ b/src/parse.games.a @@ -61,12 +61,8 @@ ParseGamesList bvc @skipLine ; game requires 128K but we only have 64K, so ignore entire line @parseDHGRTitle jsr IncAndGetChar ; get third character ('1' if game has DHGR title) - and #$01 - pha @parseCheatsAvailable jsr IncAndGetChar ; get fourth character (cheat category, int) - and #CHEAT_CATEGORY - pha @swallowComma jsr IncAndGetChar @gatherKey @@ -86,19 +82,7 @@ ParseGamesList jsr IncAndGetChar cmp #$0A ; CR ends the value bne @gatherValue -; beq @endValue -; sta gVal,x -; inx -; bpl @gatherValue @endValue - pla ; pop cheat category - sta gVal,x ; store after game display name - pla ; pop has-DHGR-title flag - lsr - ror - ora gVal,x - sta gVal,x ; store in bit 7 of same byte as cheat category - inx stx gValLen tya pha ; okvs functions clobber everything but we need Y diff --git a/src/ui.credits.a b/src/ui.credits.a index 233a006bc..7f5f0ecc7 100644 --- a/src/ui.credits.a +++ b/src/ui.credits.a @@ -32,17 +32,17 @@ Help jsr LoadIndexedFile !word kGameHelpFile - !word $8000 + !word $800 @indexRecordPtr !word $FDFD ; SMC clc bcc .clearAndDisplayHelp ; always branches -@global jsr LoadFile ; load help text into $8000 +@global jsr LoadFile ; load help text into $800 !word kRootDirectory !word kHelpTextFile - !word $8000 + !word $800 jsr LoadHelpOffscreen ; load fancy backdrop ldx #7 @@ -57,10 +57,10 @@ Help ; all other flags and registers clobbered ;------------------------------------------------------------------------------ Credits - jsr LoadFile ; load credits text into $8000 + jsr LoadFile ; load credits text into $800 !word kRootDirectory !word kCreditsFile - !word $8000 + !word $800 .clearAndDisplayHelp jsr ForceHGRMode jsr ClearOffscreen @@ -68,7 +68,7 @@ Credits .displayHelp lda OffscreenPage ror ; draw on offscreen page - +LDADDR $8000 + +LDADDR $800 +ST16 PTR ;DrawPageInternal inlined here ; diff --git a/src/ui.offscreen.a b/src/ui.offscreen.a index b1172607d..893d7c104 100644 --- a/src/ui.offscreen.a +++ b/src/ui.offscreen.a @@ -83,18 +83,20 @@ LoadOffscreenFromAY rts LoadGameTitleOffscreen -; in: gGameToLaunch = index into gGamesListStore (word) - jsr GetGameToLaunch +; in: gGameToLaunch = index into gSearchStore (word) + +LD16 gGameToLaunch + +ST16 WINDEX + +LDADDR gSearchStore + jsr okvs_nth ; A/Y -> key (game filename) in gSearchStore +ST16 @fname bit MachineStatus ; if < 128K, don't bother checking for DHGR title bvc @hgr jsr okvs_get_current - ; (PTR) -> game display name + bitfield of game info + jsr okvs_get_current_PTR_is_already_set + ; (PTR) -> length-prefixed game info bitfield ; Y = 0 - lda (PTR),y ; A = game display name length + 1 - sta SAVE - tay - lda (PTR),y ; A = game info bitfield + iny ; Y = 1 + lda (PTR), y ; A = game info bitfield ;;and #HAS_DHGR_TITLE bmi @dhgr @hgr diff --git a/src/ui.overlay.a b/src/ui.overlay.a index 536bd9d33..5bb9dfbf4 100644 --- a/src/ui.overlay.a +++ b/src/ui.overlay.a @@ -122,21 +122,22 @@ DrawUI sta gPathname ; hack, used by first RedrawForDHGR which follows ; Draw40Chars which doesn't set gPathname - jsr GetGameToLaunch ; get current game, if any + jsr AnyGameSelected ; get index number of current game, if any bcs @doneWithLine2 ; if no game, nothing more to do on UI line 2 - +ST16 @fname - jsr okvs_get_current - iny ; Y = 1 + +ST16 WINDEX + +LDADDR gSearchStore + jsr okvs_nth ; A/Y -> key of current game (in gSearchStore) + jsr okvs_get_current ; (PTR) -> display name of current game + ; Y = 0 + lda (PTR), y + tay + iny + sty SAVE + iny lda (PTR), y ; A = game info bitfield sta gGameToLaunchInfo - jsr okvs_get - !word gSearchStore -@fname !word $FDFD ; SMC - +ST16 PTR ldy #0 - lda (PTR), y - sta SAVE - inc SAVE + - iny @printCursor lda #$FD ; SMC @@ -197,7 +198,7 @@ DrawUI ldy #0 @dotloop iny - lda (PTR),y ; (PTR) still points to game display name + game info bitfield + lda (PTR),y ; (PTR) still points to game display name ora #$20 ; force lower-case always cmp InputBuffer,x bne +