Sat'On'Em ver 0.04a - Sega Saturn emulator README

Sat'On'Em is written in pure C (no ASM as of yet) using 
DJGPP ver 2.01 (Get it from www.delorie.com)

<SYSTEM REQUIREMENTS>
-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-==-=-==--=-=-==-=-==-==-=-=-=-==-===-=-=

IBM PC or compatible.. > 80386 running DOS
about 10mB of RAM. Should work with less for now using Virtual mem
Decent CD drive supporting Digital Audio Extraction to run readhed.exe 
cwsdpmi DPMI server to run the program.
Sega Saturn CD's . Any country will do, even GOLD's if your that way inclined
Sega Saturn BIOS.

<Requirments to make any sense of anything!!!>

Saturn documents and Hitachi SH-2 manuals very useful.

NOTE this emulator will NOT play any games , commercial or otherwise.
SO DONT email me that you can't play XMEN VS STREETFIGHTER with it yet.

<WHATS EMULATED??>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

89% Master CPU :-
    All opcodes,with simple cycle counting. Delayed branching.
    Interrupt support.
    No peripheral module support except INTC and basic FRT input capture.

89%  Slave CPU  :-
    Implimented up to same level as Master!

98% Memory     :-
    Full memory map including CPU module control regs and cache 
    memory reflection. Missing 2% because some areas arent setup
    as hardware regs yet. They are there though! Missing cart port
    and regs as well.

20% SMPC       :-
    7 SMPC commands emulated. No peripheral support.

30% SCU        :-
    External interrupt registering and masking implimented.
    Timer0 and Timer1 support.
    Full direct and indirect DMA support (I Hope :) ). 
    NO DSP support as of yet!

2%  VDP2       :-
    Blanking interrupt request support.

2% CDROM    :-
    Two basic commands up and running. No actual support for cd reading
    yet. Always returns NODISC status.

0%  SCUDSP,SCSP,VDP1,RAM CART.

All percentages are subjective by the way :)

<USAGE>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Debugger commands

Enter : Execute next instruction
Z     : Run uninterrupted execution
S     : Skip next instruction
W     : Go back one instruction
L     : Load program file to SH-2 memory
J     : Jump master CPU to location
K     : Set breakpoint to memory location
Q     : Reset master CPU
A     : Reset slave CPU (Warning this releases the reset so the CPU will execute!)
D     : Screen dump memory
R     : Set specific reg value
C     : Write long to memory location
V     : Write word to memory location
B     : Write byte to memory location
I     : Call a specific interrupt! (Change SR I flags to a lower priority first)
Tab   : Change current processor dissassembler.

Notes:-

Some commands will ask for input . This will appear below the disassembler.
With Register change regs SP -> SR are regnums 15 -> 22.
 
Also when you execute an instruction it will do one for both the Master and 
Slave CPUs. Also program will only break on the CPU which is currently being
disassembled.

<READHED Program>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This is an external program to read the header info off segasaturn CDs.

USAGE 
goto DOS.
make sure MSCDEX is running and insert Saturn CD into your first CD drive.
type READHED <filename> where filename is what you what the header saved to.
Now you have a nice header file to lookat and run in the emulator.

If you get garbage displayed where there should be info. Not just small parts
but all over. Then your CD drive is probably not capable to do this task.
OR maybe MSCDEX is not loaded or something. If your drive supports digital
audio extraction it should run fine.
I have only tested this program on a CL DVD ROM drive which works fine.
But email me if it doesnt work on your drive and it supports DAE.

<BIOS>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

You need a Saturn BIOS to run this program. It must be called sega_101.bin in 
the BIOS sub-directory. It doesn't matter what version it is except that it
called the above.

How to get the bios??

Either find it on the internet or use an action replay with PC link and read 
mem addresses 0h -> 80000h

Note : It is illegal (I assume) to have a copy of the BIOS without owning 
a Saturn itself. And before you ask, yes I do own one!!!

<BASIC OPERATION>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

This will outline the a simple use for the emulator itself.

1. Execute the bios until it has copied all the vector infomation to work ram,
   break at address 0x4300 at least on my bios (Jap ver 1.01 I think)
(OR) load using "L" command the file SH_2vect.bin to addr 0x6000000.
2. Get a IP header file from a valid disk using readhed, if possible.
   Press "L" to load it to address 0x6002000.
3. Execute from 0x6002100 using "J" command.
4. Also if you get the first file from the CD's root directory. i.e. in alphanumeric order
   Load it to addr specified in the header at position 0xF0. This is the 1st read file.

Certain key mem addresses.

These are some key mem addresses used by the Saturn, which might be useful.
(Probably not!)

Any address with (2) as the upper nibble is optional and signifies a cache read through
address. Sometimes its there sometimes not. It can also be 4 (cache purge) in which
case nothing is written to the address. Also a 6 can also be there that is cache line
delete or something like that. Basically it still wont write anything.

(2)0000000h -> (2)0080000h  : BIOS ROM area.
(2)5800000h -> (2)5900000h  : CD interface!. A bit anyway!
(2)6000000h -> (2)60FFFFFh  : Upper work RAM
(2)6002000h                 : IP load address (the output from readhed.exe)
  C0000000h -> C0000FFFh    : CPU cache RAM
  FFFFFE00h -> FFFFFFFFh    : CPU control regs.

Has anyone got any clear documentation on the structure of CDROMs (not saturn specific)
Looking for info on subcodes ,headers and general structure of mode1 and mode2 data tracks.

If you have any info , help , questions , bugs , money :) then email me.
Any response is appreciated even to tell me how much I suck :(
Oh and dont ask me where you can get the BIOS or ROMS. I will just throw your
email away.

TyRaNiD

HomePage - http://members.xoom.com/shuma_gorath/
ELA97JAF@sheffield.ac.uk

Thanks + Greets
-=-=-=-=-=-=-=-

Thanks to -=Mark=- for that useful DEMO program!!
Evenin' to Falcon (Of PC-Saturn) . Your emulator's progressing nicely :)
Hello to Charles Doty for his saturn programming site.
General salutation to James Cadd.
Big Hello to Azuco (Of A-Saturn)