• Improving the Graphics Gremlin project

    02/05/2023 at 15:05 0 comments

    The Graphics Gremlin is an FPGA-based ISA video card specifically designed to emulate certain old video standards. In a first version, the author developed the implementation of the original IBM PC monochrome graphics adapter (MDA) as well as the original IBM colour graphics adapter (CGA).

    Already a year ago, I started the development of a PCXT core port for MiSTerFPGA, the repository of this project is here. It is mainly based on the projects KFPC-XT by kitune-san, MCL86 by MicroCoreLabs and Graphics Gremlin by TubeTime. Although initially the idea was to focus the core development on the PCXT, I soon saw the opportunity to offer the Tandy 1000 implementation in addition.

    At the time, Graphics Gremlin had a partial implementation of Tandy Graphics Card (TGA), only 320x200x16 mode and 32Kb of video memory. Many things were missing, like the rest of the modes, 128Kb of video memory, paging, access to I/O ports, etc...

    Time passed, and I decided to start the development of all these elements, but I focused the work on their use in MiSTerFPGA, here I show the final result of the improvement process:


    Subsequently, I decided to revise and improve MDA, upgrading it to Hercules Graphics Card (HGC), although not without some problems, still pending revision:

    Finally, I have decided to move all these improvements to the original Graphics Gremlin project, now available in this GitHub fork (I've already suggested a pull request to the main developer), it is now works:

    As can be seen, use is made of the original Tandy 1000 BIOS, version 01.01.00. The idea is to be able to use it in a PCXT machine, like the Micro8088 by Sergey Kiselev, or the NuXT motherboard by Monotech PCs, based on the latter. However, it has not been without its difficulties, which I have had to overcome.

    First of all, the keyboard initially does not work after starting the Tandy BIOS. This is because the BIOS initialises bit 6 of the PORTB register of the PPI to 0, which keeps the keyboard clock line low:

    To solve this, I have created a small executable called TDYKBD.COM, whose function is to enable the bit, and which must be run in AUTOEXEC.BAT itself. There is a small drawback with this, and that is that during BIOS boot, until it loads, the keyboard will not work.

    Secondly, in order to have the maximum compatibility, both in PCXT and Tandy 1000, for the access to the new I/O ports of Tandy register control, page access, etc... I have added a new I/O port with address 370h, to enable and disable it. For this, I have created another application called TDYVIDEO.COM and CGAVIDEO.COM, both must be executed after the corresponding BIOS boot, although in principle the CGA one will not be necessary, since by default, when the card is initialised, the access to the Tandy I/O ports will be disabled.

    However, shared main memory with video memory is not possible due to the design of the hardware section. As a consequence, some games and/or applications that make use of it will not display correctly.

    There is another small problem with the keyboard, the scan codes are not adapted to the particularities of Tandy, so first of all, it is important to make use of KEYB in the AUTOEXEC.BAT for the cursors to work... and some games may not recognise them. I have also noticed that some other games, such as the Tandy version of AlleyCat, disable bit 6 of the PORTB of the PPI, and as a consequence, the keyboard stops working. The only solution for this would be to replace the TDYKBD.COM application with a resident program that is permanently checking the status of the bit, and other programs that are not able to recognize the bit. 

    In the future, I plan to port Tandy Sound to Graphics Gremlin, making use of the RCA currently available for composite video, as suggested by the project's author in the project's README.