From 282fbd9806aec3d239741ec030d463e842c6a8ac Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 9 Sep 2019 22:58:16 -0400 Subject: [PATCH] pass in load address if we know it --- src/4cade.init.a | 13 ++++++------- src/ui.attract.dhgr.a | 6 +++--- src/ui.attract.hgr.a | 6 +++--- src/ui.attract.mode.a | 20 +++++++++----------- 4 files changed, 21 insertions(+), 24 deletions(-) diff --git a/src/4cade.init.a b/src/4cade.init.a index 3e9bc6598..dec54effc 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -192,25 +192,24 @@ OneTimeSetup +READ_RAM1_WRITE_RAM1 +STAY gRootDirectory - jsr LoadFile ; load preferences file into its default address ($8000) + jsr LoadFile ; load preferences file into $8000 !word kRootDirectory !word kGlobalPrefsFilename - !word 0 - +- !word $8000 jsr ParseKeyValueList ; parse contents into OKVS data structure into LC RAM bank !word gGlobalPrefsStore - !word ldrlo2 ; (ldrlo2) points to last load address, so $8000 + !word - !byte 16 +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 - jsr LoadFile ; load games list file into its default address ($8000) + jsr LoadFile ; load games list file into $8000 !word kRootDirectory !word @kGameListConfFile - !word 0 +- !word $8000 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 + !word - jsr okvs_len !word gGamesListStore diff --git a/src/ui.attract.dhgr.a b/src/ui.attract.dhgr.a index 688e53630..84c7d7cd7 100644 --- a/src/ui.attract.dhgr.a +++ b/src/ui.attract.dhgr.a @@ -59,13 +59,13 @@ DHGRSingle ; $6000..$BFFF/main contains transition effect code ;------------------------------------------------------------------------------ .LoadDHGRTransition - jsr LoadFile ; load DHGR transition effects list into its default address ($8000) + jsr LoadFile ; load DHGR transition effects list into $8000 !word kRootDirectory !word kDFXConfFile - !word 0 +- !word $8000 jsr ParseKeyValueList ; parse DHGR transition effects list into $6000 !word gDFXStore - !word ldrlo2 ; (ldrlo2) points to last load address + !word - !byte 0 jsr okvs_get ; get next DHGR transition effect from prefs diff --git a/src/ui.attract.hgr.a b/src/ui.attract.hgr.a index e3b7868d1..310b0d1b6 100644 --- a/src/ui.attract.hgr.a +++ b/src/ui.attract.hgr.a @@ -163,13 +163,13 @@ HGRSingle ; $6000..$BFFF contains transition effect code ;------------------------------------------------------------------------------ .LoadHGRTransition - jsr LoadFile ; load HGR transition effects list into its default address ($8000) + jsr LoadFile ; load HGR transition effects list into $8000 !word kRootDirectory !word kFXConfFile - !word 0 +- !word $8000 jsr ParseKeyValueList ; parse HGR transition effects list into $6000 !word gFXStore - !word ldrlo2 ; (ldrlo2) points to last load address + !word - !byte 0 jsr okvs_get ; get next HGR transition effect from prefs diff --git a/src/ui.attract.mode.a b/src/ui.attract.mode.a index dbac193d7..b757fb9db 100644 --- a/src/ui.attract.mode.a +++ b/src/ui.attract.mode.a @@ -111,17 +111,15 @@ MiniAttractMode lda #0 sta @MiniAttractIndex - @loop - ; load mini attract mode configuration file into its default address ($8000) - jsr LoadFile + jsr LoadFile ; load mini attract mode configuration file into $8000 !word kMiniAttractDirectory @fname !word $FDFD ; SMC - !word 0 +- !word $8000 jsr ParseKeyValueList ; parse configuration into OKVS data structure at $6000 !word gAttractModeStore - !word ldrlo2 ; (ldrlo2) points to last load address, so $8000 + !word - !byte 0 jsr okvs_len @@ -212,13 +210,13 @@ RunAttractModule ; it's a slideshow, so load and parse slideshow configuration file pha ; save module type - jsr LoadFile ; load slideshow configuration file into its default address ($4000) + jsr LoadFile ; load slideshow configuration file into $4000 !word kAttractModeSlideshowDirectory @key2 !word $FDFD ; SMC - !word 0 +- !word $4000 jsr ParseKeyValueList ; parse into an OKVS data structure at $0800 !word gSlideshowStore - !word ldrlo2 ; (ldrlo2) points to address of last loaded file, so $4000 + !word - !byte 0 pla ; restore module type @@ -252,13 +250,13 @@ RunAttractModule LoadAndParseAttractModeConf ; TODO refactor launch code then make this private - jsr LoadFile ; load attract-mode configuration file into its default address ($8000) + jsr LoadFile ; load attract-mode configuration file into $8000 !word kRootDirectory !word @AttractModeConfFile - !word 0 +- !word $8000 jsr ParseKeyValueList ; parse attract-mode configuration into OKVS data structure at $6000 !word gAttractModeStore - !word ldrlo2 ; (ldrlo2) points to last load address, so $8000 + !word - !byte 0 rts @AttractModeConfFile