mirror of
https://github.com/a2-4am/4cade.git
synced 2024-12-24 22:31:40 +00:00
refactor LoadFile and LoadDHRFile
This commit is contained in:
parent
1d7e3bd1b9
commit
b0cf49b86f
@ -192,10 +192,10 @@ OneTimeSetup
|
||||
sta promote + ProDOS_unit - $bf00
|
||||
; save unit while overriding !pseudopc
|
||||
|
||||
+LDADDR kGlobalPrefsFilename
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load preferences file into $8000
|
||||
|
||||
jsr LoadFile ; load preferences file into its default address ($8000)
|
||||
!word kRootDirectory
|
||||
!word kGlobalPrefsFilename
|
||||
!word 0
|
||||
jsr ParseKeyValueList ; parse contents into OKVS data structure into LC RAM bank
|
||||
!word gGlobalPrefsStore
|
||||
!word ldrlo2 ; (ldrlo2) points to last load address, so $8000
|
||||
@ -203,10 +203,10 @@ OneTimeSetup
|
||||
+LDAY SRC ; (SRC) points to free space after the OKVS data structure we just created
|
||||
+STAY gGamesListStore ; save pointer to free space for next store
|
||||
|
||||
+LDADDR @kGameListConfFile
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load games list file into $8000
|
||||
|
||||
jsr LoadFile ; load games list file into its default address ($8000)
|
||||
!word kRootDirectory
|
||||
!word @kGameListConfFile
|
||||
!word 0
|
||||
jsr ParseGamesList ; parse games list into OKVS data structure in LC RAM bank
|
||||
!word gGamesListStore
|
||||
!word ldrlo2 ; (ldrlo2) points to last load address, so $8000
|
||||
|
@ -157,14 +157,15 @@ gCurrentlyVisibleSlideshowIndex
|
||||
bcs --
|
||||
stx ProDOS_prefix
|
||||
|
||||
+LDADDR ProDOS_prefix
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load the game startup file
|
||||
!word kRootDirectory
|
||||
!word ProDOS_prefix
|
||||
!word 0 ; use file's default address
|
||||
|
||||
pla
|
||||
sta ProDOS_prefix ; set 'root' directory to the path part
|
||||
; of the game startup file we just loaded
|
||||
; so games can load other files without
|
||||
; so games can load other files without
|
||||
; knowing which directory they're in
|
||||
|
||||
; execution falls through here
|
||||
|
@ -5,7 +5,6 @@
|
||||
;
|
||||
; Public functions
|
||||
; - LoadFile
|
||||
; - LoadFileAt
|
||||
; - LoadDHRFile
|
||||
; - SaveSmallFile
|
||||
; - CloseHandles
|
||||
@ -13,7 +12,7 @@
|
||||
;
|
||||
; A general note about paths:
|
||||
;
|
||||
; LoadFile, LoadFileAt, LoadDHRFile, and SaveSmallFile support subdirectories.
|
||||
; LoadFile, LoadDHRFile, and SaveSmallFile support subdirectories.
|
||||
; Directories are delimited by '/' like ProDOS. At program startup, we get the
|
||||
; current directory and save it; that is the PROGRAM ROOT DIRECTORY. All
|
||||
; pathnames are relative to the PROGRAM ROOT DIRECTORY. There is no concept of
|
||||
@ -38,58 +37,25 @@ gRootDirectory
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LoadFile
|
||||
; Load a file into memory all at once, using ProRWTS2, at the load address
|
||||
; specified by the file's ProDOS metadata. Hey, do you have a text file that
|
||||
; doesn't have a load address? This routine will happily load it at $0000, and
|
||||
; your program will likely crash as a result. So give it a load address as if
|
||||
; it were a binary file.
|
||||
; Load a file into memory all at once, using ProRWTS2
|
||||
;
|
||||
; supports paths, see note
|
||||
;
|
||||
; in: gPathname contains filename
|
||||
; in: stack contains 6 bytes of parameters:
|
||||
; +1 [word] address of length-prefixed pathname
|
||||
; +3 [word] address of length-prefixed filename
|
||||
; +5 [word] address to load file, or 0 to use file's default address
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
; gPathname clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
LoadFile
|
||||
+LDADDR gPathname
|
||||
+STAY namlo ; set filename
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
jsr traverse ; go to subdirectory, set up filename for read
|
||||
lda #cmdread ; read (instead of write)
|
||||
sta reqcmd
|
||||
lda #0 ; 0 = read into main memory
|
||||
sta auxreq
|
||||
sta sizelo
|
||||
sta sizehi ; 0 = query load address
|
||||
jsr hddopendir ; call ProRWTS2
|
||||
lda ldrlo2
|
||||
sta ldrlo
|
||||
lda ldrhi2
|
||||
sta ldrhi
|
||||
dec sizehi ; read entire file (ProRWTS2 will figure out exact size)
|
||||
jsr hddopendir ; exit via ProRWTS2 (must re-open the file after query)
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; LoadFileAt
|
||||
; Load a file into memory all at once, using ProRWTS2, at the load address
|
||||
; specified by the passed parameter.
|
||||
;
|
||||
; supports paths, see note
|
||||
;
|
||||
; in: gPathname contains filename
|
||||
; stack contains 2 bytes of parameters:
|
||||
; +1 address to load file
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
; gPathname clobbered
|
||||
; stack set to next instruction after parameters
|
||||
;------------------------------------------------------------------------------
|
||||
LoadFileAt
|
||||
+PARAMS_ON_STACK 2
|
||||
+PARAMS_ON_STACK 6
|
||||
+LDPARAM 1
|
||||
jsr SetPath
|
||||
+LDPARAM 3
|
||||
jsr AddToPath
|
||||
+LDPARAM 5
|
||||
+STAY ldrlo ; set load address
|
||||
+LDADDR gPathname
|
||||
+STAY namlo ; set filename
|
||||
@ -99,7 +65,14 @@ LoadFileAt
|
||||
sta reqcmd
|
||||
lda #0 ; 0 = read into main memory
|
||||
sta auxreq
|
||||
lda #$FF ; read entire file (ProRWTS2 will figure out exact size)
|
||||
lda ldrlo+1
|
||||
bne + ; if caller provided a load address, use it
|
||||
sta sizelo ; otherwise query the load address from file metadata
|
||||
sta sizehi ; 0 = query load address
|
||||
jsr hddopendir ; call ProRWTS2
|
||||
+LDAY ldrlo2
|
||||
+STAY ldrlo
|
||||
+ lda #$FF ; read entire file (ProRWTS2 will figure out exact size)
|
||||
sta sizehi
|
||||
jsr hddopendir ; exit via ProRWTS2
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
@ -109,17 +82,24 @@ LoadFileAt
|
||||
; LoadDHRFile
|
||||
; load .A2FC file (uncompressed double hi-res graphics) into memory
|
||||
; all at once, using ProRWTS2
|
||||
; first $2000 bytes of file are loaded into auxiliary memory $2000..$3FFF
|
||||
; second $2000 bytes of file are loaded into main memory $2000..$3FFF
|
||||
; first $2000 bytes of file are loaded into auxiliary memory $4000..$5FFF
|
||||
; second $2000 bytes of file are loaded into main memory $4000..$4FFF
|
||||
;
|
||||
; supports paths, see note
|
||||
;
|
||||
; in: gPathname contains filename
|
||||
; in: stack contains 6 bytes of parameters:
|
||||
; +1 [word] address of length-prefixed pathname
|
||||
; +3 [word] address of length-prefixed filename
|
||||
; out: all flags clobbered
|
||||
; all registers clobbered
|
||||
; stack set to next instruction after parameters
|
||||
;------------------------------------------------------------------------------
|
||||
LoadDHRFile
|
||||
+PARAMS_ON_STACK 4
|
||||
+LDPARAM 1
|
||||
jsr SetPath
|
||||
+LDPARAM 3
|
||||
jsr AddToPath
|
||||
+LDADDR gPathname
|
||||
+STAY namlo ; set filename
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
@ -130,7 +110,7 @@ LoadDHRFile
|
||||
lda #$20
|
||||
sta sizehi
|
||||
asl
|
||||
sta ldrhi
|
||||
sta ldrhi ; into $4000
|
||||
lda #1 ; 1 = read into aux memory
|
||||
sta auxreq
|
||||
lda #cmdread ; read (instead of write)
|
||||
@ -139,7 +119,7 @@ LoadDHRFile
|
||||
lda #$20 ; read next $2000 bytes
|
||||
sta sizehi
|
||||
asl
|
||||
sta ldrhi
|
||||
sta ldrhi ; into $4000
|
||||
dec auxreq ; 0 = read into main memory
|
||||
clc ; not a subdirectory
|
||||
jsr hddrdwrpart ; call ProRWTS2
|
||||
|
19
src/macros.a
19
src/macros.a
@ -96,25 +96,6 @@
|
||||
bit $C082
|
||||
}
|
||||
|
||||
!macro LOAD_FILE .subdirectory, .filename {
|
||||
+LDADDR .subdirectory
|
||||
jsr SetPath
|
||||
+LDAY .filename
|
||||
jsr AddToPath
|
||||
jsr LoadFile
|
||||
}
|
||||
|
||||
!macro LOAD_PATH .subdirectory {
|
||||
+LDADDR .subdirectory
|
||||
jsr SetPath
|
||||
}
|
||||
|
||||
!macro LOAD_FILE_IMM .filename {
|
||||
+LDAY .filename
|
||||
jsr AddToPath
|
||||
jsr LoadFile
|
||||
}
|
||||
|
||||
!macro LOW_ASCII_TO_LOWER {
|
||||
cmp #$41
|
||||
bcc +
|
||||
|
@ -37,9 +37,12 @@ DHGRSingle
|
||||
bit MachineStatus ; only show DHGR screenshots if we have 128K
|
||||
bvs +
|
||||
rts
|
||||
+ jsr SetPath ; A/Y point to path
|
||||
+
|
||||
+STAY @fname
|
||||
jsr BlankDHGR ; switch to DHGR mode with initial blank screen
|
||||
jsr LoadDHRFile ; load DHGR file at $4000/main and $4000/aux
|
||||
!word kRootDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
+ jsr .LoadDHGRTransition ; load transition effect code at $6000
|
||||
+LDADDR $6000
|
||||
jsr ExecuteTransitionAndWait
|
||||
@ -56,9 +59,10 @@ DHGRSingle
|
||||
; $6000..$BFFF/main contains transition effect code
|
||||
;------------------------------------------------------------------------------
|
||||
.LoadDHGRTransition
|
||||
+LDADDR kDFXConfFile
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load DHGR transition effects list into $8000
|
||||
jsr LoadFile ; load DHGR transition effects list into its default address ($8000)
|
||||
!word kRootDirectory
|
||||
!word kDFXConfFile
|
||||
!word 0
|
||||
jsr ParseKeyValueList ; parse DHGR transition effects list into $6000
|
||||
!word gDFXStore
|
||||
!word ldrlo2 ; (ldrlo2) points to last load address
|
||||
@ -104,10 +108,11 @@ gDFXIndex
|
||||
|
||||
jsr SaveGlobalPreferences ; write prefs store to disk
|
||||
|
||||
; load transition effect code at $6000
|
||||
+LOAD_FILE kFXDirectory, @dfxkey
|
||||
jsr LoadFile ; load transition effect code into $6000
|
||||
!word kFXDirectory
|
||||
@dfxkey !word $FDFD ; SMC
|
||||
!word $6000
|
||||
rts
|
||||
@dfxkey !word $FDFD
|
||||
kDFXConfFile
|
||||
!byte @kDFXConfFile_e-*-1
|
||||
!text "DFX.CONF"
|
||||
@ -126,16 +131,14 @@ kDFXConfFile
|
||||
; $2000..$5FFF/aux clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
.DHGRTitleCallback
|
||||
+STAY SAVE
|
||||
|
||||
lda KBD
|
||||
bit KBD
|
||||
bpl +
|
||||
@exit rts
|
||||
+
|
||||
+STAY @tfname
|
||||
stx gCurrentlyVisibleSlideshowIndex
|
||||
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
+LDAY SAVE
|
||||
ldx #$60
|
||||
jsr GetGameDisplayName
|
||||
; if game is not found (C will be set here), it means it can't be played on
|
||||
@ -146,11 +149,10 @@ kDFXConfFile
|
||||
; reuse the function for convenience)
|
||||
|
||||
; load DHGR screenshot at $4000/main and $4000/aux
|
||||
+LDADDR kDHGRTitleDirectory
|
||||
jsr SetPath
|
||||
+LDAY SAVE
|
||||
jsr AddToPath
|
||||
jsr LoadDHRFile
|
||||
!word kDHGRTitleDirectory
|
||||
@tfname !word $FDFD
|
||||
|
||||
+LDADDR $6000
|
||||
jmp ExecuteTransitionAndWait
|
||||
|
||||
@ -167,18 +169,16 @@ kDFXConfFile
|
||||
; $2000..$5FFF/aux clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
.DHGRActionCallback
|
||||
+STAY SAVE
|
||||
|
||||
lda KBD
|
||||
bit KBD
|
||||
bpl +
|
||||
@actionExit
|
||||
rts
|
||||
+
|
||||
+STAY @afname
|
||||
stx gCurrentlyVisibleSlideshowIndex
|
||||
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
; or gSlideshowStore
|
||||
+LDAY SAVE
|
||||
ldx #$EA
|
||||
jsr GetGameDisplayName
|
||||
; if game is not found (C will be set here), it means it can't be played on
|
||||
@ -189,11 +189,10 @@ kDFXConfFile
|
||||
; just reuse the function for convenience)
|
||||
|
||||
; load DHGR screenshot at $4000/main and $4000/aux
|
||||
+LDADDR kDHGRActionDirectory
|
||||
jsr SetPath
|
||||
+LDAY SAVE
|
||||
jsr AddToPath
|
||||
jsr LoadDHRFile
|
||||
!word kDHGRActionDirectory
|
||||
@afname !word $FDFD
|
||||
|
||||
+LDADDR $6000
|
||||
jmp ExecuteTransitionAndWait
|
||||
|
||||
|
@ -19,9 +19,12 @@ GRActionSlideshow
|
||||
jmp BlankHGR ; switch back to HGR mode with initial blank screen on exit
|
||||
|
||||
GRSingle
|
||||
jsr SetPath
|
||||
+STAY @fname
|
||||
jsr BlankGR ; switch to GR mode with initial blank screen
|
||||
jsr LoadFile ; load GR screenshot at $6000
|
||||
jsr LoadFile ; load GR screenshot into $6000
|
||||
!word kRootDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
!word $6000
|
||||
jsr .LoadGRTransition ; load transition effect code at $6400
|
||||
+LDADDR $6400
|
||||
jsr ExecuteTransitionAndWait
|
||||
@ -58,15 +61,14 @@ BlankGR
|
||||
; of that, but no promises)
|
||||
;------------------------------------------------------------------------------
|
||||
.LoadGRTransition
|
||||
+LDADDR kGRFizzleFile
|
||||
+STAY @file
|
||||
+LOAD_FILE kFXDirectory, @file
|
||||
jsr LoadFile
|
||||
!word kFXDirectory
|
||||
!word kGRFizzleFile
|
||||
!word $6400
|
||||
rts
|
||||
@file !word $FDFD
|
||||
kGRFizzleFile
|
||||
!byte @kSFXFizzleFile_e-*-1
|
||||
!byte 9
|
||||
!text "GR.FIZZLE"
|
||||
@kSFXFizzleFile_e
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; .GRActionCallback [private]
|
||||
@ -81,29 +83,29 @@ kGRFizzleFile
|
||||
; $2000..$BFFF clobbered by graphics data and transition code
|
||||
;------------------------------------------------------------------------------
|
||||
.GRActionCallback
|
||||
+STAY SAVE
|
||||
|
||||
lda KBD
|
||||
bit KBD
|
||||
bpl +
|
||||
@actionExit
|
||||
rts
|
||||
+
|
||||
+STAY @fname
|
||||
stx gCurrentlyVisibleSlideshowIndex
|
||||
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
; or gSlideshowStore
|
||||
+LDAY SAVE
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
; or gSlideshowStore
|
||||
ldx #$EA
|
||||
jsr GetGameDisplayName
|
||||
; if game is not found (C will be set here), it means it can't be played on
|
||||
; this machine due to memory or joystick requirements, so we don't display
|
||||
; it in slideshows
|
||||
; if game is not found (C will be set here), it means it can't be played on
|
||||
; this machine due to memory or joystick requirements, so we don't display
|
||||
; it in slideshows
|
||||
bcs @actionExit
|
||||
; (we don't actually use the display name in the GR action slideshow, we
|
||||
; just reuse the function for convenience)
|
||||
; (we don't actually use the display name in the GR action slideshow, we
|
||||
; just reuse the function for convenience)
|
||||
|
||||
; load GR screenshot at $6000
|
||||
+LOAD_FILE kGRActionDirectory, SAVE
|
||||
jsr LoadFile ; load GR screenshot into $6000
|
||||
!word kGRActionDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
!word $6000
|
||||
|
||||
+LDADDR $6400
|
||||
jmp ExecuteTransitionAndWait
|
||||
|
@ -26,8 +26,11 @@ HGRActionSlideshow
|
||||
rts ; exit with last picture still visible
|
||||
|
||||
HGRSingle
|
||||
jsr SetPath
|
||||
+STAY @fname
|
||||
jsr LoadFile ; load HGR screenshot at $4000
|
||||
!word kRootDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
!word $4000
|
||||
jsr .LoadHGRTransition ; load transition effect code at $6000
|
||||
+LDADDR $6000
|
||||
jmp ExecuteTransitionAndWait
|
||||
@ -44,27 +47,27 @@ HGRSingle
|
||||
; $2000..$BFFF clobbered by graphics data and transition code
|
||||
;------------------------------------------------------------------------------
|
||||
.HGRTitleCallback
|
||||
+STAY SAVE
|
||||
|
||||
lda KBD
|
||||
bit KBD
|
||||
bpl +
|
||||
@exit rts
|
||||
+
|
||||
+STAY @tfname
|
||||
stx gCurrentlyVisibleSlideshowIndex
|
||||
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
+LDAY SAVE
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
ldx #$60
|
||||
jsr GetGameDisplayName
|
||||
; if game is not found (C will be set here), it means it can't be played on
|
||||
; this machine due to memory or joystick requirements, so we don't display
|
||||
; it in slideshows
|
||||
; if game is not found (C will be set here), it means it can't be played on
|
||||
; this machine due to memory or joystick requirements, so we don't display
|
||||
; it in slideshows
|
||||
bcs @exit
|
||||
; (we don't actually use the display name in the title slideshow, we just
|
||||
; reuse the function for convenience)
|
||||
; (we don't actually use the display name in the title slideshow, we just
|
||||
; reuse the function for convenience)
|
||||
|
||||
; load HGR screenshot at $4000
|
||||
+LOAD_FILE kHGRTitleDirectory, SAVE
|
||||
jsr LoadFile ; load HGR screenshot at $4000
|
||||
!word kHGRTitleDirectory
|
||||
@tfname !word $FDFD ; SMC
|
||||
!word $4000
|
||||
|
||||
+LDADDR $6000
|
||||
jmp ExecuteTransitionAndWait
|
||||
@ -82,30 +85,32 @@ HGRSingle
|
||||
; $2000..$BFFF clobbered by graphics data and transition code
|
||||
;------------------------------------------------------------------------------
|
||||
.HGRActionCallback
|
||||
+STAY SAVE
|
||||
|
||||
lda KBD
|
||||
bit KBD
|
||||
bpl +
|
||||
@actionExit
|
||||
rts
|
||||
+
|
||||
+STAY @afname
|
||||
stx gCurrentlyVisibleSlideshowIndex
|
||||
|
||||
; load HGR screenshot at $4000
|
||||
+LOAD_FILE kHGRActionDirectory, SAVE
|
||||
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
; or gSlideshowStore
|
||||
+LDAY SAVE
|
||||
; try to get the human-readable name of this game from gGamesListStore
|
||||
; or gSlideshowStore
|
||||
ldx #$EA
|
||||
jsr GetGameDisplayName
|
||||
; if game name is not found (C will be set here), it means the game
|
||||
; can't be played due to memory or joystick requirements, so we hide
|
||||
; it from slideshows
|
||||
; if game name is not found (C will be set here), it means the game
|
||||
; can't be played due to memory or joystick requirements, so we hide
|
||||
; it from slideshows
|
||||
bcs @actionExit
|
||||
|
||||
; found the game, display its name in the bottom-left corner
|
||||
; found the game
|
||||
+STAY SAVE
|
||||
|
||||
jsr LoadFile ; load HGR screenshot at $4000
|
||||
!word kHGRActionDirectory
|
||||
@afname !word $FDFD ; SMC
|
||||
!word $4000
|
||||
|
||||
; display game name in the bottom-left corner
|
||||
ldx #0
|
||||
stx HTAB
|
||||
ldx #22
|
||||
@ -158,9 +163,10 @@ HGRSingle
|
||||
; $6000..$BFFF contains transition effect code
|
||||
;------------------------------------------------------------------------------
|
||||
.LoadHGRTransition
|
||||
+LDADDR kFXConfFile
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load HGR transition effects list into $8000
|
||||
jsr LoadFile ; load HGR transition effects list into its default address ($8000)
|
||||
!word kRootDirectory
|
||||
!word kFXConfFile
|
||||
!word 0
|
||||
jsr ParseKeyValueList ; parse HGR transition effects list into $6000
|
||||
!word gFXStore
|
||||
!word ldrlo2 ; (ldrlo2) points to last load address
|
||||
@ -206,13 +212,12 @@ gFXIndex
|
||||
|
||||
jsr SaveGlobalPreferences ; write prefs store to disk
|
||||
|
||||
; load transition effect code at $6000
|
||||
+LOAD_FILE kFXDirectory, @fxkey
|
||||
jsr LoadFile ; load transition effect code into $6000
|
||||
!word kFXDirectory
|
||||
@fxkey !word $FDFD ; SMC
|
||||
!word $6000
|
||||
rts
|
||||
@fxkey !word $FDFD
|
||||
kFXConfFile
|
||||
!byte @kFXConfFile_e-*-1
|
||||
!byte 7
|
||||
!text "FX.CONF"
|
||||
@kFXConfFile_e
|
||||
|
||||
}
|
||||
|
@ -107,14 +107,17 @@ MiniAttractMode
|
||||
jsr okvs_nth
|
||||
!word gGamesListStore
|
||||
+ !byte $FD ; SMC
|
||||
+STAY @MiniAttractGame
|
||||
+STAY @fname
|
||||
|
||||
lda #0
|
||||
sta @MiniAttractIndex
|
||||
|
||||
@loop
|
||||
; load mini attract mode configuration file at $8000
|
||||
+LOAD_FILE kMiniAttractDirectory, @MiniAttractGame
|
||||
; load mini attract mode configuration file into its default address ($8000)
|
||||
jsr LoadFile
|
||||
!word kMiniAttractDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
!word 0
|
||||
|
||||
jsr ParseKeyValueList ; parse configuration into OKVS data structure at $6000
|
||||
!word gAttractModeStore
|
||||
@ -150,8 +153,6 @@ MiniAttractMode
|
||||
@exit rts
|
||||
@MiniAttractIndex
|
||||
!byte $FD
|
||||
@MiniAttractGame
|
||||
!word $FDFD
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; RunAttractModule
|
||||
@ -169,6 +170,7 @@ MiniAttractMode
|
||||
;------------------------------------------------------------------------------
|
||||
RunAttractModule
|
||||
+STAY @key
|
||||
+STAY @key2
|
||||
txa
|
||||
cmp #$30
|
||||
bne @NotDemo
|
||||
@ -186,15 +188,21 @@ RunAttractModule
|
||||
rts
|
||||
+
|
||||
jsr Home ; avoid seeing code load into the HGR page
|
||||
+LOAD_PATH kDemoDirectory
|
||||
ldy gPathname
|
||||
|
||||
ldy kDemoDirectory
|
||||
sty ProDOS_prefix ; temporarily set 'root' directory to
|
||||
- lda gPathname, y ; /demos/ directory so demos can can load
|
||||
- lda kDemoDirectory, y ; /demos/ directory so demos can can load
|
||||
sta ProDOS_prefix, y ; other resources in the same directory
|
||||
dey
|
||||
bne -
|
||||
+LOAD_FILE_IMM @key ; load self-running demo (address varies)
|
||||
|
||||
jsr LoadFile ; load self-running demo into its default address (varies)
|
||||
!word kDemoDirectory
|
||||
@key !word $FDFD
|
||||
!word 0
|
||||
|
||||
jsr SaveOrRestoreScreenHoles ; save screen hole contents
|
||||
|
||||
jmp Launch ; will return to caller via |Reenter|
|
||||
|
||||
; not a demo, so maybe a slideshow or single screenshot
|
||||
@ -204,7 +212,10 @@ RunAttractModule
|
||||
|
||||
; it's a slideshow, so load and parse slideshow configuration file
|
||||
pha ; save module type
|
||||
+LOAD_FILE kAttractModeSlideshowDirectory, @key ; load slideshow configuration file at $4000
|
||||
jsr LoadFile ; load slideshow configuration file into its default address ($4000)
|
||||
!word kAttractModeSlideshowDirectory
|
||||
@key2 !word $FDFD ; SMC
|
||||
!word 0
|
||||
jsr ParseKeyValueList ; parse into an OKVS data structure at $0800
|
||||
!word gSlideshowStore
|
||||
!word ldrlo2 ; (ldrlo2) points to address of last loaded file, so $4000
|
||||
@ -225,7 +236,7 @@ RunAttractModule
|
||||
clc
|
||||
adc #$06
|
||||
bne - ; always branches
|
||||
@key !word $FDFD ; SMC
|
||||
|
||||
@slideshows
|
||||
!word HGRTitleSlideshow
|
||||
!word HGRActionSlideshow
|
||||
@ -241,10 +252,10 @@ RunAttractModule
|
||||
|
||||
LoadAndParseAttractModeConf
|
||||
; TODO refactor launch code then make this private
|
||||
+LDADDR @AttractModeConfFile
|
||||
jsr SetPath
|
||||
jsr LoadFile ; load attract-mode configuration file at $8000
|
||||
|
||||
jsr LoadFile ; load attract-mode configuration file into its default address ($8000)
|
||||
!word kRootDirectory
|
||||
!word @AttractModeConfFile
|
||||
!word 0
|
||||
jsr ParseKeyValueList ; parse attract-mode configuration into OKVS data structure at $6000
|
||||
!word gAttractModeStore
|
||||
!word ldrlo2 ; (ldrlo2) points to last load address, so $8000
|
||||
|
@ -22,16 +22,16 @@ SHRSlideshow
|
||||
jmp BlankHGR
|
||||
|
||||
SHRSingle
|
||||
+STAY SAVE
|
||||
+STAY @fname
|
||||
lda MachineStatus ; only show SHR on IIgs or if we have a VidHD card
|
||||
and #SUPPORTS_SHR
|
||||
bne +
|
||||
rts
|
||||
+
|
||||
+LDAY SAVE
|
||||
jsr SetPath
|
||||
jsr .BlankSHR
|
||||
+ jsr .BlankSHR
|
||||
jsr LoadFile
|
||||
!word kRootDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
!word $2000
|
||||
jsr .LoadSHRTransition
|
||||
+LDADDR $A000
|
||||
jsr ExecuteTransitionAndWait
|
||||
@ -45,15 +45,14 @@ SHRSingle
|
||||
; $A000..$BFFF/main contains transition effect code
|
||||
;------------------------------------------------------------------------------
|
||||
.LoadSHRTransition
|
||||
+LDADDR kSFXFizzleFile
|
||||
+STAY @file
|
||||
+LOAD_FILE kFXDirectory, @file
|
||||
jsr LoadFile
|
||||
!word kFXDirectory
|
||||
!word kSFXFizzleFile
|
||||
!word $A000
|
||||
rts
|
||||
@file !word $FDFD
|
||||
kSFXFizzleFile
|
||||
!byte @kSFXFizzleFile_e-*-1
|
||||
!byte 10
|
||||
!text "SHR.FIZZLE"
|
||||
@kSFXFizzleFile_e
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; .SHRArtworkCallback [private]
|
||||
@ -68,22 +67,20 @@ kSFXFizzleFile
|
||||
; $2000..$5FFF/aux clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
.SHRArtworkCallback
|
||||
+STAY SAVE
|
||||
|
||||
lda KBD
|
||||
bit KBD
|
||||
bpl +
|
||||
rts
|
||||
+
|
||||
+STAY @sfname
|
||||
stx gCurrentlyVisibleSlideshowIndex
|
||||
|
||||
jsr .BlankSHR
|
||||
|
||||
; load SHR artwork at $2000/main (not aux)
|
||||
+LDADDR kSHRArtworkDirectory
|
||||
jsr SetPath
|
||||
+LDAY SAVE
|
||||
jsr AddToPath
|
||||
jsr LoadFile
|
||||
!word kSHRArtworkDirectory
|
||||
@sfname !word $FDFD
|
||||
!word $2000
|
||||
|
||||
+LDADDR $A000
|
||||
jmp ExecuteTransitionAndWait
|
||||
|
@ -97,19 +97,18 @@ BrowseMode
|
||||
!word gGamesListStore
|
||||
@index !byte $FD
|
||||
+STAY @key
|
||||
+STAY @key2
|
||||
jsr GetOffscreenAddress ; load new title screenshot offscreen
|
||||
sta + ; new title screenshot (offscreen)
|
||||
+LDADDR kHGRTitleDirectory
|
||||
jsr SetPath
|
||||
+LDAY @key
|
||||
jsr AddToPath
|
||||
jsr LoadFileAt
|
||||
jsr LoadFile
|
||||
!word kHGRTitleDirectory
|
||||
@key !word $FDFD ; SMC
|
||||
!byte $00
|
||||
+ !byte $FD ; SMC
|
||||
|
||||
jsr okvs_get
|
||||
!word gGamesListStore
|
||||
@key !word $FDFD
|
||||
@key2 !word $FDFD
|
||||
+STAY SRC ; A/Y points to game title (in OKVS)
|
||||
ldy #0 ; copy game title into search bar buffer
|
||||
lda (SRC),y
|
||||
|
@ -79,10 +79,12 @@ LoadCoverOffscreen
|
||||
; clobbers all
|
||||
+LDADDR .CoverFile
|
||||
+
|
||||
jsr SetPath
|
||||
+STAY @fname
|
||||
jsr GetOffscreenAddress
|
||||
sta +
|
||||
jsr LoadFileAt
|
||||
jsr LoadFile
|
||||
!word kRootDirectory
|
||||
@fname !word $FDFD ; SMC
|
||||
!byte $00
|
||||
+ !byte $FD ; SMC
|
||||
rts
|
||||
@ -102,12 +104,10 @@ CoverFade
|
||||
jsr LoadCoverOffscreen
|
||||
jsr ShowOtherPage
|
||||
+
|
||||
; load transition effect code at $6000
|
||||
+LDADDR kFXDirectory
|
||||
jsr SetPath
|
||||
+LDADDR @CoverFadeFile
|
||||
jsr AddToPath
|
||||
jsr LoadFile
|
||||
jsr LoadFile ; load transition effect code at $6000
|
||||
!word kFXDirectory
|
||||
!word @CoverFadeFile
|
||||
!word $6000
|
||||
jmp $6000 ; exit via loaded code
|
||||
@CoverFadeFile
|
||||
!byte 9
|
||||
|
@ -10,9 +10,10 @@
|
||||
|
||||
Credits
|
||||
; clobbers all
|
||||
+LDADDR .CreditsFile
|
||||
jsr SetPath
|
||||
jsr LoadFile ; loads at $8000
|
||||
jsr LoadFile ; load credits text into $8000
|
||||
!word kRootDirectory
|
||||
!word .CreditsFile
|
||||
!word $8000
|
||||
jsr ClearOffscreen
|
||||
lda OffscreenPage
|
||||
ror ; draw on offscreen page
|
||||
|
@ -157,6 +157,7 @@ SearchMode
|
||||
!word gGamesListStore
|
||||
@index !byte $FD
|
||||
+STAY @key
|
||||
+STAY @key2
|
||||
plp
|
||||
bne +
|
||||
jsr ToggleOffscreenPage ; Since we're not loading a new screenshot
|
||||
@ -166,18 +167,16 @@ SearchMode
|
||||
+
|
||||
jsr GetOffscreenAddress ; we have a new best match, so load the
|
||||
sta + ; new title screenshot (offscreen)
|
||||
+LDADDR kHGRTitleDirectory
|
||||
jsr SetPath
|
||||
+LDAY @key
|
||||
jsr AddToPath
|
||||
jsr LoadFileAt
|
||||
jsr LoadFile
|
||||
!word kHGRTitleDirectory
|
||||
@key !word $FDFD ; SMC
|
||||
!byte $00
|
||||
+ !byte $FD ; SMC
|
||||
|
||||
@skipload
|
||||
jsr okvs_get
|
||||
!word gGamesListStore
|
||||
@key !word $FDFD
|
||||
@key2 !word $FDFD
|
||||
+STAY SRC ; A/Y points to game title (in OKVS)
|
||||
ldy #0 ; copy game title into search bar buffer
|
||||
lda (SRC),y
|
||||
|
Loading…
Reference in New Issue
Block a user