Finally the SEGA SC-3000 emulator for PROPC3 and C3Synapse ready for download!
digimorf
Posts: 74
Finally here it is the first version of my SEGA SC-3000 / SG-1000 emulator for the PropC3 board + C3Synapse expansion.
The Sega SC-3000 system is emulated by the Propeller present in the PropC3 unit and uses the memory space on the expansion memory C3Synapse for the Z80 emulation.
HOW IT'S MADE:
MAIN PROGRAM:
The main program is really simple and is only used to lanuch the three CHIPS. There are few shared locations of the memory that are used to exchange data between the CHIPS ( when the Z80 access the I/O ports with in and out instructions. In this way every CHIP has its own interface to the Z80 that "wakes up" the CHIP to listen to the BUS when its address is called by the Z80.
Z80:
This is the customized version of the zq80 program by Pulmoll http://forums.parallax.com/showthread.php?121579-qZ80-the-third-shot&highlight=qz80
The Z80 uses the SRAM memory space of the C3Synapse as fast as possible. In order to do that I had to make a customized version of the qz80 by Pullmoll.
VDP:
This is the TMS9928 driver that I'm developing. The actual version is completely in Assembly and has the IO interface embedded. It uses 16Kb of shared memory as fast VRAM.
PSG:
This is the SN76489 driver used by my VGM music player. It has been updated and the length of the code reduced to save memory for the emulator. Actually there is the stable version of the SN76489 available in the OBEX section of the Parallax site:http://obex.parallax.com/objects/891/
MEMORY:
The shared memory of the Propeller is used to store the code of the Z80, SN76489 and the TMS9918. This portion of memory is about 14~16 KB. The remaining 16KB are used by the TMS9918 as VRAM because the access to the Shared memory is fast enough to let the internal tile engine to drive the TV out driver. The memory space of the Z80 whish goes from memory location 0x0 to 0xFFFF ( 64KB ) is stored 0into the C3Synapse. Actually the SEGA SC-3000 uses the ROM memory which usually goes from 0x0 to 0x7FFF, 32KB, but there are few game cartridges that are even 40KB. The RAM is mapped starting from 0xC000, and is mirrored in banks of 2KB.
For simplicity in this version of the emulator I used a full memory range from 0 to 64KB and the memory mapper program actually is really simple and has been embedded in the code of Z80.
Potentially a different memory mapper can be configured to use a banked memory system like the one used by MSX systems, because you can use 512KB of the Synapse.In my experience the only differences between the SC-3000 and the MSX ( which are the PSG and the memory mapper ) can be implemented here, but probably the code of the TMS9918 and of the Z80 should be reduced a bit to make the memory mapper fit in the shared memory of the Propeller.
In the future I will upgrade the boot loader to chose and launch the games, but now the loader loads the game ROM from the SD Card into the Synapse, then it boots the PropC3 from the SD card with the file SC-3000.bin ( which is the emulator itself ). After the boot the emulator starts the game.
GAMES SUPPORTED:
This is the list of the fully playable games that are supported so far:
- EXERION
- STAR FORCE
- CHOP LIFTER
- STAR JACKER
- NINJA PRINCESS
- PACAR
- CHAMPION BOXING
- HOME MAHJONG
- SUPER MAHJONG
- CHAMPION TENNIS
- GOLGO13
- SPACE ARMOR
- TOORUKUN
- ZIPPY RACE
- CHALLENGE DERBY
- CHAMPION WRESTLING
- SPACE MOUNTAIN
- WONDER BOY
- ZOOM909
- CHAMPION HOCKEY
- FLICKY
- SPACE INVADERS
- OTHELLO ( Reversi )
- GUZZLER
- CASTLE
- DRAGON WANG
- PACHINKO 2
- C_SO!
- SEGA FLIPPER
- CHAMPION GOLF
- SUPER TANK
- SOUKOBAN
- CONGOBONGO
- GIRL'S GARDEN
- LODERUNNER
- MONACO GP
http://www.play-sc-3000.com
WHAT YOU NEED:
1) You need a compatible ATARI/SEGA Joystick, but pay attention that the SEGA Joysticks have two different fire buttons and not only one like the ATARI ones. You can the pinout and the wiring to the C3Synapse inside the main file of the zip archive.
More on the original SEGA Joystick in this page:
http://www.sc-3000.com/index.php/SEGA-SJ-200-Joystick/SEGA-SJ-200-Technical-information.html
If you want you can build one by yourself, the joystick circuit is very simple and you need 6 push buttons and few wires:
The only thing you have to add to this is a little interface with pull up resistors ( 10KOhm ) that connect each signal to the 3.3v terminal on the C3Synapse.
HOW TO USE IT:
- Unzip the zip archive attached to this post.
- Load into the Propeller IDE the main file "SC-3000_Emulator_010.spin".
- Scroll down the program window until you reach the end. You will see a list of games that are commented. Chose a game and uncomment its line.
- Press F11 to compile and upload the program into the PropC3.
- PLAY and ENJOY !
The source code will be soon available on the website: http://www.c3emulation.com
The playable emulator is here:
Comments
Awesome, brilliant, fantastic!
Having put some effort into z80 emulation myself I can really appreciate this.
I hope pullmoll is still lurking around to see this.
Looks like the speed is ok. I've wondered at times whether we could merge the caching code from the GCC project with the Z80 emulation. It could run faster if you needed this.
What games have you got so far?
I have to move down to the south coast soon and there have been yet more cries of "Get rid of all that junk!" from the Harpie. The couple of, real, Z80s have survived though.
Alan
Well done.
Actually a good percentage of the games released by SEGA for the SG-1000/SC-3000 are fully playable. I have updated the first post with the list of games actually supported
You can get some information about SG-1000/SC-3000 games here also:
http://www.smspower.org/Games/Index?sid=8de5248927fea22ceeb59d06ed45f9ae
Happy Easter to everybody!
Sega SC-3000 Hardware Notes (2004/07/29)
Andre'
Jeff
Thanks. Actually the emulator itself occupies almost 14KB ! Even if I'm sure that the code can be optimized more, I think it's interesting to give it a try
Good! Let me know what you think about it! I'm sure that this emulator can grow up more, because it could be the base to emulate COLECO Vision also.
Then with a little more effort it can emulate MSX1 and SEGA Master System platforms.
Probably the code could use the C3Synapse memory space with an efficient LMM system, and maybe when the GCC will fully support the C3Synapse this emulator can be easily ported in C++. Actually the drivers are coded in PASM of course.
so if the speed is reasonable the emulator could be ported to c++. In your opinion it is bettr to run tv drivers in spin or should be ported to c++ ?