CDB functions in bios

Disclaimer:
This was done by hand analysis, objdump and a lot of time and patience.
I do not guarantee that everything is 100% accurate.
(I make 20L+ of LV vectors in my day job, coding is a hobby/interest)

Hopefully this can spur discussion and maybe crack the saturn with a modified IP.BIN that has 0x8000 - f00 space to work with.

This is related to the "mpr" bios file and the "bios100jp.asm" from srg320

With the bios files there are calls to the CDB functions. (most memory locations will be from the mpr file)

For Functions 0x50 Get Buffer Size to 0x48 Reset Selector

The way I found these out was 0x4b74 appears to be the memory location for clearing out the command registers (CR 0-3)
Next for most functions e3 ## is the signature for the command to be called.
So for example at 0x33fc this should be the Get Buffer Size function.
At 0x3410 there is the assembly e3 50 = mov #80, r3.
While 80 has been moved into r3, this is in hex so 0x50 is the real function number.

Next there is usually an assembly 22 30 = mov.b r3, @r2, I believe this is putting the function number into (CR1) before the function call
Next there is usually a 0x4b86 or 0x4b8a this is to send the command with r7 = 0 for 0x4b86 and r7 = 1 for 0x4b8a.
(Not sure the importance or r7 = 1 or 0)

For Functions 0x90 MPEG Get Status to 0xE2 Get MPEG ROM (0xE0 Authenticate Device, and 0xE1 Is Device Authenticated included)

This pattern is mainly similar (there are some exceptions but trying not to deviate) until the MPEG functions.
There is still the call to 0x4b74 for clearing out the CR.
Instead there is an assembly 93 ## = mov.w 0x####,r3 ! 0x##.
This moves a value into r3 from a later address in the file.
For example 0x4654 is MPEG Get Status.
0x465c is the call to 0x4b74 or CR clear
0x4664 is the 93 1b = 0x469e, r3 ! 0x90.
The send command is different (still working on these out)

Here is the list of functions, where the are in "mpr" bios and the corresponding location in bios100jp.asm

Sorry for misalignment this came from a notepad++ file
(so I am hand spacing to correct alignment since I suck at html/web forum entry)

mpr bootCDB_commandCDB#bios100jp
33fcGet Buffer Size0x50003560
3458Get Sector Number0x51L0035BA:
34a8Calculate Actual Size0x5200360C
34f4Get Actual Size0x53003656
3578Get Sector Info0x540036C6
3600Execute FAD Search0x5500374C
3654Get FAD Search Result0x56003792
36bcset sector length0x600037F4
36fcget sector data0x61003830
3754Delete Sector Data0x62003884
37a0Get/Del Sector Data0x63L0038CE:
37f8Put Sector Data0x64003924
3838Copy Sector Data0x65003960
389cMove Sector Data0x660039C4
38f4Get Copy Error0x67L003A1C:
3940Change Directory0x70003A64
397cRead Directory0x71003A9C
39c4Get File System Scope0x72003AE0
3a26Get File Info0x73003B3A
3a94Read File0x74003B8C
3aecAbort File0x75L003BEE:
3b24Get CD Status0x00L002CB8:
3b9cGet Last Buf Dest or ff 0x32 or0xffL002D1C:
3c54Get Hardware Info0x01L002DD0:
3ca4Get TOC0x02L002E22:
3cfcGet Session Info0x03L002E88:
3d50Initialize CD System0x04L002ECE:
3dfcOpen Tray0x05002F7C
3e7cEnd Transfer0x06L002FFC:
3edcSet CD Dev Con0x30L00318C:
3f0eGet CD Dev Con0x310031BC
3f58Get Last Buf Dest0x32003204
3f9cPlay Disc0x10L003050:
405aSeek Disc0x11003120
4094Scan Disk0x12003158
4310Set Filter0x40003250
4360Get Filter Range0x41003290
43d0Set Filter SubH Cond0x420032F0
4440Get Filter SubH Cond0x43003350
44b2Set Filter Mode0x440033C8
4500Get Filter Mode0x4500340C
4550Set Filter Con0x4600345C
45b0Get Filter Con0x470034B4
4608Reset Selector0x48L00351C:
4654"MPEG Get Status"0x90L004048
46b0"MPEG Get Interrupt"0x91004098
46f2"MPEG Set Interrupt Mask"0x920040DA
4738"MPEG Init"0x93L004120:
476a"MPEG Set Mode"0x94004152
47d4"MPEG Play"0x950041BC
4838"MPEG Set Decoding Method"0x96004220
4884"MPEG Out Decoding Sync"0x9700426C
48c4"MPEG Get Timecode"0x980042AC
4954"MPEG Get PTS"0x99004348
4998"Authenticate Device"0xE0L003E74:
49f4"Is Device Authenticated"0xE1L003EBC:
4a54"Get MPEG ROM"0XE2003F28

Code:
mpr boot    CDB_command                     CDB#                bios100jp
33fc:           Get Buffer Size                       0x50                 003560  
3458:          Get Sector Number                0x51                 L0035BA:
34a8:          Calculate Actual Size              0x52                 00360C  
34f4:           Get Actual Size                       0x53                 003656  
3578:          Get Sector Info                       0x54                 0036C6  
3600:          Execute FAD Search                0x55                 00374C  
3654:          Get FAD Search Result            0x56                 003792  
36bc:          set sector length                     0x60                 0037F4  
36fc:           get sector data                        0x61                 003830  
3754:          Delete Sector Data                  0x62                 003884  
37a0:          Get/Del Sector Data                0x63                 L0038CE:
37f8:           Put Sector Data                       0x64                 003924  
3838:          Copy Sector Data                    0x65                 003960  
389c:          Move Sector Data                    0x66                 0039C4  
38f4:           Get Copy Error                         0x67                L003A1C:
3940:          Change Directory                     0x70                003A64  
397c:          Read Directory                          0x71                003A9C  
39c4:          Get File System Scope              0x72                003AE0  
3a26:          Get File Info                              0x73                003B3A  
3a94:          Read File                                   0x74                003B8C  
3aec:          Abort File                                  0x75                L003BEE:
3b24:         Get CD Status                            0x00                L002CB8:
3b9c:         Get Last Buf Dest or ff               0x32 or 0xff     L002D1C:
3c54:         Get Hardware Info                     0x01                L002DD0:
3ca4:         Get TOC                                     0x02                L002E22:
3cfc:          Get Session Info                        0x03                L002E88:
3d50:         Initialize CD System                  0x04                L002ECE:
3dfc:          Open Tray                                  0x05               002F7C  
3e7c:         End Transfer                               0x06               L002FFC:
3edc:         Set CD Dev Con                         0x30               L00318C:
3f0e:         Get CD Dev Con                         0x31               0031BC  
3f58:         Get Last Buf Dest                        0x32               003204  
3f9c:         Play Disc                                     0x10               L003050:
405a:        Seek Disc                                    0x11               003120
4094:        Scan Disk                                    0x12               003158
4310:        Set Filter                                      0x40               003250
4360:        Get Filter Range                          0x41               003290
43d0:        Set Filter SubH Cond                  0x42               0032F0
4440:        Get Filter SubH Cond                  0x43               003350
44b2:        Set Filter Mode                           0x44               0033C8
4500:        Get Filter Mode                           0x45               00340C
4550:        Set Filter Con                               0x46               00345C
45b0:        Get Filter Con                              0x47               0034B4
4608:        Reset Selector                              0x48               L00351C:
4654:        "MPEG Get Status"                       0x90               L004048
46b0:        "MPEG Get Interrupt"                  0x91               004098
46f2:        "MPEG Set Interrupt Mask"          0x92               0040DA
4738:        "MPEG Init"                                  0x93               L004120:
476a:        "MPEG Set Mode"                        0x94               004152
47d4:        "MPEG Play"                                 0x95               0041BC
4838:        "MPEG Set Decoding Method"    0x96               004220
4884:        "MPEG Out Decoding Sync"        0x97               00426C
48c4:        "MPEG Get Timecode"                 0x98               0042AC
4954:        "MPEG Get PTS"                          0x99                004348
4998:        "Authenticate Device"                 0xE0                L003E74:
49f4:        "Is Device Authenticated"            0xE1                L003EBC:
4a54:        "Get MPEG ROM"                       0XE2                003F28

MDG
 
Last edited by a moderator:
Thank you for sharing your reversing engineering results. May I make a suggestion? Please give Ghidra a shot, it supports SH 1\2 disassembly and decompilation. Load the firmware at address 0x0 and manually set the processor to SH1 for CDB and SH2 for the BIOS.

Additionally, please keep an eye out for any method to dump the CDB from the SH2 via software. As far as I know all CDB dumps have used custom hardware. Being able to dump it from a running program would be nice.
 
Additionally, please keep an eye out for any method to dump the CDB from the SH2 via software. As far as I know all CDB dumps have used custom hardware. Being able to dump it from a running program would be nice.
The only way to do that would be extending the SH1 with extra commands, you can actually do that but it requires making your own MPEG card. And then we are back to using custom hardware.

It would be more realistic to write an app for the Satiator cards to read the CDB.
 
Back
Top