Page 1 of 1

SH2 Instruction set

Posted: Fri Jun 01, 2012 3:10 am
by Bitybity
Hello everyone,

I'm actually trying to make my Sega CD game use the sh2 processors, making it a Sega CD 32x game. But the trouble is, how I can use the sh2 processors, if I don't know their commands? There's a lot of documents for learning the 68k asm, but I just can't find documents for sh2.

Does someone know where I can found it? Thanks.

PD: Also, can someone tell me at least a basic about how does the framebuffer work? Thanks.

Re: SH2 Instruction set

Posted: Sun Jun 03, 2012 6:51 pm
by ammianus
Bitybity wrote:Hello everyone,

I'm actually trying to make my Sega CD game use the sh2 processors, making it a Sega CD 32x game. But the trouble is, how I can use the sh2 processors, if I don't know their commands? There's a lot of documents for learning the 68k asm, but I just can't find documents for sh2.

Does someone know where I can found it? Thanks.

PD: Also, can someone tell me at least a basic about how does the framebuffer work? Thanks.
If I had the time I would like to write up a beginner's guide with all the info I had to learn. Here are links to the best documentation I could find, some of it about SH2 asm instruction set.

http://www.romhacking.net/documents/279/
Collection of Sega 32X Manuals including the most important "32X Hardware Manual".

http://devster.monkeeh.com/sega/32xguide1.txt
Reverse engineered introduction to 32X capabilities and hardware.


http://www.datasheetcatalog.org/datashe ... Xwuttu.pdf
"Hitachi SH7604 Hardware Manual" – The manufacturers manual for the main RISC CPUs used in the 32X aka SH2, Super-H. Has the details for all of the assembly language instructions for the processors.

http://www.eidolons-inn.net/tiki-list_f ... lleryId=10
Gallery: 32X Development – includes some utilities, assemblers and 32X BIOS files as well as more Hitachi SH2 documentation.

Posted: Sun Jun 03, 2012 7:34 pm
by Chilly Willy
The main point in starting the 32X is a special header which tells the 32X where the code/data is to copy into the SDRAM on startup. In a 32X cart, the header is just after the standard MD rom header. Since there is no 32X rom in the SCD, the 32X needs another method of getting this info...

The way to start the 32X on the SCD is to copy the header and all the code/data into the 32X framebuffer.

MD 68000:
Look for 32X signature in IO. If present, turn 32X on and set SCD communication register telling SCD the 32X is present.

CD 68000:
Wait for comm register saying 32X is present. Load code to start 32X from CD into word ram. Flip it to the MD 68000 side and set comm register telling the MD the data is ready.

MD 68000:
Wait for SCD comm register saying 32X data is loaded. Get access to 32X VDP resources, then copy the data from word ram to the 32X framebuffer. Release access to 32X VDP resources. Set 32X communication register to "_CD_" and wait for "M_OK"/"S_OK" from 32X.

The 32X is now up and running the code passed to it via the framebuffer. I imagine you would probably have SH2 code that watched the 32X comm registers for commands (from the MD 68000) to do things like play sounds/music, scale/rotate sprites/bitmaps, etc.