How to save file to Sedoric dsk from assembler, but to change the default load address?
I tried to use the 'Execution address' as additional parameter - it works as expected, but this is not my case .
To be more specific here is the problem:
I want to save memory area $9C00-$9CFF as binary executable file 'TEST', but when executed it need to be loaded at address $1000.
I.e. typing: !TEST - need to load the file at $1000 and jump to $1000.
Here is the code I use:
Code: Select all
_sed_savefile_exe
.(
; -- sei ; disable interrupts
lda _sed_fname
sta $e9 ; Filename lo
lda _sed_fname+1
sta $ea ; Filename hi
jsr _dosrom ; enable OverlayRAM
lda #$00
jsr $d454 ; verify filename and copy it to BUFNOM
;Setup Areas
lda _sed_exe_begin
sta $c052 ; Start Address Lo
lda _sed_exe_begin+1
sta $c053 ; Start Address Hi
lda _sed_exe_end
sta $c054 ; End Address Lo
lda _sed_exe_end+1
sta $c055 ; End Address Hi
lda _sed_exe
sta $c056 ; Execution Address Lo
lda _sed_exe+1
sta $c057 ; Execution Address Hi
lda #$00 ; #$00 - SAVEO, #$C0 - SAVEU
sta $c04d
lda #$00 ; 0 here means no params
sta $c04e
lda #$41 ; file type - program and auto
sta $c051
jsr $de0b ; set LGSAL0 and call XSAVEB
jsr _dosrom ; disable Overlay RAM
; -- cli ; re-enable interrupts
ldx _doserr ; Get result (low byte)
lda #0 ; Get result (high byte)
rts
.)
_sed_exe_begin, _sed_exe_end - memory area to be saved
_sed_exe - address to be jumped to when loaded
This routine works, but it loads the file at $9C00, and jumps to $1000 - which obviously lead to crash...
I looked in 'Sedoric 3.0 a Nu' - but my French is to far from usable.
Any ideas and help are highly appreciated!