diff --git a/src/constants.a b/src/constants.a index a94c26e41..9cdfd0887 100644 --- a/src/constants.a +++ b/src/constants.a @@ -142,11 +142,14 @@ HAS_VIDHD = %00010000 SUPPORTS_SHR = %00110000 CHEATS_ENABLED = %00001000 -; shared symbols +; shared symbols for prelaunch and effects to call ProRWTS2 functions +iCurBlockLo = $D401 +iCurBlockHi = $D403 iProDOS_enter = $D678 LoadFileDirect = $DB01 launchpatch = $D616 iAddToPath = $FEC3 itraverse = $D8E0 +ldrhi = $56 namlo = $57 namhi = $58 diff --git a/src/macros.a b/src/macros.a index f59f3bc17..9224b19b8 100755 --- a/src/macros.a +++ b/src/macros.a @@ -364,3 +364,21 @@ lsr sta $FFFC ; LC reset vector fix } + +; load an external file by pathname +; LC RAM 2 MUST BE BANKED IN +; LOW BYTE OF .addr MUST BE $00 +!macro LOAD_FILE_AT .filepath, .addr { + lda #>.addr + sta ldrhi + lda iCurBlockLo + pha + lda iCurBlockHi + pha + +LDADDR .filepath + jsr LoadFileDirect + pla + sta iCurBlockHi + pla + sta iCurBlockLo +} diff --git a/src/prelaunch/berzap.a b/src/prelaunch/berzap.a index e4bb436e4..f939570b9 100644 --- a/src/prelaunch/berzap.a +++ b/src/prelaunch/berzap.a @@ -27,20 +27,9 @@ callback2 lda #0 sta $b4d7 lda #2 - sta $56 ; ldrhi sta $b4d8 +READ_RAM2_WRITE_RAM2 - lda $D401 - pha - lda $D403 - pha - lda #berzap_mb - jsr LoadFileDirect - pla - sta $D403 - pla - sta $D401 + +LOAD_FILE_AT berzap_mb, $200 jsr DisableAccelerator jmp $200 diff --git a/src/prelaunch/rescue.raiders.a b/src/prelaunch/rescue.raiders.a index a0a898c33..6b6ff14ac 100755 --- a/src/prelaunch/rescue.raiders.a +++ b/src/prelaunch/rescue.raiders.a @@ -9,19 +9,7 @@ +READ_RAM2_WRITE_RAM2 jsr EnableAccelerator - lda #3 - sta $56 ; ldrhi - lda $D401 - pha - lda $D403 - pha - lda #rraiders_mb - jsr LoadFileDirect - pla - sta $D403 - pla - sta $D401 + +LOAD_FILE_AT rraiders_mb, $300 +READ_ROM_NO_WRITE jmp $300