The TI-99/4A Master Title Screen on a VGA LCD monitor

Development Journal Index:

F18A stands for “FPGA TMS9918A” (hence the project’s title) and will be 100% hardware and pin compatible replacement for a TMS9918A VDP (video display processor).  I started this project for a few reasons:

  • For some reason, I have always wanted to make my own video card
  • I have an emotional attachment to the TI-99/4A Home Computer (since it was my first computer)
  • I wanted to be able to use a standard VGA monitor with my 99/4A instead of a TV or composite monitor
  • I wanted to get into, and learn about, FPGAs and an HDL (hardware description language)
  • I always wanted to make my own integrated circuits (chips) and understand how they work on the inside
  • There are some things about the TMS9918A that I wanted to fix

The initial goals were lofty and I have since trimmed them back to something I can accomplish in a decent amount of time (1 year or so and still balance life, family, kids, etc.)  I also just started documenting this project after working on it for about 5 or 6 months, so I’ll be making “catch up” posts for a while.

After having worked on the design for about 4 months, these are the goals that I think I can manage in the 1.0 version:

  • Be pin compatible with the original TMS9918A VDP, i.e. a direct replacement in any existing computer
  • Be 100% compatible in functionality
  • Support standard VGA monitors (currently 640×480, but the final 1.0 will run at 800×600)
  • Add a 9938 compatible 80-column mode
  • Add a few additional video resolutions to better support remaking arcade games
  • Increase the color palette to 512 colors
  • Remove the “access window” limitations for full-on high speed access to VDP RAM all the time
  • Increase VDP RAM to at least 512K, but probably 1MB in the end
  • Allow all 32 sprites on a single horizontal scan line
  • Add flags to flip sprites horizontally and vertically

Some additional features I’m kicking around are:

  • Support a dedicated hardware mouse and USB/PS2 keyboard
  • Provide a single-cycle 32-bit Mersenne Twister random number generator
  • Dual-screen output (great for 2-player head-to-head games)
  • Add horizontal and vertical scroll registers
  • Provide hardware support for virtual screens with scrollable playfields
  • A true bitmap layer
  • Enhanced tile-map that supports larger pattern tables, colors, flip x and y, etc.

Some of these extra features appeared in the later Yamaha 9938, 9958, and 9990 VDPs.  However the Yamaha chips are rare and details / documentation has proven very hard to find.  Some of the features, like the Mersenne Twister are on the list because the VHDL to add that support is already available as an open source project and all I would have to do it tie it into the VDP.  Generating random numbers on an older computer is a hard and time consuming task, but the FPGA could generated a new 32-bit RNG every clock cycle.

Something else I need to point out is that I’m running the FPGA at 100MHz, so I have the luxury of adding enhancements that the original chip simply can not do, like displaying all 32 sprites on the same line, and removing the VDP “access window” problem.  This has great potential for new games, as well as eliminating sprite flicker in existing games.

Since this introduction post is 5 months over due, I’ll list here what I have working so far:

  • Original 256×192 displayed in 2x (512×384) on a 640×480 VGA monitor
  • All 4 video modes: Graphics I, Graphics II, Multicolor, Text
  • 512 color palette
  • Full speed CPU interface (no delays due to access windows)
  • 16K VDP RAM using the FPGA’s block RAM
  • Physical drop-in replacement (via a socket) of the original 9918A

The list of things to complete before I think v1.0 is ready:

  • Implement sprites
  • Add undocumented hybrid graphic modes
  • Add the 9938 compatible 80-column mode
  • Change VRAM to use an external SRAM instead of the FPGA’s block RAM
  • Change to 800×600 base resolution instead of 640×480
  • Design, order, and build the prototype circuit board

Progress was moving along pretty good until the summer months and life got busy again.  I hope to get moving on this list soon!

Last I want to mention that an important aspect of this project is compatibility and availability.  Even though I’m doing this first and foremost for myself, I would like to think that other people with interest in systems like the 99/4A, ColecoVision, and MSX1 would also have a large interest in having this hardware available.  I intend to make this project compatible with existing systems, and I intent to make it readily available to those who want it, i.e. you won’t have to hope and pray for one to “pop up” on ebay.

 

 

Testing the F18A on an MSX1

 

MSX1 BASIC on the F18A

 

MSX diskview running in 40-column mode

 

MSX diskview running in forced 80-column mode

Tagged on:                     

42 thoughts on “F18A – FPGA Based TMS9918A

  • September 18, 2010 at 3:30 pm
    Permalink

    With a name like F18A, perhaps it should be named Hornet? :) It’ll be nice to have a VDP that’s 100% compatible with all existing TI-99/4A software, with fixes for some of the problems. Hopefully none of the fixes will break any software. There always seems to be some program that relies on a not officially documented “feature” that’s actually a design flaw. See what happened with the Z-80 CPU when Zilog got around to releasing a completely debugged version. The next revision had the old bugs put back in because many programs relied on them.

    Reply
    • September 18, 2010 at 5:55 pm
      Permalink

      My plan is to at least be 100% hardware compatible with the 9918A, including as many undocumented “features” and functionality that I can find. I don’t think the F18A will break any software, but once I get the sprites implemented I can really begin testing. One of the nice things about using an FPGA is that if a bug or undocumented feature is found down the road, I can put out an update for the hardware.

      Matthew

      Reply
  • November 6, 2010 at 4:18 pm
    Permalink

    Hi,

    Great project! there is a lot of info available about the Yamaha 9938, 9958, and 9990 VDP’s, because they were heavily used on the MSX system. There are application manuals and other documents available, and also emulators which have the behaviour implemented (e.g. openMSX, blueMSX) and there is even a VHDL implementation of the V9938 in the 1chipMSX.

    Also, note that on the MSX, some programs actually make use of the ‘shortcomings’, like the 4-sprites-per-line limitation. An example is The Maze of Galious (by Konami), where it is used to hide part of the player sprite when entering a shine.

    So, please take this info into account: it might be a good idea to make some features actually compatible with the Yamaha VDP’s, and have the ‘old’ behaviour still on board for software that (ab)uses it! :)

    Good luck! If you need more info about the VDP’s, please post on http://www.msx.org/

    Reply
  • December 4, 2010 at 8:15 pm
    Permalink

    When this becomes available, I hope to outfit both my TI-99s with it. The PEB-based console and the CF7-based console as well. With my CF7, I now have over 500 DSKs stored on a 512MB card, and the ability to have VGA compatibility… well, that’s just about as awesome as I can imagine. Thanks for your efforts, Matthew. And I like how your site is developing.

    Reply
    • May 23, 2011 at 2:50 pm
      Permalink

      100% compatible. The 9928A is the same chip as the 9918A except the 9928A outputs Pb,Pr,Y instead of composite. Other than those differences, internally the 9918A, 9928A, and 9929A are identical, and since the F18A generates its own output (which is the main function of the whole project), those 3 different output pins don’t matter. The F18A *does not* drive the original output pins, it outputs 640×480 VGA via a header on the F18A board.

      To date I have tested the F18A in a 99/4A, Toshiba HX-10 (MSX1 system), ColecoVision (which uses the 9928A), and a Spectravideo-328.

      Reply
  • June 1, 2011 at 2:33 pm
    Permalink

    more than great! realy idea when product is ready? what it will cost to buy one? 10?

    Reply
    • June 1, 2011 at 2:44 pm
      Permalink

      I’m currently in a second round of prototype boards. I’m expecting them soon, then testing. If I don’t find any problems (again), I will have the first batch manufactured.

      As for cost, I’m not sure what you mean by “10”, but the FPGA alone costs $13 in quantity of 100… I’m hoping the price will be between $80 and $100 USD, but I don’t know for sure until my design is finalized and the quotes come back from the board houses.

      Reply
  • June 5, 2011 at 5:21 am
    Permalink

    Great work, Matthew! Im also into working with both retro-platforms on FPGA’s and other nice hacks yout can do with FPGA’s. Im’ currently owner of Spartan-3 Starter Kit 200K and a Microblaze Starter Kit (Spartan 3-E 1600E). I’ve also developed a add-on board to extend both boards with usable extra ports as: Simple PWM Stereo-sound output, 12-bit VGA-output, Atari Joystick input, SD-Card socket, MINI-input. The first computer I tinkered with at home was my brother’s TI 99/4A so it would be nice to get one going completely inside an FPGA. Have you release the code for the Video-chip or will you release it?

    Reply
    • June 5, 2011 at 3:50 pm
      Permalink

      Cool. Do you have a website up somewhere with any details on these projects? As for the source, I have not thought about it too much, I’m just trying to get everything working and the boards built. I plan on releasing it at some point, but I’m not exactly sure when that will be.

      I thought for sure that *someone* would have done the 99/4A in an FPGA by now, but apparently it takes the right mix of a large user base and someone in the community who knows enough about FPGA development to pull it all together. At this point I guess that will be me, but I was sure it would have been done already. In fact, I was talking about it back in 2005 (before I knew and HDL or even had my devboard) when the Jeri Ellsworth did the C64 on a chip.

      Reply
  • June 28, 2011 at 3:27 am
    Permalink

    WOW! This is just what the doctor ordered. I have the same emotional attachment to my TI as most. My system is very enhanced, PS2 keyboard, dual ramdisks and a 9958 enhanced video board (TIM). All the software I use on the system is optimized for the 80 column output. About 4 years ago the Magnavox RGB monitor I was using failed for the last time and brought my TI hobby to a total standstill. I’ve considered selling what I have on eBay but I just can’t bring myself to do it. So I keep watching for a solution that would get me back up and running on a standard PC monitor as I have lots of those. The trouble has always been to find a way to convert the RGB out from the TIM to VGA. That was on the assumption that I’d be keeping the TIM but if this project is a drop in replacement for the 9918 (which is how TIM works) and it outputs standard VGA/SVGA – problem solved. Ditch the TIM, drop this in its place and I have my old TI back with the 80 column display!
    What is the latest on this project and are you selling boards yet? The price range quoted is totally acceptable to me.

    Reply
    • June 28, 2011 at 1:52 pm
      Permalink

      Your setup sounds pretty cool! You should check out the TI-99/4A section of the AtariAge forums! We are always looking for more TIers over there.

      As for the 80-column mode, I’m not sure if things will work out. The 9938 has an additional “mode” pin to the CPU interface which implements the “indirect” register access, and access to the palette registers. I can not support that functionality due to the physical nature of the 9918A’s connections to the host system. We’ll see how it goes, but there are a lot of “ifs”.

      The price is not yet determined since I’m still making board-level changes and working out a few quirks. However, it will be as inexpensive as possible.

      Reply
  • August 18, 2011 at 5:03 am
    Permalink

    Still looking forward to sticking this project inside of my MSX

    have you finalised the featureset yet or is there room on the FPGA for more?

    (discomeats from #msxdev)

    Reply
    • August 18, 2011 at 9:16 am
      Permalink

      Summer time kind of slowed things down, but I’m plugging away at it. I really need to get more updates posted. There is actually a lot of room left in the FPGA and it will probably be far from totally utilized when I finalize the HDL (and that’s killing me.) I’m pretty sure I have decided the features and there is not much left to do, I just have to get it done. For a while it was board revisions that was slowing things down, now it is just carving out the time to finish the loose ends.

      Reply
      • August 18, 2011 at 11:48 am
        Permalink

        Is there a list of features somewhere? as there are some that the 9918 desparately needs, some that the 9938/58 could use too :)

        Reply
        • August 18, 2011 at 12:10 pm
          Permalink

          The list above of features I wanted to have working for v1.0 is pretty close. I’ll get an update posted with a list of what works, and what will finally be in the v1.0.

          Reply
  • January 3, 2012 at 3:19 pm
    Permalink

    Looks interesting. How is it coming along?

    I’m wondering if the VHDL for the T80, F18A (with VGA output), sound chip, misc logic for address and I/O decode, SRAM, etc… could be put on one of those FPGA prototyping boards (eg: Altera) so as to recreate the Memotech MTX512 in a single chip. Its a bit like MSX, but with different sound chip and, port map and memory map. Someone else considered a similar idea using a fake V9938, but I guess that would use a lot more gates and memory. So the question of how many gates F18A will require when ready and when synthesized arises. Your best guess sir?

    Also the earlier point about programs relying on the 4 sprites in a line limitation is true (I did this in more than one of my games back in 1984). I also was a victim of it in other games I wrote.

    As for undocumented stuff, I saw a page which described some stuff, but my experience was a little different to the page, so I’ll share it here:
    In graphics mode 2, certain register bits were supposed to always be 1, but…
    if bit 0 of register 4 is clear, 2nd third of the screen uses the pattern generator from the 1st third.
    If bit 1 of register 4 is clear, 3rd third uses pattern generator of 1st.
    If bit 5 of register 3 is clear, 2nd third uses pattern colour table from 1st.
    If bit 6 of register 3 is clear, 3rd third uses pattern colour table from 1st.
    Maybe the chip designers were trying to support a graphics mode 2 which used less VRAM.

    Do you support 50Hz frame rate as well as 60Hz?

    {{{ Andy

    Reply
    • January 4, 2012 at 10:21 am
      Permalink

      It is coming… The original functionality is done and the physical board design is stable, but my feature list keeps growing and I keep adding stuff. I don’t really have a good way to update the board once it is installed in a system, so I’m trying to make sure it is as close to bug-free as possible before I release it into the wild. A foreign concept these days, I know.

      Absolutely you could take a bunch of “cores” (HDL code for various components like CPUs, sound ICs, etc.) and combine them in to a SoC. The Terasic DE1 or DE2 would be a really good platform to do such a thing. The “One Chip MSX” project did pretty much that, except it had a custom (although open source) board design. An FPGA is a really good platform to explore making your own SoC, and not to terribly difficult once you get the hang of it.

      The F18A core is about 20% of a Spartan3E-250K FPGA. Xilinx measures their chips in “gates”, and Altera measures in “logic elements” (LEs), so it is hard to compare. Also, the “gate usage” is loosely representative of a core’s requirements since there are other FPGA resources that may be required for which there are fewer available, i.e. block RAM, clock managers, etc. The F18A uses 25% of the DSMs (digital clock managers (there are 4 on the chip)) and 100% of the block RAM on the 250K chip, but only about 20% of the CLBs (configurable logic blocks) which consists of various resources like LUTs (look up tables), flip-flops, MUXs, etc. So it is really hard to say what is required for a “core” without synthesizing on a specific device. However, I have added features, so the original 9918A functionality would be less than my current core.

      Thanks for the info on those bits. I’ll have to make sure my design would act the same way. I have not looked at that part of the design in a while.

      Nope, no 50Hz. The output of the F18A is 640×480@60Hz “VGA”, which thankfully is pretty much universal, unlike broadcast television signals. Since I’m not putting out NTSC or PAL video, the only other signal that was affected by the 50/60Hz difference was the interrupt. The interrupt is inherently tied to the video refresh, and the system and software expects the monitor to be in refresh when the interrupt comes in, so I can’t have a 50Hz interrupt and 60Hz refresh or there would be all kinds of problems. Also, modern “VGA” monitors do not support 50Hz so it would not be possible anyway. If someone needs 50Hz, the original 9929A could do that just fine. :-)

      Reply
  • January 4, 2012 at 6:22 pm
    Permalink

    Thanks for the update.

    Runnng at 60Hz frame rate may not be an issue.
    Game logic may have less time between frames, but T80 can run a lot faster that Z80A ever did.
    But the games will get 20% faster…

    Ordered Altera DE1.
    Will start to learn VHDL…
    Will also go hunting for the other major chip VHDL code I need…

    {{{ Andy

    Reply
  • February 11, 2012 at 3:41 pm
    Permalink

    Very interesting project.
    I collaborate with my opinion on this topic.
    People look for games with better graphics, but the developers we find the problems limiting the sprites, graphics (Attribute clash) and CPU speed.
    The use of tiles as chart 1, is very useful, but it is very difficult to make soft scroll through. Luckily improved in the following models of VDP (vertical and horizontal in the V9958 V9938), but few users have computers with the V9958.
    The idea of ​​adding the palette of the V9938 and improved sprites, I feel great.
    If you could add colorful sprites and scrolling, so it’s very good! :)
    and if you create a graphic mode with a only single bank of tiles, with a color to each pixel, then it would be amazing! :D
    Anything that allows to simplify the work of software developers, will allow them to create more software.
    Thank you!

    Reply
    • February 11, 2012 at 4:50 pm
      Permalink

      Thanks for the comments. Actually, the F18A does add color enhancements to the tiles and sprites. I have not updated my website in a while, I should probably do that soon.

      Reply
  • February 12, 2012 at 5:48 pm
    Permalink

    Looks like a potential great product

    You could consider adding the Sega Master System mode 4 to your FGPA implementation. The Sega VDP has backwards compatibility witht the TMS chip, but with an added mode that support 16 per sprite and 16 colors for the background (those can be different palettes and can smooth scroll in all directions.

    Supersoniqs, http://www.supersoniqs.com made two videocards for the MSX system. Those two cards both contain the SMS VDP.

    This manual explains the SMS mode 4: http://supersoniqs.files.wordpress.com/2009/11/franky-9.pdf
    (based on work from smspower.org, used with permission)

    Supersoniqs also made software to convert sms games to work on a MSX with the Sega VDP card installed.

    The only thing the SMS VDP lacks, is a proper color pallette for MSX1 screen modes. The colors of the SMS VDP look a bit different in the MSX1 modes compared to the real TMS chips. But you could solve that ;-)

    Reply
    • February 12, 2012 at 8:01 pm
      Permalink

      Thanks for the info, it looks interesting and I’ll have a look for sure, but at this point I’m not ready to start any new projects. I think I have read a little about the SMS, but I didn’t think it was *that* compatible?

      Reply
  • February 13, 2012 at 5:57 am
    Permalink

    Check http://www.youtube.com/watch?v=CnsLWkhikUs: MSX games running on the Sega VDP from 2:38 onwards.

    From the Franky manual (page 19):

    Display modes
    The TMS9918 has three bits which select different display modes called M1, M2, and M3. However, only four combinations of these bits are documented in the TMS9918 manual:
    The other four undocumented modes are simply variations of the above, they are no unique. The SMS VDP added another mode select bit that enabled mode 4, which is specific to the SMS. The 5246 changed the function of the TMS9918 mode select bits to pick different resolutions for a standard mode 4 screen.

    Reply
  • Pingback: F18A un nuevo VDP para MSX : MSXBlog de Konamito

  • July 16, 2012 at 3:05 pm
    Permalink

    Thank you for interest upgrade. Now I can plug my European TI 99/4a in VGA monitor. Thank you very much.

    Reply
  • July 17, 2012 at 3:09 pm
    Permalink

    Matthew, have you consider producing CF7+. I think people who have TI 99/4a at home will be happy to know someone is producing CF7+.

    Greetings from Croatia!

    Reply
    • July 18, 2012 at 12:12 pm
      Permalink

      The CF7+ is not my project, and as far as I know the person who made the CF7+ has not released any of the technical information.

      Reply
      • July 18, 2012 at 4:43 pm
        Permalink

        I was hoping that you can make similar project something like CF7+ but with more memory, hard disk, 3.5 floppy….. Something like better PEB.

        Reply
        • July 18, 2012 at 5:15 pm
          Permalink

          Wow, that would be quite a project. The F18A has taken me two years to get to this point, so I probably would not be starting something like that for a while. I could do some of the prototyping, but someone else needs to step up to mass produce them and sell them.

          I probably would not do any kind of physical drive support, i.e. floppy or hard disk, since that kind of controller is very complex and the physical drives are getting hard to acquire.

          I would probably do something along the lines of a 99/4A SoC in an FPGA, or something similar to the CF7+ but using the more common USB-drives instead of Compact Flash cards and some sort of standard memory paging.

          But anything like that is a long way off for me.

          Reply
          • July 19, 2012 at 4:03 pm
            Permalink

            Thank you very much for information!

  • September 8, 2012 at 12:14 pm
    Permalink

    I posted here around 8 months ago (#19,#21).
    In the end I also implemented something approximating a 9918 in VHDL, as a part of a complete re-implementation of a retro computer in an FPGA.

    Since then I’ve stumbled on a thing called a GODIL, a mini-FPGA board with a XC3S500E which can have a 40-pin DIL connector, bus-switches to deal with the 5V on the board verses 3.3V for the FPGA, and a few other pins, from which it wouldn’t be unreasonable to add an IC to clean up the signal, voltage dividing resistors and a VGA connector.
    The FPGA even has enough BRAM to cover the 16KB VRAM requirement.
    If I were hypothetically to try to build a plug-in replacement for a plain-old 9918, which drove VGA, I’d consider starting from this.

    {{{ Andy

    Reply
  • November 23, 2012 at 6:00 am
    Permalink

    Matthew is it possible that F18A change behavior of the call coinc in XB? I ask you that because I tryed 2 games Pongo and Rain game (they are in Gamebase) and this games don’t work as they should. In Pongo computer detected something and it lose all lives, same is in Rain gag when you have to go to hanger after you catch all rain. This games work normal in classic99 and on TI99/4a with regular 9918a chip.
    When I analise problem I found that command call coinc detect crash.
    Please help! I describe same problem in Atari age.

    Reply
    • November 23, 2012 at 11:41 am
      Permalink

      Try removing the USR1 jumper and try the games. My only thought is that it has something to do with the F18A’s ability to display all 32 sprites on a line vs the 9918A’s 4-sprite per line limitation. With USR1 off the F18A will have the same 4-sprite limit as the 9918A.

      Reply
      • November 23, 2012 at 1:48 pm
        Permalink

        Problem is same. Can you test this games?

        Reply
      • November 23, 2012 at 3:15 pm
        Permalink

        I put example in atari age. I try jumper but problem is same.

        Reply
  • Pingback: Episódio 38 – Periféricos novos para micros clássicos II – Parte B | Retrocomputaria

  • Pingback: TurboForth para TI-99 | Retrocomputaria Plus

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">