Page 1 of 1

Return to the PSXSERIAL loader without resetting the PSX

Posted: July 12th, 2013, 4:51 am
by Shendo
Hi everyone.
If you are using Jihad/HITMEN's PSXPAL.EXE or PSXNTSC.EXE to load your homebrew you have
undoubtedly noticed that you have to reset your PS1 to send a new build of your application.

Well, if you add the following code you can return to loader without resetting:

Code: Select all

__asm__("j 0x801e75a8");
This is a no conditional jump to the memory where the loader resides in.
It should work if your EXEs are smaller then 1.8MB, otherwise the loader will get overwritten.

Re: Return to the PSXSERIAL loader without resetting the

Posted: May 1st, 2014, 10:10 am
by Greg
And if you use PSXSERIAL.EXE version 1.2 use the following code.

Code: Select all

__asm__("j 0x801EAAE8");

Re: Return to the PSXSERIAL loader without resetting the

Posted: May 4th, 2014, 1:29 am
by Administrator
Greg wrote:And if you use PSXSERIAL.EXE version 1.2 use the following code.

Code: Select all

__asm__("j 0x801EAAE8");
I released PSXSERIAL V1.3 today, and the only figure I can come up with is 0x801EF000 and it doesn't work for me :?
Jump Address = (Stack - PS-EXE size). I assume you negated 1 bit, so that leaves us with 0x801EEFFF but that doesn't make any since since V1.2 = 61,440 Bytes and V1.3 = 69,632 Bytes.

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 4th, 2014, 5:41 am
by Greg
Return code for PSXSERIAL.EXE version 1.3

Code: Select all

__asm__("j 0x801ecd94");

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 4th, 2014, 5:56 am
by Greg
Quick way to found the return address is to run the psxserial cd image in NO$PSX, and get the address from the TTY Debug Windows of NO$PSX

Image

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 4th, 2014, 4:14 pm
by Administrator
Interesting. I will have to figure out how it gets the boot address.
Anyway, it works nicely. However, when you return back to PSXSERIAL it says "RECEIVING DATA FROM PC" still. It should return to "STANDING BY...". No big deal, but yet again it may be misleading to some. I'll add this note to the bug list.

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 4th, 2014, 6:27 pm
by Greg
The boot address is located in the serial.exe header at offset 0x10 4Byte(Little-Endian)

Image

Or use exefixup for more convenience.

Image

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 7th, 2014, 9:42 am
by Shendo
There is a function in BIOS called "WarmBoot" (thanks to Nocash for finding it).
When called it reloads the executable from CD and launches it,
even if it was rewritten in memory and It's fast because boot logo is skipped entirely.

Add a "calls.s" file in your project containing

Code: Select all

.global WarmBoot

WarmBoot:
	li $9, 0xa0
	nop
	j 0xa0
	nop
	jr $ra
And call it when you want to return to PSXSERIAL loader.

I've been using it for quite a while now in my projects.
Much cleaner then looking for a proper starting address each time a new version is released.

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 7th, 2014, 3:29 pm
by Administrator
Well that is down right awesome. Thanks!

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: May 8th, 2014, 6:18 am
by Greg
Great, now I can put Soft Reset trigger in my dev.

Reset will be triggered by pressing the R2, L2, L1, R1, Start, and Select buttons simultaneously.

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: July 13th, 2014, 12:04 am
by Administrator
Thought I would mention that the WarmBoot assembler code will not compile under ASPSX (GNU Assembler) nor ASMPSX (Hand Assembler) Shendo.

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: July 13th, 2014, 1:16 am
by Shendo
You probably need a slightly different syntax.
The code i posted above compiles fine with the MIPS configured GCC core toolchain I'm using (PSXSDK).

Try with this:

Code: Select all

.global WarmBoot

WarmBoot:
   li t9, 0xa0
   nop
   j 0xa0
   nop
   j ra

Re: Return to the PSXSERIAL loader without resetting the PSX

Posted: July 13th, 2014, 2:18 am
by Administrator
Ah, right. That's better. It compiled with ASMPSX now :)

Code: Select all

SDevTC version 2.57

Copyright (c) 1988-1997 S.N. Systems Software Limited,  all rights reserved

Code: Select all

00000000                      warmboot:
00000000 240800A0              li  t0,0xa0
00000004 01000008              jr  t0
00000008 240900A0              li  t1,0xa0