TEXAS INSTRUMENTS - TMS9918/9928 VDP Emulation on Propeller
digimorf
Posts: 74
Since I'm working on this chip emulation for the project of emulating SEGA SC-3000 / SG-1000 system on Propeller, I've decided to start a specific thread on it.
This will let everybody to find out useful information on one place.
I will update this thread with the work in progress of this driver written in SPIN/ASM, with all docs/video related to this Processor, and possible use and implementation on actual propeller powered board, especially the PROP C3.
I hope you will like this Idea
This will let everybody to find out useful information on one place.
I will update this thread with the work in progress of this driver written in SPIN/ASM, with all docs/video related to this Processor, and possible use and implementation on actual propeller powered board, especially the PROP C3.
I hope you will like this Idea
Comments
Soon I will include some videos made with this driver on my C3 during tests.
These videos were presented in a thread of http://forums.parallax.com/showthread.php?138254-TEXAS-INSTRUMENTS-TMS9918-9928-VDP-Emulation-on-Propeller forum, under Texas Ti 99/4a section.
Since also this system uses this VDP all information you can find here are all useful
Enjoy.
You already have seen this on the other thread, but I suggest you to have a try with this game on my MSX emulator. You will see some techniques the programmers used to solve some problems, and even if not so much spirtes have been used, programmers have "played" a lot with color cycling effects, and tile animations.The use of colors in this game is really great!
http://www.digimorf.com/ASReplay_MSX - Actionscript MSX 1 emulator
Enjoy!
tricky to get working on the Propeller with the limited code space and processing power. This is an achievement!!
Keep up the good work digimorf.
Having optimized in pasm until my fingers bleed myself, I know that those 20 mips per cog is A LOT more than your average AVR or PIC with 20 mips.
The Propeller has got an extremely flexible instruction set and can do some things that require a lot of instruction on other MCUs with a single instruction.
Combine that with the very flexible way of handling z and c flags and conditional execution per instruction..... OOOOh, how I LOVE the Propeller!
The biggest let down is of course the missing mul and div instructions.... Because of that fact, for SOME applications a 20 mips AVR or PIC will drive circles around the Prop. Not even multiple cogs will help for these kind of applications.
/Johannes
Good work digimorf!
Johannes, has anyone here barked for a Prop 1.5 with just mul/div... oh boy could we (well really "you") do some neat audio with that!
I'm sitting here in awe of what digimorf has accomplished.. I can't wait to try out some of these myself.
OBC
I've been somewhat busy, but I really like this stuff! Great work so far.
I know you are curious to see some steps ahead... so I decided to share the code I've done until now.
I would be very glad to see some evolution of this code especially in conjunction with the ZiCog or the qZ80
The VRAM of 16K resides on the HUB memory. The eventual Z80 can have it's memory space in the Synapse o whatever SRAM expansion board. The more space in the SRAM the better because you can implement also some memory mapper used for example in MSX or SEGA MASTER SYSTEM titles.
Actually there are three video mode implememnted:
Text video
Tile Gfx I
Tile GFX II
The multi color mode is a USELESS video mode and I've never seen it used anywhere.
Sprites are rendered, but speed is a problem: If the sprite table hasn't many sprites they are rendered correctly.
You need a C3 ( but you can adapt to any Propeller board ) and a TV NTSC monitor.
The main program in this example will load a memory dump with its corresponding register configurations. And then starts the driver.
I ave included some memory dumps for each video mode. Some taken from SEGA SC-3000 games some other from MSX games. If you compile this as is, you will see a memory snapshot of the game NEMESIS II for MSX.
I know that I can optimize it much more, but I like the idea to start some nice work with you all I am sorry that the code is not so much commented, but I think that many of you will find it useful... And we can start discuss about the techniques used.
Maybe when this will became more stable I will put it in the OBEX.
TMS9928_Emulator.zip
you are right, there are few titles. Thanks for the correction :P
In my Actionscript emulators ( MSX, SG-1000, Colecovision, Sega Master System ) I didn't used that video mode. I saw that there were a lot of games that used the gfx I and gfx II mode. So I haven't spent time in that. But sooner or later I will do it for this driver. It should be simple.
Anyone have tried that ? Comments ? Suggestions ?
Is there any goal with this emulator to include the chip's programming language?
The Propeller chip is up around 200 languages and versions that it can run.
http://humanoidolabs.blogspot.tw/2012/03/ultimate-list-of-big-brain-languages.html
My hands are full with the Propeller Elf II emulator project.
This will have a Tom Pittman Tiny Basic emulated programming language
specifically tailored for running on the Propeller chip.
http://humanoidolabs.blogspot.tw/2012/03/propeller-elf-ii.html
Well This chip hasn't a particular language. It interfaces with a Microchip by a DATA bus and other lines...
Basically a processor handles commnication with it through I/O ports.
You have 8 registers to set for configuring all tables in it's 16k of VRAM, for setting up video modes, colors, sprites mode etc...
thwen you can transfer data to it's VRAM with a sequential access.
You can start with the TMS Datasheet that explains how to use it.
This chip was used in many systems such as MSX, SEGA, COLECOVISION, ARCADES... So on the WEB there are a lot of tutorials and documents about it.
You will find a lot of material
Uhm... the destinartion register for the instruction at jump label is replaced by the index of the video mode setup. so when the jmpret take place it should store the actual program location+1 into the back variable. (This instruction is like the CALL butr you can manage the destination and the back pointers separately. Right ?)
Then in the render_mode0 I have a "ret" instruction at the end, that should point the program pointer to the location number stored in the "back" variable. It shouldn't be #0...
My intention was to create an indexed jump table, driven by the videomode variable when the renderer is started by the VDP driver..
Maybe this "jump" section can be optimized or written in some other way
Acall #L is equivalent to jmpret L_ret, #L, it's an assembly time thing
When I will have time I will probably fix here and there and speed up a bit all the routines.
Sprite handling for example still has to be optimized to support full 32 sprites without degradation.
In this period I'm quite busy but I will post some little demo for showing how sprites are managed in the Sprite Attributes Table, and how are rendered.
But I am very interested in seeing this project going. Have there been any updates on it?
There is an FPGA version of the 9918 (F18A) but having the 9918 run in the prop would be awesome.
As far as I'm concerned, running all 8 cogs for better emulation would be awesome. I'd like to think there is a replacement for that vintage hardware that worry about having to save a cog or two. :-)
Oh, and the sprite limit was 4 per scanline with the 5 sprite bit set if it tried to put a 5th sprite (or more) on the same scanline. But it only showed 4 (IIRC).
The F18A has the ability to show all 32 sprites on the same scanline. This would be an awesome enhancement as well.
Thanks!