Boot file location identification

paul_met

Established Member
I can't figure out how the game's main executable file is identified in the boot area of the disk. In this area, there is no file name or sector number where it is located on the disk (LBA). There is only the address of the memory area where the executable file is loaded. As a result of debugging, I got the address (0x25898000) from which the sector number of the executable file (LBA+150) is loaded, as well as the file size. But the breakpoint for writing to this address (0x25898000) in the debugger does not work. Can someone explain that?
 
AFAIK, it's just the first file entry in the root directory. Because of how the mastering tools worked, it's usually also the first file in alphabetical order, but it doesn't have to be.
 
I was also sure that the first file in the LBA list was being read. But in the screenshot below, the file named " 0 " is the fourth in the list by LBA, but it is still read first. So the LBA is not important? Then how do I change the order of reading files and upload a file whose name is not the first in alphabetical order?
 

Attachments

  • X.png
    X.png
    6.1 KB · Views: 138
Couldn't you just name your new file "0" and name the old file '1" or something and then have your new code load in "1" when it's done?
 
As I wrote above, the system selects the first file identifier listed in the directory record of the root directory. The LBA of the file does not matter.

Looking at the ECMA-119 document, it does specify an ordering for file identifiers in a directory record, but I doubt it actually matters for the Saturn's file system implementation.
 
saturn reads the first file of the CD and loads it at the address defined in the IP.BIN
 
Couldn't you just name your new file "0" and name the old file '1" or something and then have your new code load in "1" when it's done?
I had the idea to switch between these two files before loading the game. But it seems that you can't do this without a special loader file (for example, this loader is present in Vandal Hearts).
 
fid:
0: (.) Current directory
1: (..) Parent directory
2: The first file in the current directory
CDC_ChgDir(filtno, NUL_FID) // fid:NUL_FID, change to the root dir
CDC_TgetFileInfo(2, file) // 1st file(alphabetical) in the root dir, the file starts at file->fad
CDC_ReadFile(filtno, 2, offset) // read the first file
"0": fid 2
"1": fid 3
CDC_ReadFile(filtno, condition ? 2 : 3, offset) // read either "0" or "1"

View attachment 5180
I'm more interested in how all this code looks in SH2 assembler.
 
fid:2 is the 1st Read File, it reads by Boot ROM during Sega license screen is displayed.
File is started at 1st Read Address(RA, specified in IP.bin offset: 0xf0)
View attachment 5181
Code is started at Security Code -> Area Code Group -> AIP(Application Initial Program)
then branch/jump to the 1st Read File
I know that. I am interested in how to make a choice between two files. For example, if T=0, then reading fist file in the list ("0.bin"), otherwise go to the second file in the list ("1.bin"). In other words, I need an algorithm of seeking to the next file in the list (without searching for the file by name if possible).
 
Last edited:
Merge "0" and "1" into one file "0"
Modify the AIP, choose either one of two offsets to jump/branch to...
Not a very convenient solution. The file size will double and the time it takes to load it into memory will also increase. In addition, there may not be enough memory for such file.
 
Well, I solved the problem of selecting executable files at startup. I used a custom bootloader, the code of which I borrowed from another game, modifying it to fit my needs. This bootloader is suitable for hacks, suggesting the use of a extended RAM cartridge to speed up the loading of the game. When such a cartridge is connected, the bootloader detects it (the "SEGA" logo turns red) and caches data to the cartridge RAM.
----------------------------------------------------------------------
 
Great job, can be done something similar for kof95 and ultraman??
Load cartridge rom into ram from a cd file.
I did not quite understand the question. Both of these games use a ROM cartridge. Two cartridges cannot be used simultaneously (RAM and ROM).
 
I did not quite understand the question. Both of these games use a ROM cartridge. Two cartridges cannot be used simultaneously (RAM and ROM).

He means basically dump the ROM, put it on the CD, and then have this load it into the 4MB RAM cartridge. I honestly don't know if that would work as I'm not sure how big the ROM files are for those two games.

I'd rather see if this could improve the Mortal Kombat games on the Saturn.
 
He means basically dump the ROM, put it on the CD, and then have this load it into the 4MB RAM cartridge. I honestly don't know if that would work as I'm not sure how big the ROM files are for those two games.
The ROM size for KoF 95 is 2 MB. But I don’t understand why to transfer data to a RAM cartridge from a ROM cartridge? To play on a modified original hardware without a ROM cartridge?

I'd rather see if this could improve the Mortal Kombat games on the Saturn.
I think the RAM cartridge won't help. Files with data of fighters from MKT take up quite a lot of space (300-500 KB each file) and all of them will not fit on the cartridge. If we are talking about the problem of loading characters during the transformation of Shang Tsung of course.
 
He means basically dump the ROM, put it on the CD, and then have this load it into the 4MB RAM cartridge.

Exactly, just that.

The ROM size for KoF 95 is 2 MB. But I don’t understand why to transfer data to a RAM cartridge from a ROM cartridge? To play on a modified original hardware without a ROM cartridge?

Imagine you wanna play KoF 95 in real hardware, but you don't have original cartridge.
If posible, you can put rom image file into CD and load to ram cartridge.

PD:Sorry for my english.
 
Imagine you wanna play KoF 95 in real hardware, but you don't have original cartridge.
If posible, you can put rom image file into CD and load to ram cartridge.

PD:Sorry for my english.
I do not know how the identification of the ROM cartridge occurs. In addition, data from the ROM cartridge is present on the disk, but it is divided into several files and a header.
 
Back
Top