Re: Questions on writing a new Mega CD emulator
Posted: Fri May 03, 2019 5:16 am
While MegaCD emulation is still very much on my to-do list, I have compiled a fair few resources for it over the years. There's one largely untapped resource you should take a look at. I own a couple of these Cross Product MegaCD dev units: https://segaretro.org/SNASM_Mega-CD. This has as part of it an ISA card that fits into a PC, and emulates the CD hardware. For years, the software to drive this C-Trac CD emulation hardware was missing from the public domain. It surfaced more recently, but when hunting for it, I actually successfully tracked down the hardware designer that made that card, as well as the software developer that wrote the PC software for it. Although they didn't have the PC software saved, the hardware guy did send me a bunch of files. Here's the dump he sent me:
http://nemesis.exodusemulator.com/MegaD ... lation.tgz
It could be a useful reference, as this stuff was developed on contract for Sega, with access to their engineers and all the internal information that they needed to pull it off. There's some interesting stuff like the schematics for the C-Trac card, but the coolest thing is probably the source for the program that runs on the 6303 microprocessor on that card. There's some obviously useful info from first glance. Want to know all the CDC command and status codes? Here you go:
Take a look at the full microcontroller code though, as in it you have a complete, known working implementation of the low-level drive behaviour, with comments to boot. If you're not sure what you should do to implement a particular command, just take a look and see what they did.
Now I haven't gone down the rabbit hole of attempting MegaCD emulation myself yet, and I've done little more than browse through the information I've come across, but I suspect with the Sega developer manuals, the Sega service manuals, and the LC8951 docs I expect you already have, combined with this information, that will cover a lot of the bases when it comes to the basics of the CD control hardware itself.
http://nemesis.exodusemulator.com/MegaD ... lation.tgz
It could be a useful reference, as this stuff was developed on contract for Sega, with access to their engineers and all the internal information that they needed to pull it off. There's some interesting stuff like the schematics for the C-Trac card, but the coolest thing is probably the source for the program that runs on the 6303 microprocessor on that card. There's some obviously useful info from first glance. Want to know all the CDC command and status codes? Here you go:
Code: Select all
;drive command nibbles
CMD_NOP EQU $0 ;nop command
CMD_STOP EQU $1 ;stop motor
CMD_REPORTREQ EQU $2 ;change report type
CMD_READ EQU $3 ;read ROM data
CMD_SEEK EQU $4 ;seek to a given location
CMD_PAUSE EQU $6 ;pause the drive
CMD_PLAY EQU $7 ;start playing from current location
CMD_FWD EQU $8 ;forward skip and playback
CMD_RVS EQU $9 ;reverse skip and playback
CMD_TRACKSKIP EQU $A ;start track skipping
CMD_TRACKCUE EQU $B ;track cueing
CMD_DOORCLOSE EQU $C ;close the door
CMD_DOOROPEN EQU $D ;open the door
;drive status nibbles
STATUS_STOP EQU $0 ;disc is set, motor not in operation
STATUS_PLAY EQU $1 ;data or audio playback in progress
STATUS_SEEK EQU $2 ;seek operation by read or seek command
STATUS_SCAN EQU $3 ;skipping to a specific track
STATUS_PAUSE EQU $4 ;paused at designated track or frame
STATUS_DOOROPEN EQU $5 ;the door mechanism is open
STATUS_SUMERROR EQU $6 ;a checksum error occurred during communication
STATUS_COMMANDERROR EQU $7 ;an invalid command has arrived
STATUS_FUNCTIONERROR EQU $8 ;some sort of error occurred during command execution
STATUS_TOCREAD EQU $9 ;TOC is being read at the moment
STATUS_TRACKING EQU $A ;currently skipping tracks
STATUS_NODISC EQU $B ;door is closed, but cannot focus on disc
STATUS_DISCEND EQU $C ;paused in the leadout
STATUS_DISCIN EQU $D ;paused in the leadin
STATUS_TRAYMOVING EQU $E ;the disc door mechanism is in operation
Now I haven't gone down the rabbit hole of attempting MegaCD emulation myself yet, and I've done little more than browse through the information I've come across, but I suspect with the Sega developer manuals, the Sega service manuals, and the LC8951 docs I expect you already have, combined with this information, that will cover a lot of the bases when it comes to the basics of the CD control hardware itself.