Return to the PSXSERIAL loader without resetting the PSX

General Programming help in C, C++ or ASM, Compiling / Debugging, and R3000A Central Processing Unit (CPU) information
Post Reply
User avatar
Shendo
C Programming Expert
C Programming Expert
Posts: 238
Joined: March 21st, 2012, 4:34 am
I am a: Programmer
Motto: Never settle
PlayStation Model: SCPH-9002
Location: Croatia, EU

Return to the PSXSERIAL loader without resetting the PSX

Post by Shendo » July 12th, 2013, 4:51 am

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.
My PS1 consoles: 2 x SCPH-1002, SCPH-5552, SCPH-7002, 4x SCPH-9002, 2 x SCPH-102.
Dev console: SCPH-9002, MM3 - 7 wire modchip, PAL color mod, CH340 serial cable addon.

User avatar
Greg
Serious PSXDEV User
Serious PSXDEV User
Posts: 101
Joined: September 9th, 2013, 1:27 am
PlayStation Model: SCPH-7501
Location: Port-au-Prince, HAITI

Re: Return to the PSXSERIAL loader without resetting the

Post by Greg » May 1st, 2014, 10:10 am

And if you use PSXSERIAL.EXE version 1.2 use the following code.

Code: Select all

__asm__("j 0x801EAAE8");
1 x SCPH-7501, 2 x SCPH-7001, 2 x SCPH-5501
1 x Pro Action Replay with "Dual Rom Mod", ROM 1: Caetla, ROM 2: UNIROM
1 x Xplorer V2 with Caetla
1 x GameShark V2.1
1 x GameShark Pro V3.0
1 x CommLinkUSB
1 x XLinkUSB

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2431
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Return to the PSXSERIAL loader without resetting the

Post by Shadow » May 4th, 2014, 1:29 am

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.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
Greg
Serious PSXDEV User
Serious PSXDEV User
Posts: 101
Joined: September 9th, 2013, 1:27 am
PlayStation Model: SCPH-7501
Location: Port-au-Prince, HAITI

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Greg » May 4th, 2014, 5:41 am

Return code for PSXSERIAL.EXE version 1.3

Code: Select all

__asm__("j 0x801ecd94");
1 x SCPH-7501, 2 x SCPH-7001, 2 x SCPH-5501
1 x Pro Action Replay with "Dual Rom Mod", ROM 1: Caetla, ROM 2: UNIROM
1 x Xplorer V2 with Caetla
1 x GameShark V2.1
1 x GameShark Pro V3.0
1 x CommLinkUSB
1 x XLinkUSB

User avatar
Greg
Serious PSXDEV User
Serious PSXDEV User
Posts: 101
Joined: September 9th, 2013, 1:27 am
PlayStation Model: SCPH-7501
Location: Port-au-Prince, HAITI

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Greg » May 4th, 2014, 5:56 am

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
1 x SCPH-7501, 2 x SCPH-7001, 2 x SCPH-5501
1 x Pro Action Replay with "Dual Rom Mod", ROM 1: Caetla, ROM 2: UNIROM
1 x Xplorer V2 with Caetla
1 x GameShark V2.1
1 x GameShark Pro V3.0
1 x CommLinkUSB
1 x XLinkUSB

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2431
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Shadow » May 4th, 2014, 4:14 pm

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.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
Greg
Serious PSXDEV User
Serious PSXDEV User
Posts: 101
Joined: September 9th, 2013, 1:27 am
PlayStation Model: SCPH-7501
Location: Port-au-Prince, HAITI

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Greg » May 4th, 2014, 6:27 pm

The boot address is located in the serial.exe header at offset 0x10 4Byte(Little-Endian)

Image

Or use exefixup for more convenience.

Image
1 x SCPH-7501, 2 x SCPH-7001, 2 x SCPH-5501
1 x Pro Action Replay with "Dual Rom Mod", ROM 1: Caetla, ROM 2: UNIROM
1 x Xplorer V2 with Caetla
1 x GameShark V2.1
1 x GameShark Pro V3.0
1 x CommLinkUSB
1 x XLinkUSB

User avatar
Shendo
C Programming Expert
C Programming Expert
Posts: 238
Joined: March 21st, 2012, 4:34 am
I am a: Programmer
Motto: Never settle
PlayStation Model: SCPH-9002
Location: Croatia, EU

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Shendo » May 7th, 2014, 9:42 am

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.
My PS1 consoles: 2 x SCPH-1002, SCPH-5552, SCPH-7002, 4x SCPH-9002, 2 x SCPH-102.
Dev console: SCPH-9002, MM3 - 7 wire modchip, PAL color mod, CH340 serial cable addon.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2431
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Shadow » May 7th, 2014, 3:29 pm

Well that is down right awesome. Thanks!
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
Greg
Serious PSXDEV User
Serious PSXDEV User
Posts: 101
Joined: September 9th, 2013, 1:27 am
PlayStation Model: SCPH-7501
Location: Port-au-Prince, HAITI

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Greg » May 8th, 2014, 6:18 am

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.
1 x SCPH-7501, 2 x SCPH-7001, 2 x SCPH-5501
1 x Pro Action Replay with "Dual Rom Mod", ROM 1: Caetla, ROM 2: UNIROM
1 x Xplorer V2 with Caetla
1 x GameShark V2.1
1 x GameShark Pro V3.0
1 x CommLinkUSB
1 x XLinkUSB

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2431
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Shadow » July 13th, 2014, 12:04 am

Thought I would mention that the WarmBoot assembler code will not compile under ASPSX (GNU Assembler) nor ASMPSX (Hand Assembler) Shendo.
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

User avatar
Shendo
C Programming Expert
C Programming Expert
Posts: 238
Joined: March 21st, 2012, 4:34 am
I am a: Programmer
Motto: Never settle
PlayStation Model: SCPH-9002
Location: Croatia, EU

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Shendo » July 13th, 2014, 1:16 am

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
My PS1 consoles: 2 x SCPH-1002, SCPH-5552, SCPH-7002, 4x SCPH-9002, 2 x SCPH-102.
Dev console: SCPH-9002, MM3 - 7 wire modchip, PAL color mod, CH340 serial cable addon.

User avatar
Shadow
Admin / PSXDEV
Admin / PSXDEV
Posts: 2431
Joined: December 31st, 2012, 5:37 pm
PlayStation Model: H2000/5502

Re: Return to the PSXSERIAL loader without resetting the PSX

Post by Shadow » July 13th, 2014, 2:18 am

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
Development Console: SCPH-5502 with 8MB RAM, MM3 Modchip, PAL 60 Colour Modification (for NTSC), PSIO Switch Board, DB-9 breakout headers for both RGB and Serial output and an Xplorer with CAETLA 0.34.

PlayStation Development PC: Windows 98 SE, Pentium 3 at 400MHz, 128MB SDRAM, DTL-H2000, DTL-H2010, DTL-H201A, DTL-S2020 (with 4GB SCSI-2 HDD), 21" Sony G420, CD-R burner, 3.25" and 5.25" Floppy Diskette Drives, ZIP 100 Diskette Drive and an IBM Model M keyboard.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests