returning to PAR menu

vbt

Staff member
Another question :S is there a way to return to the PAR menu or at least make a real reset of the saturn ?

SYS_Exit only returns to the bios.
 
I don't remember if the PAR execute command does a JMP or JSR. If the latter, you may be able to return to it, provided the stack and code are intact. IIRC the PAR menu code executes from the start of workram-L, but I have no idea how much RAM it uses. (Since workram-H will be overwritten by the IP and first read file when booting a CD it can't execute from there.)
 
According to Bart Trzynadlowski's crt0.s, you need to perform a jmp to address 0x02000100:

Code:
    !

    ! Jump to _main()

    !

    mov.l   main_ptr,r0

    jsr @r0

    nop

    !

    ! When _main() terminates, jump back to the ARP entry point

    !

    mov.l   arp_ptr,r0

    jmp @r0

    nop

    nop

arp_ptr:    .long 0x02000100
 
I'd have to look at it again, but I'm not sure that's strictly right; IIRC, the code there normally runs from RAM, and is just position-independent by happenstance.

edit: plus, ideally you'd want to check for an executable cart first (e.g. by checking for the "SEGA SEGASATURN" string at 0x02000000) and do something else if there's no cart. I'm guessing it would eventually fall over and reset or dump you back to the CD player screen if there were no cart, but it would probably be better to actually control that.
 
ExCyber said:
I'd have to look at it again, but I'm not sure that's strictly right; IIRC, the code there normally runs from RAM, and is just position-independent by happenstance.

It definitely executes from workram-L. Jumping to 0x02000100 would start executing the security code (sys_sec.o) from the cartridge IP in place. It is not position-independent, and I guess worked for Bart because the original IP was still found at 0x06002000. The stub that copies the AR menu code to workram-L is position-independent, so you could jump to 0x02000E00 and skip the security code.
 
Ah, yeah, I got the entry points mixed up; I was talking about the AR copy code being position-independent.
 
antime said:
It definitely executes from workram-L. Jumping to 0x02000100 would start executing the security code (sys_sec.o) from the cartridge IP in place. It is not position-independent, and I guess worked for Bart because the original IP was still found at 0x06002000. The stub that copies the AR menu code to workram-L is position-independent, so you could jump to 0x02000E00 and skip the security code.

Nice, but how to jump to 0x02000E00 ?

Also I use the workram-L, I guess it's dead.

then how to make a real reset ? I'm lazy, each time I have to get up to push the reset button of the Saturn.
 
You can reset the machine by sending the SYSRES command to the SMPC. That is probably the safest alternative, as it will return the system to a known state.
 
antime said:
You can reset the machine by sending the SYSRES command to the SMPC. That is probably the safest alternative, as it will return the system to a known state.

yeah !!! really good ! it works perfectly, thanks Antime !
 
Back
Top