remove GAMES.CONF

This commit is contained in:
4am 2021-11-02 21:49:41 -04:00
parent bb135caca8
commit 07e82a5aad
20 changed files with 120 additions and 232 deletions

View File

@ -50,7 +50,6 @@ dsk: asm index
res/TITLE \ res/TITLE \
res/COVER \ res/COVER \
res/HELP \ res/HELP \
build/GAMES.CONF \
build/PREFS.CONF \ build/PREFS.CONF \
build/CREDITS \ build/CREDITS \
build/HELPTEXT \ build/HELPTEXT \
@ -127,13 +126,6 @@ index: md asmfx asmprelaunch
# #
[ -f build/GAMES.CONF ] || (awk '!/^$$|^#/' < res/GAMES.CONF > build/GAMES.CONF) [ -f build/GAMES.CONF ] || (awk '!/^$$|^#/' < res/GAMES.CONF > build/GAMES.CONF)
# #
# create gGamesListStore indexes
#
# grep "^00" < build/GAMES.CONF | bin/buildgamesstore.sh > build/GAMES00.IDX
# grep "^0" < build/GAMES.CONF | bin/buildgamesstore.sh > build/GAMES01.IDX
# grep "^.0" < build/GAMES.CONF | bin/buildgamesstore.sh > build/GAMES10.IDX
# cat build/GAMES.CONF | bin/buildgamesstore.sh > build/GAMES11.IDX
#
# create gSearchStore indexes # create gSearchStore indexes
# #
[ -f build/DISPLAY.CONF ] || (bin/builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF) [ -f build/DISPLAY.CONF ] || (bin/builddisplaynames.py < build/GAMES.CONF > build/DISPLAY.CONF)
@ -161,7 +153,7 @@ index: md asmfx asmprelaunch
[ -f build/SLIDESHOW.IDX ] || ((for f in res/SS/*; do \ [ -f build/SLIDESHOW.IDX ] || ((for f in res/SS/*; do \
[ $$(echo "$$(basename $$f)" | cut -c-3) = "ACT" ] && \ [ $$(echo "$$(basename $$f)" | cut -c-3) = "ACT" ] && \
bin/buildaction.sh build/DISPLAY.CONF < "$$f" > "build/SS/$$(basename $$f)" || \ bin/buildaction.sh build/DISPLAY.CONF < "$$f" > "build/SS/$$(basename $$f)" || \
bin/buildokvs.sh < "$$f" > "build/SS/$$(basename $$f)"; \ bin/buildtitle.sh build/DISPLAY.CONF < "$$f" > "build/SS/$$(basename $$f)"; \
echo "$$(basename $$f)"; \ echo "$$(basename $$f)"; \
done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX) done) | bin/buildindexedfile.sh -p -a build/TOTAL.DATA build/SS > build/SLIDESHOW.IDX)
[ -f build/MINIATTRACT.IDX ] || ((for f in res/ATTRACT/*; do \ [ -f build/MINIATTRACT.IDX ] || ((for f in res/ATTRACT/*; do \

View File

@ -1,5 +1,7 @@
#!/bin/bash #!/bin/bash
games=$(cat "$1")
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker) # make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
records=$(mktemp) records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records" awk '!/^$|^#|^\[/' > "$records"
@ -10,14 +12,18 @@ source=$(mktemp)
echo "!le16 $(wc -l <"$records"), 0" # OKVS header echo "!le16 $(wc -l <"$records"), 0" # OKVS header
while IFS="=" read -r key value; do while IFS="=" read -r key value; do
[ -n "$value" ] && filename="$value" || filename="$key" [ -n "$value" ] && filename="$value" || filename="$key"
displayname=$(awk -F= '/,'"$filename"'=/ { print $2 }' "$1") line=$(echo "$games" | awk '/,'"$filename"'=/')
echo "!byte ${#key}+${#value}+${#displayname}+4" # OKVS record length needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' flag (0 or 1)
needs128k=$(echo "$line" | cut -c2) # 'requires 128K' flag (0 or 1)
displayname=$(echo "$line" | awk -F= '{ print $2 }')
echo "!byte ${#key}+${#value}+${#displayname}+5" # OKVS record length
echo "!byte ${#key}" # OKVS key length echo "!byte ${#key}" # OKVS key length
echo "!text \"$key\"" # OKVS key echo "!text \"$key\"" # OKVS key
echo "!byte ${#value}" # OKVS value length echo "!byte ${#value}" # OKVS value length
echo "!text \"$value\"" # OKVS value echo "!text \"$value\"" # OKVS value
echo "!byte ${#displayname}" echo "!byte ${#displayname}"
echo "!text \"$displayname\"" echo "!text \"$displayname\""
echo "!byte $((needsjoystick*128))+$((needs128k*64))"
done < "$records") > "$source" done < "$records") > "$source"
# assemble temp source file into binary OKVS data structure, then output that # assemble temp source file into binary OKVS data structure, then output that

33
bin/buildtitle.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
games=$(cat "$1")
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)
(echo "*=0" # dummy program counter for assembler
echo "!le16 $(wc -l <"$records"), 0" # OKVS header
while read -r filename; do
line=$(echo "$games" | awk '/,'"$filename"'=/')
needsjoystick=$(echo "$line" | cut -c1) # 'requires joystick' flag (0 or 1)
needs128k=$(echo "$line" | cut -c2) # 'requires 128K' flag (0 or 1)
echo "!byte ${#filename}+3" # OKVS record length
echo "!byte ${#filename}" # OKVS key length
echo "!text \"$filename\"" # OKVS key
[ -z "$line" ] && \
echo "!byte 0" || \
echo "!byte $((needsjoystick*128))+$((needs128k*64))"
done < "$records") > "$source"
# assemble temp source file into binary OKVS data structure, then output that
out=$(mktemp)
acme -o "$out" "$source"
cat "$out"
# clean up
rm "$out"
rm "$source"
rm "$records"

View File

@ -380,7 +380,7 @@ ACTDHGR16.CONF=4
ACTIONS6.CONF=2 ACTIONS6.CONF=2
MNO4.CONF=1 MNO4.CONF=1
N.O.R.A.D=0 N.O.R.A.D=0
ACTIONCD6.CONF=2 #ACTIONCD6.CONF=2
T4.CONF=1 T4.CONF=1
SHR20.CONF=5 SHR20.CONF=5

View File

@ -3,6 +3,7 @@
# #
DROL DROL
COMMANDO
CS CS
CROSSFIRE CROSSFIRE
DONKEY.KONG2=DONKEY.KONG DONKEY.KONG2=DONKEY.KONG
@ -10,7 +11,6 @@ DUNG.BEETLES2=DUNG.BEETLES
DJ3=DJ DJ3=DJ
CHIVALRY CHIVALRY
DIAMOND.MINE DIAMOND.MINE
COMMANDO
DIVE.BOMBER2=DIVE.BOMBER DIVE.BOMBER2=DIVE.BOMBER
[eof] [eof]

View File

@ -3,6 +3,7 @@
# #
DM DM
CHOPLIFTER
CONGO CONGO
CQ2=CQ CQ2=CQ
DJ DJ
@ -10,7 +11,6 @@ CR2=CR
DEEP.SPACE2=DEEP.SPACE DEEP.SPACE2=DEEP.SPACE
DRELBS DRELBS
COUNTY.FAIR COUNTY.FAIR
CHOPLIFTER
CHIVALRY6=CHIVALRY CHIVALRY6=CHIVALRY
COSMIC.COMBAT2=COSMIC.COMBAT COSMIC.COMBAT2=COSMIC.COMBAT
DOGFIGHT.II DOGFIGHT.II

View File

@ -10,7 +10,7 @@ NT2=NT
MICROWAVE2=MICROWAVE MICROWAVE2=MICROWAVE
MINER.2049ER2=MINER.2049ER MINER.2049ER2=MINER.2049ER
MAXWELL.MANOR2=MAXWELL.MANOR MAXWELL.MANOR2=MAXWELL.MANOR
MATING.ZONE #MATING.ZONE
MAD.BOMBER MAD.BOMBER
NEON NEON

View File

@ -11,7 +11,7 @@ STAR.BLAZER
SPACE.RAIDERS SPACE.RAIDERS
SPACE.KADET SPACE.KADET
SPIDER.RAID SPIDER.RAID
SABOTAGE #SABOTAGE
SEA.DRAGON2=SEA.DRAGON SEA.DRAGON2=SEA.DRAGON
[eof] [eof]

View File

@ -131,8 +131,6 @@ gGlobalPrefsStore
; flips out if it has certain values (it will ; flips out if it has certain values (it will
; be set to $55 as part of the 64K memory test, ; be set to $55 as part of the 64K memory test,
; which is apparently one of the acceptable values) ; which is apparently one of the acceptable values)
gGamesListStore
!word $FDFD ; SMC
SwitchToBank2 SwitchToBank2
+READ_RAM2_WRITE_RAM2 +READ_RAM2_WRITE_RAM2
rts rts

View File

@ -342,7 +342,6 @@ PrintAsDecimal
!source "src/hw.accel.a" !source "src/hw.accel.a"
!source "src/hw.vbl.init.a" !source "src/hw.vbl.init.a"
!source "src/parse.common.a" !source "src/parse.common.a"
!source "src/parse.games.a"
OneTimeSetup OneTimeSetup
lda zpMachineStatus lda zpMachineStatus
@ -381,20 +380,6 @@ CopyDevs
!word gGlobalPrefsStore !word gGlobalPrefsStore
!word - !word -
!byte 16 !byte 16
+LD16 SAVE
+ST16 PTR
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 -
!ifndef RELEASE { !ifndef RELEASE {
+LD16 SAVE +LD16 SAVE
@ -427,7 +412,8 @@ CopyDevs
inx inx
+ stx gSearchHas128K + stx gSearchHas128K
+LDADDR gGamesListStore jsr ReloadSearchIndex
+LDADDR gSearchStore
jsr okvs_len jsr okvs_len
+LD16 WCOUNT +LD16 WCOUNT
+ST16 GameCount +ST16 GameCount
@ -478,10 +464,6 @@ CopyDevs
bit CLEARKBD bit CLEARKBD
jmp Reenter jmp Reenter
@kGameListConfFile
!byte 10
!text "GAMES.CONF"
@kPowersOfTen @kPowersOfTen
!byte 100 !byte 100
!byte 10 !byte 10

View File

@ -6,11 +6,11 @@
; YE OLDE GRAND UNIFIED MEMORY MAP ; YE OLDE GRAND UNIFIED MEMORY MAP
; ;
; LC RAM BANK 1 ; LC RAM BANK 1
; D000..DFE7 - persistent data structures (gGlobalPrefsStore, gGamesListStore) ; D001..D06E - persistent data structures (gGlobalPrefsStore)
; ...unused... ; ...unused...
; E000..E3FF - HGR font data ; E000..E3FF - HGR font data
; ...unused... ; ...unused...
; E966..FFEE - main program code ; E994..FFEE - main program code
; FFEF..FFF9 - API functions and global constants available for main program ; FFEF..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c. ; code, prelaunchers, transition effects, &c.
; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) ; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)

View File

@ -12,11 +12,13 @@
; - Launch ; - Launch
; ;
; Public variables: ; Public variables:
; - gGameToLaunch - 0-based index into gGamesListStore (word) ; - gGameToLaunch - 0-based index into gSearchStore (word)
; ;
gGameToLaunch gGameToLaunch
!word $FFFF !word $FFFF
gLastMegaAttractGame
!word $FFFF
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; AnyGameSelected ; AnyGameSelected
@ -54,73 +56,56 @@ ForceGoodResult
_gameToLaunchExit _gameToLaunchExit
rts rts
;------------------------------------------------------------------------------
; FindGame
; check if an arbitrary game exists, for some definition of 'exists'
;
; in: A/Y points to game filename
; out: C clear if game exists in gGamesListStore, and
; $WINDEX = game index, or #$FFFF if the game doesn't really
; exist but we want to return a successful result anyway
; C set if game does not exist (this can happen because slideshows
; list games that require a joystick, but the games list parser
; filters them out if the machine doesn't have a joystick)
; all registers clobbered
;------------------------------------------------------------------------------
FindGame
+ST16 @key
jsr okvs_find
!word gGamesListStore
@key !word $FDFD ; SMC
bcc GlueLaunchRTS
; Hack to allow self-running demos that don't correspond to a game
; filename. If the name ends in a '.', accept it unconditionally.
ldx #$FF
stx WINDEX
stx WINDEX+1
+LD16 @key
+ST16 PARAM
ldy #0
lda (PARAM),y
tay
lda (PARAM),y
cmp #"."
beq ForceGoodResult
sec
GlueLaunchRTS
rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
; FindGameInActionSlideshow ; FindGameInActionSlideshow
; check if an arbitrary game exists, for some definition of 'exists', while ; check if an arbitrary game exists, for some definition of 'exists', while
; in the middle of a slideshow ; in the middle of a slideshow
; ;
; in: A/Y points to a key in gSlideshowStore ; in: A/Y points to a key in gSlideshowStore
; out: C clear if game exists, and ; out: C clear if game exists and is playable on current machine, and
; $WINDEX = game index, and ; (SAVE) -> game display name, and
; A/Y points to game display name ; (gLastMegaAttractGame) -> game filename
; C set if game can't be found by any means ; C set otherwise
; clobbers $FF, PTR
; all registers clobbered
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
FindGameInActionSlideshow FindGameInActionSlideshow
+ST16 @slideshowKey +ST16 gLastMegaAttractGame
jsr FindGame jsr okvs_get_current ; (PTR) -> OKVS value (filename or empty string)
bcc @GetGameDisplayName ; Y=0
; if the game was not found, try getting the value of the current record from lda (PTR), y
; gSlideshowStore (some games have multiple action screenshots, in which case beq +
; the key is only the screenshot filename, and the value is the actual game
; filename)
jsr okvs_get
!word gSlideshowStore
@slideshowKey
!word $FDFD ; SMC
jsr FindGame
bcs GlueLaunchRTS
@GetGameDisplayName
+LD16 @slideshowKey
jsr okvs_get_current
jsr okvs_get_current_PTR_is_already_set
+LD16 PTR +LD16 PTR
+ST16 gLastMegaAttractGame
+ jsr okvs_get_current_PTR_is_already_set ; (PTR) -> game display name
+LD16 PTR ; A/Y -> game display name
+ST16 SAVE ; (SAVE) -> game display name
FindGame
jsr okvs_get_current ; (PTR) -> game requirements bitfield
; Y=0
; check if game requires joystick
lda (PTR), y
sta $FF
bpl @check128K
lda MachineStatus
and #HAS_JOYSTICK
beq @failedCheck ; machine doesn't have joystick but game requires it
@check128K
; check if game requires 128K
bit $FF
bvc @passedAllChecks
lda MachineStatus
and #HAS_128K
beq @failedCheck ; machine doesn't have 128K but game requires it
@passedAllChecks
clc
rts
@failedCheck
sec
rts rts
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -135,6 +120,7 @@ FindGameInActionSlideshow
PlayGame PlayGame
jsr GetGameToLaunch jsr GetGameToLaunch
; A/Y = address of game filename ; A/Y = address of game filename
PlayGameInAY
+ST16 SAVE +ST16 SAVE
+ST16 @pfile +ST16 @pfile

View File

@ -441,7 +441,7 @@
} }
; Macros for demo launchers that need to check whether they should run ; Macros for demo launchers that need to check whether they should run
; on the current machine. These will RTS if the requirements are not met. ; on the current machine. Exit demo if the requirements are not met.
!macro GAME_REQUIRES_JOYSTICK { !macro GAME_REQUIRES_JOYSTICK {
+GET_MACHINE_STATUS +GET_MACHINE_STATUS
and #HAS_JOYSTICK and #HAS_JOYSTICK

View File

@ -210,7 +210,6 @@ okvs_append
tay tay
lda (SRC),y ; no max, use actual length instead lda (SRC),y ; no max, use actual length instead
tax tax
AddValueDuringAppend
+ inx + inx
tay tay
- lda (SRC),y - lda (SRC),y

View File

@ -1,98 +0,0 @@
;license:MIT
;(c) 2018-2020 by 4am
;
; GAMES.CONF parser
;
; Public functions:
; - ParseGamesList
;
;------------------------------------------------------------------------------
; ParseGamesList
; parse buffer with ABC,KEY=VALUE lines of text into an okvs
; keys and values limited to 127 characters, which should be enough for anyone
; '[' character at beginning of line ends the parsing
; (see games.conf file for more format information)
;
; in: stack contains 4 bytes of parameters:
; +1 [word] handle to storage space for okvs
; +3 [word] handle to buffer containing contents of GAMES.CONF
; out: all registers and flags clobbered
; $1F00..$1FFF clobbered
; $00/$01 clobbered
; $02/$03 clobbered
; $04/$05 has the address of the next available byte after the okvs
; $FE/$FF clobbered
;------------------------------------------------------------------------------
ParseGamesList
+PARAMS_ON_STACK 4
+LDPARAM 1
+ST16 @store2
jsr SetKeyPtr
ldy #$00 ; index into ($FE) pointing to current character
beq @newkey ; always branches
@skipLine ; skip to CR
jsr IncAndGetChar
cmp #$0A ; CR
bne @skipLine
@newkey ldx #$00 ; X = index into current key
stx gValLen ; initialize value length (in case this line has no value)
@emptyline
jsr IncAndGetChar ; get first filter character ('1' if game requires joystick)
cmp #$0A ; ignore blank line
beq @emptyline
cmp #$5B ; '[' ends the parsing
beq @exit
cmp #$30 ; '0' -> no filtering on joystick
beq @filterOnMemory
cmp #$31 ; not '0' or '1' or '[' or CR -> ignore entire line (e.g. comment)
bne @skipLine
bit zpMachineStatus
bpl @skipLine ; game requires joystick but we don't have one, so ignore entire line
@filterOnMemory
jsr IncAndGetChar ; get second filter character ('1' if game requires 128K)
cmp #$30 ; '0' -> no filtering on memory
beq @parseDHGRTitle
cmp #$31 ; not '0' or '1' -> ignore entire line
bne @skipLine
bit zpMachineStatus
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)
@parseCheatsAvailable
jsr IncAndGetChar ; get fourth character (cheat category, int)
@swallowComma
jsr IncAndGetChar
@gatherKey
jsr IncAndGetChar
cmp #$0A ; CR -> finalize key, no value
beq @endKey
cmp #$3D ; '=' ends the key
beq @endKey
sta gKey,x
inx
bpl @gatherKey
@endKey stx gKeyLen
ldx #$00 ; now X = index into the current value
cmp #$0A
beq @endValue
@gatherValue
jsr IncAndGetChar
cmp #$0A ; CR ends the value
bne @gatherValue
@endValue
stx gValLen
tya
pha ; okvs functions clobber everything but we need Y
jsr okvs_append
@store2 !word $FDFD ; SMC
!word gKeyLen
!word gValLen
!byte 0
pla ; pop saved Y
tay
jmp @newkey
@exit rts

View File

@ -175,6 +175,7 @@ DHGRTitleCallback
bmi DHGRRTS bmi DHGRRTS
+ST16 + +ST16 +
+ST16 gLastMegaAttractGame
jsr FindGame jsr FindGame
; if game is not found (C will be set here), it means it can't be played on ; if game is not found (C will be set here), it means it can't be played on
@ -215,10 +216,6 @@ DHGRActionCallback
; can't be played due to memory or joystick requirements, so we hide ; can't be played due to memory or joystick requirements, so we hide
; it from slideshows ; it from slideshows
bcs DHGRRTS bcs DHGRRTS
+ST16 SAVE ; (SAVE) -> game display name
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
jsr LoadIndexedDHGRFile jsr LoadIndexedDHGRFile
jsr DecompressDHGR jsr DecompressDHGR

View File

@ -84,7 +84,6 @@ GRRTS rts
; in: A/Y contains address of filename (name only, path is always /ACTION.GR/) ; in: A/Y contains address of filename (name only, path is always /ACTION.GR/)
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word) ; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
; gGamesListStore must be initialized
; out: all registers and flags clobbered ; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data) ; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code ; $2000..$BFFF clobbered by graphics data and transition code
@ -101,9 +100,6 @@ GRActionCallback
; it from slideshows ; it from slideshows
bcs GRRTS bcs GRRTS
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
jsr LoadFile ; load GR screenshot into $6000 jsr LoadFile ; load GR screenshot into $6000
!word kGRActionDirectory !word kGRActionDirectory
+ !word $FDFD ; SMC + !word $FDFD ; SMC

View File

@ -105,6 +105,7 @@ HGRTitleCallback
bmi HGRRTS bmi HGRRTS
+ST16 + +ST16 +
+ST16 gLastMegaAttractGame
jsr FindGame jsr FindGame
; if game is not found (C will be set here), it means it can't be played on ; if game is not found (C will be set here), it means it can't be played on
@ -129,7 +130,6 @@ HGRTitleCallback
; in: A/Y contains address of filename (name only, path is always /ACTION.HGR/) ; in: A/Y contains address of filename (name only, path is always /ACTION.HGR/)
; $WINDEX contains 0-based index of the current record in gSlideshowStore (word) ; $WINDEX contains 0-based index of the current record in gSlideshowStore (word)
; gGamesListStore must be initialized
; out: all registers and flags clobbered ; out: all registers and flags clobbered
; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data) ; $0800..$1EFF preserved (this contains the gSlideshowStore OKVS data)
; $2000..$BFFF clobbered by graphics data and transition code ; $2000..$BFFF clobbered by graphics data and transition code
@ -146,12 +146,6 @@ HGRActionCallback
; it from slideshows ; it from slideshows
bcs HGRRTS bcs HGRRTS
; found the game
+ST16 SAVE ; (SAVE) -> game display name
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
jsr LoadIndexedHGRFile jsr LoadIndexedHGRFile
jsr DecompressHGR jsr DecompressHGR
jmp DrawGameTitleInActionSlideshow jmp DrawGameTitleInActionSlideshow

View File

@ -54,8 +54,8 @@ MegaAttractMode
bpl MegaAttractMode bpl MegaAttractMode
cmp #$8D ; Enter plays the game shown on screen. cmp #$8D ; Enter plays the game shown on screen.
bne + ; Any other key switches to Search Mode. bne + ; Any other key switches to Search Mode.
jsr ReloadSearchIndex +LD16 gLastMegaAttractGame
jsr PlayGame ; (might return if user hits Ctrl-Reset) jsr PlayGameInAY ; (might return if user hits Ctrl-Reset)
+ jmp SearchMode + jmp SearchMode
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
@ -150,29 +150,31 @@ RunAttractModule
bne @NotDemo bne @NotDemo
; Self-running demos are loaded into main memory and executed. ; Self-running demos are loaded into main memory and executed.
; Each binary has been patched to quit on any key and jump back ; Each demo has been patched to check joystick and memory requirements,
; to the |Reenter| entry point. ; so a demo won't run if the actual game wouldn't be playable.
; Demos are also patched to jump back to the |Reenter| entry point
; on any key, or at the natural end of the demo cycle.
; All demos are strictly 48K / main memory. No demo uses the ; All demos are strictly 48K / main memory. No demo uses the
; language card or auxiliary memory. ; language card or auxiliary memory.
+LD16 @key +ST16 PTR
jsr FindGame ldy #0
bcs ATTRTS ; if game doesn't exist, skip the demo lda (PTR), y
+LD16 WINDEX tay
+CMP16_E $FFFF, @nogame - lda (PTR), y
+ST16 gGameToLaunch ; if this demo corresponds to a game, save its index sta DemoFilename, y
; in case user presses RETURN during the demo (we will launch the game) dey
@nogame bpl -
+LDADDR DemoFilename
+ST16 gLastMegaAttractGame ; save game filename in LC in case user hits Return to launch
jsr ClearScreens ; avoid seeing code load into the HGR page jsr ClearScreens ; avoid seeing code load into the HGR page
; (clobbers $106, must do now before loading prelaunch code) ; (clobbers $106, must do now before loading prelaunch code)
jsr LoadStandardPrelaunch ; load standard prelaunch code (|Launch| will call it) jsr LoadStandardPrelaunch ; load standard prelaunch code (|Launch| will call it)
jsr LoadFile ; load self-running demo into its default address (varies) jsr LoadFile ; load self-running demo into its default address (varies)
!word kDemoDirectory !word kDemoDirectory
@key !word $FDFD @key !word $FDFD
!word 0 !word 0
jmp Launch ; will return to caller via |Reenter| jmp Launch ; will return to caller via |Reenter|
; not a demo, so maybe a slideshow or single screenshot ; not a demo, so maybe a slideshow or single screenshot
@ -233,3 +235,6 @@ RunAttractModule
!byte >DHGRSingle !byte >DHGRSingle
!byte >SHRSingle !byte >SHRSingle
!byte >GRSingle !byte >GRSingle
DemoFilename
!byte 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15

View File

@ -85,6 +85,7 @@ SHRArtworkCallback
bmi SHRRTS bmi SHRRTS
+ST16 IndexedSHRFilename +ST16 IndexedSHRFilename
+ST16 gLastMegaAttractGame
jsr FindGame jsr FindGame
; if game is not found (C will be set here), it means it can't be played on ; if game is not found (C will be set here), it means it can't be played on
@ -92,9 +93,6 @@ SHRArtworkCallback
; it in slideshows ; it in slideshows
bcs SHRRTS bcs SHRRTS
+LD16 WINDEX ; save game index in case user hits RETURN
+ST16 gGameToLaunch ; while it's visible (we'll launch it)
jsr BlankSHR jsr BlankSHR
jsr LoadIndexedSHRFile jsr LoadIndexedSHRFile
jsr DecompressSHR jsr DecompressSHR