Help wanted: saving files for Sedoric in asm

This is the best place to discuss about the various Oric operating systems like Sedoric, Randos, FT-Dos, and others, as well as serious software, utilities, word processors, disassemblers, etc... that runs on oric computers.
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Help wanted: saving files for Sedoric in asm

Post by iss »

Related to my post about BigMac for Oric, I have quieston:
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
.)
Used variables:
_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!
User avatar
Symoon
Archivist
Posts: 2301
Joined: Sat Jan 14, 2006 12:44 am
Location: Paris, France

Re: Help wanted: saving files for Sedoric in asm

Post by Symoon »

I'm not quite specialist in the commands, but your solution is probably in the STATUS command which allows the change of the memory loading address and execution (and auto mode or not).

STATUS file_name ,A load_address ,T execution address , AUTO

Parameters, if used, must be specified in this order.
According to Sedoric à Nu, the use of AUTO is a bit bugged and changes the execution address in different ways according to the file type. In short: avoid.

About the execution address parameter: it seems to be designed to start the execution of a loaded block at a specific address of this block, not to load the block somewhere else in memory.
For instance you have saved a block from $1000 to $1100, starting with variables, and the code is starting at $1020. Then the execution address should be $1020.
User avatar
iss
Wing Commander
Posts: 1637
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Help wanted: saving files for Sedoric in asm

Post by iss »

Yes! Thanks, Symoon!
This is exactly what I need.
I assembled the demo using ORG $3333, the generated binary didn't work,
but after the command: !STATUS"DEMO",A#3333,T#3333 - it WORKS! :D
Now I need to implement this in assembler ...

EDIT: I updated BigMac and now it's working fine.
I implemented the suggested "!STATUS" command to be executed from assembler invoking the command interpreter.
This solution is OK, but I think It will be better to use direct calls.
So, If any one can help with Sedoric calls to $Cxxx and parameters will be great.
Post Reply