create LOAD_FILE_AT macro

This commit is contained in:
4am 2020-11-11 14:40:34 -05:00
parent 9e74cb1b6d
commit 4354aa3148
4 changed files with 24 additions and 26 deletions

View File

@ -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

View File

@ -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
}

View File

@ -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
ldy #>berzap_mb
jsr LoadFileDirect
pla
sta $D403
pla
sta $D401
+LOAD_FILE_AT berzap_mb, $200
jsr DisableAccelerator
jmp $200

View File

@ -9,19 +9,7 @@
+READ_RAM2_WRITE_RAM2
jsr EnableAccelerator
lda #3
sta $56 ; ldrhi
lda $D401
pha
lda $D403
pha
lda #<rraiders_mb
ldy #>rraiders_mb
jsr LoadFileDirect
pla
sta $D403
pla
sta $D401
+LOAD_FILE_AT rraiders_mb, $300
+READ_ROM_NO_WRITE
jmp $300