I was able to not have a 1st load address, 0xF0, on the IP.BIN file and was subsequently able to load the first file from CD.
The linker had the correct address 0x06010000.
The linker also had the KEEP for sl_bin section that I have like normal.
The linker does not load the file the Saturn does, but the linker keeps the files in the correct layout.
The IP.BIN file is allowed to be 0x8000 or 32KB.
The SEC1.BIN file is 1/26/1995 stamp and 4KB --> from psy-q
The SEC2.BIN file is 1/26/1995 stamp and 1KB --> from psy-q
The FLD_KRNL_BIN file is 2/7/1996 stamp and 5KB --> This is the earliest file without files in the header, and 202001a4 at 0x00.
How it works is the assembly file for IP.BIN <-- IP.S starts off like normal.
IP.S is made into IP.o with gcc.
Then IP.o is made into IP.BIN with objcopy
(Not the full attached IP.S file, just the important parts)
Differences are 0xCC has 0x01010000 this is used for demo demo (no impact in this case).
The important part is 0xF0 has no 1st read address.
At org 0x100 the SEC1.BIN and SEC2.BIN files are .incbin and they end like expected at 0xf00
Next is SR interrupt and jump to 0x260042b0.
0x260042b0 is the address after the FLD_KRNL_BIN file.
The Saturn Bios copies your IP.BIN file directly into 0x06002000.
So your first 0x00 - 0x100 needs to be the necessary information
The next 0x100 - 0xf00 is the security files
0xf00 in Yabause and pseudosaturn is where you are allowed to run code or AIP.
The SR interrupt and jump ends at 0xf28
At 0xf28 I add another .incbin to load the FLD_KRNL_BIN file.
After that then I turn off the Scu_interrupts.
Set LWRAM_size to 0x1378 (true size of FLD_KRNL.BIN)
Point to LWRAM_destination 0x20200000
Point to LWRAM_src 0x26002f28
At this point I copy FLD_KRNL.BIN from IP.BIN to LWRAM.
I then change the starting address to 0x26010000.
This is changed at:
0x2600026c
0x260002b0
0x26000cf0
0x260020f0
At this point I jsr (jump and return) to 0x202001a4.
This is going to LWRAM 0x1a4 into FLD_KRNL_BIN.
This loads the first file in your CD folder into your starting address
After this I return back to 0x260023e0.
Finally I jump to start of the file or 0x26010000
Related Topic:
The linker had the correct address 0x06010000.
The linker also had the KEEP for sl_bin section that I have like normal.
The linker does not load the file the Saturn does, but the linker keeps the files in the correct layout.
The IP.BIN file is allowed to be 0x8000 or 32KB.
The SEC1.BIN file is 1/26/1995 stamp and 4KB --> from psy-q
The SEC2.BIN file is 1/26/1995 stamp and 1KB --> from psy-q
The FLD_KRNL_BIN file is 2/7/1996 stamp and 5KB --> This is the earliest file without files in the header, and 202001a4 at 0x00.
How it works is the assembly file for IP.BIN <-- IP.S starts off like normal.
IP.S is made into IP.o with gcc.
Then IP.o is made into IP.BIN with objcopy
(Not the full attached IP.S file, just the important parts)
Differences are 0xCC has 0x01010000 this is used for demo demo (no impact in this case).
The important part is 0xF0 has no 1st read address.
Code:
.ascii "SEGA SEGASATURN " !0x00
.ascii "SEGASYSTEMV1.000" !0x20
.long 0x01010000 !0xCC
.long 0x8000 !0xE0 u32 ip_size
.long 0x0 !0xF0 u32 read_addr
At org 0x100 the SEC1.BIN and SEC2.BIN files are .incbin and they end like expected at 0xf00
Rich (BB code):
.org 0x100
.incbin "SEC1.bin"
.incbin "SEC2.bin" !0xf00 end
Next is SR interrupt and jump to 0x260042b0.
0x260042b0 is the address after the FLD_KRNL_BIN file.
The Saturn Bios copies your IP.BIN file directly into 0x06002000.
So your first 0x00 - 0x100 needs to be the necessary information
The next 0x100 - 0xf00 is the security files
0xf00 in Yabause and pseudosaturn is where you are allowed to run code or AIP.
The SR interrupt and jump ends at 0xf28
At 0xf28 I add another .incbin to load the FLD_KRNL_BIN file.
Rich (BB code):
.org 0xf28
.incbin "FLD_KNL_v0.BIN" !0xf28 + 0x1388 = 22b0 + 0x06002000 = 0x060042b0
!0x1388 = 5kb the size of FLD_KRNL.BIN
After that then I turn off the Scu_interrupts.
Set LWRAM_size to 0x1378 (true size of FLD_KRNL.BIN)
Point to LWRAM_destination 0x20200000
Point to LWRAM_src 0x26002f28
At this point I copy FLD_KRNL.BIN from IP.BIN to LWRAM.
I then change the starting address to 0x26010000.
This is changed at:
0x2600026c
0x260002b0
0x26000cf0
0x260020f0
At this point I jsr (jump and return) to 0x202001a4.
This is going to LWRAM 0x1a4 into FLD_KRNL_BIN.
This loads the first file in your CD folder into your starting address
After this I return back to 0x260023e0.
Finally I jump to start of the file or 0x26010000
Related Topic:
I took a look at the disc standards doc and I have a few questions.
From what I gather, the AIP is only executed after the security ring check, is this correct? What address does this get loaded to?
What exactly is the 1st read file? I understand that it gets loaded while the Saturn logo is doing it's thing, but how is this file identified, I didn't see an entry in IP.BIN for it?
From what I gather, the AIP is only executed after the security ring check, is this correct? What address does this get loaded to?
What exactly is the 1st read file? I understand that it gets loaded while the Saturn logo is doing it's thing, but how is this file identified, I didn't see an entry in IP.BIN for it?
- Mask of Destiny
- Replies: 8
- Forum: Saturn Dev
If you're using the linkscript from the SGL demos, change SLSTART to an address higher up. As TakaIsSilly already mentioned, at least the "1st Read Address" in the IP must also be changed.
By the way, if I may offer some unrelated critique, your loop
could be better written as a do..while loop, ie.
By the way, if I may offer some unrelated critique, your loop
Code:
while(stat=CDSTAT_COMPLETED)
{
slSynch();
stat=slCdGetStatus(cdhn, len);
...
if(stat==CDSTAT_COMPLETED) break;
}
could be better written as a do..while loop, ie.
Code:
do {
slSynch();
stat=slCdGetStatus(cdhn, len);
...
} while (stat != CDSTAT_COMPLETED);
In the sgl 1.0 documentation there is a snippet of code about being able to open the tray without turning on the multiplayer.
The code has been modified to not rts but branch afterwards. It also disables and enables interrupts.
Its SH2 assembly .S so needs to be compiled.
mov #-16,r0 ! Disable interrupts
extu.b r0,r0
ldc r0,sr
nop
mov.l @(010,PC),r4 ! Load GDB to 60ffc00 which was SGL1 stack pointer
nop
ldc r4,gbr
bra Trayoff
.long 0x060ffc00
Trayoff:
tst r4,r4
movt...
The code has been modified to not rts but branch afterwards. It also disables and enables interrupts.
Its SH2 assembly .S so needs to be compiled.
mov #-16,r0 ! Disable interrupts
extu.b r0,r0
ldc r0,sr
nop
mov.l @(010,PC),r4 ! Load GDB to 60ffc00 which was SGL1 stack pointer
nop
ldc r4,gbr
bra Trayoff
.long 0x060ffc00
Trayoff:
tst r4,r4
movt...
- Mr_Da_Greatest
- Replies: 2
- Forum: Saturn Dev