The Space Invaders TRS-80 'Bootleg' Project

Introduction - Tech Notes - Screen Shots - News - Downloads


In 1978 Midway unleashed a game (actually produced by Taito in Japan) that is arguably the most famous game in arcade history - namely, Space Invaders.  The game should need no further introduction because chances are, if you're reading this page, you used to own a TRS-80 and hence you're old enough to have experienced the phenomena first-hand. And of course you're just as likely to have played many of the various clones of this arcade classic on the TRS-80. My personal favourite was Tandy Invaders as it was known here in Australia.

Space Invaders also has the distinction of perhaps being the most 'bootlegged' game in arcade history (the only other possible contender would be Pacman?!?) A 'bootleg' is an unauthorised copy of the game made by unscrupulous manufacturers in order to cash-in on the success of the game. Bootleggers often reverse-engineered the complete circuit, re-creating the arcade game exactly. Others were cruder efforts, requiring changes made to the game program (ROM) in order to operate on the bootleg hardware. Yet others took the game and adapted it to run on other, existing, arcade boards - these often required significant changes to the program. Some simply changed the graphics to give the appearance of a new game. Some changed the gameplay significantly, in effect creating a 'new' game. But as they say, imitation is a form of flattery!

So what exactly is this Project?

This project is an attempt to 'bootleg' the original Space Invaders arcade game and run it on the TRS-80 Model 4/4P with a suitable (MicroLabs) high-resolution graphics card installed. Note that this is not a re-write (clone) and it is certainly not an emulation. Technically, it is a port, although the porting in this case is minimal. The original software, together with the original graphics, will be running on the TRS-80. The ROM will only be patched to read the TRS-80 keyboard and output to the MicroLabs graphics screen. There will be one or two additional patches to cater for differences between SI and TRS-80 hardware but these will be transparent to the player and will not affect gameplay in any way. You will in effect be playing the original arcade Space Invaders game on your TRS-80.

Note that at this point I will not be attempting to produce any sound on the TRS-80. At a later stage I may implement some sound, though I'm not likely to attempt to re-produce the original arcade sounds. Not knowing too much about sound on the TRS-80, I'm not sure it's even possible.

Technical Notes

The SI hardware is very basic - an 8080 processor with an 8kB ROM, 1kB RAM and 7kB of video RAM. Inputs (player controls, coins) are port-mapped. The only other specialised hardware is a port-mapped 8-bit shifter that is used to generate bit-mapped graphics from the 'characters' stored in the ROM. The one technical obstacle is the difference in interrupts between the 8080 and the Z80, or more correctly, the TRS-80. Although the Z80 is capable of running the same interrupt mode as the 8080 (IM0), the TRS-80 only supports IM1. And SI generates interrupts that vector to RST8 and RST10 at 60Hz each. However, I believe I have a solution that will overcome this problem.

Will SI run on a real TRS-80 Model 4/4P?

That is certainly my goal. Really, I don't see the point in attempting this project if, at the end of the day, it won't run on a real TRS-80. Anything less is purely a software exercise, and there's plenty of emulators on dozens of platforms that allow you to play the original arcade Space Invaders. Update: YES!!!

At worst, it may be necessary to plug in a small device to the I/O Expansion port of your TRS-80 if you want to play Space Invaders on your actual machine. By small device a mean (what will probably amount to) a 555 timer and a few resistors/capacitors. Something to generate a 120Hz pulse on the EXINT line. That's it. However, there is a possibility I may be able to patch the code to run both interrupts from a single 60Hz source (ie. the RTC interrupt).

But, why?

Because I just think it would be cool to be able to play the original arcade Space Invaders on my TRS-80. And what really blows me away is knowing that, all those years ago playing Tandy Invaders, I could've been playing The Real Thing - had I known what I know today! Unlike today's PCs running MAME and XTRS, it's not new technology that's making this possible - it was possible 15-odd years ago!

Besides, I've been in the emulation scene for over 5 years now and I've never seen an attempt to directly run an arcade game on a home computer, or any other platform for that matter. So AFAIK, this project is a first of its kind!

And next?

There were a number of different arcade games produced that ran on the Space Invaders hardware, or slightly modified boards. Examples include Space Invaders Part II and its variants, Sea Wolf, Boot Hill and Lunar Rescue, to name a few. In theory it should be possible to patch these games in the same manner to run on the TRS-80. You can see from the screen shots below, I've already had some success with Lunar Rescue.

I'm mostly interested, however, in getting Pacman to run on the the TRS-80. Pacman runs on different hardware; a 3MHz Z80 with a tiled-based display and 8 hardware sprites, and of course is in colour. However, I do believe that it would be possible to adapt the ROM image for the TRS-80. Time will tell...

Screen Shots

Here's some screenshots of Space Invaders running on xtrs.
The xtrs -scale 1,1 option was used for these images.

Space Invaders Title ScreenSpace Invaders Attract Mode

Note: Lunar Rescue is not currently playable on the TRS-80. These screenshots were created by running the ROM image on a patched xtrs and dumping the arcade display RAM to the TRS-80 hires board on each vblank interrupt.


2nd December 2003

OOPS!!! - Showstopper - somehow over the last few weeks it just never clicked that 32 x 8 does not equal 240. Oh well, this is what I saw when I realised my mistake...

Damn, it would've looked pretty nice, as you can see from the screenshots. Of course, it would fit rotated but who's going to want to sit their Model 4 on its side to play Pacman?
Game Over, Player 1...

1st December 2003

I have modified xtrs to emulate the Pacman hardware, with the TRS-80 60Hz RTC interrupt tickling the Pacman VBLANK interrupt. Pacman passes the ROM/RAM tests and now loops in the attract mode (see screenshots below). In text mode, I can only show the 1st 24 lines of the display so as you can see, the last 8 lines have been truncated. The 2nd screenshot below is actually the maze - you can see where the Pacman has eaten the dots around the top left corner of the maze. Notice also "GAME OVER" near the centre of the maze.

Next task is to import the graphics roms into the TRS-80, convert them to a format suitable for the MicroLabs hires board, and write some basic 'tilemap' routines. There won't be a screen rotation issue this time because the graphics are static tiles and will have to be converted to monochrome anyway, so the rotation will be done then. Then I can hook them into my screen dump routine and it should look like the real thing!

Note: Pacman is 36 tiles (288 pixels) high, whereas the TRS-80 is only 240 pixels. Also, it has a really strange video memory map - the top and bottom two lines of the screen map completely differently to the rest of the screen! This actually turns out well for us, because the extra 4 lines are only used for score, credits and bonus display. So I'll be able to move the top and bottom text across to one side of the screen, as is often seen on console ports of arcade games, without affecting the playfield area at all!

27th November 2003

Final word and schematic on SI still pending...

Have started to disassemble PACMAN! This is going to be a whole new kettle of fish - the code itself is heavily data-driven, there's whole sections which I don't think I'll ever be able to decode. The screen is also updated in a myriad of places. Doesn't bode well for porting to the TRS-80 - or at least not in the same fashion as SI.

But the good news is that I've done enough to work out the basic structure of the code and the hardware - and I think I can get the ROM running at the very least. As far as I can tell, there's effectively a single 60Hz interrupt. This game is tile- and sprite-based, as opposed to bitmap-based like SI, so the approach will be somewhat different. However, I've mentally mapped out how this would possibly work on the TRS-80 and I believe that it would be possible to see the game running - if not play it! FWIW I've actually ripped the tiles, sprites and the 'maze map' from the ROM and implemented a basic clone on the PC, so I'm familiar with some of the inner workings from that perspective as well.

As I don't see much merit in attempting to complete the disassembly, I've probably done enough now that I can start on getting the ROM running under xtrs. Stay tuned!

1st November 2003

Hmm... I've put together a circuit that generates ~120Hz pulse about 50us wide. The text on the attract mode seems to run at the correct speed - but starting a game flashes the player score extremely slowly. The game appears to run at about 50% as well. This does not bode well. Either my pulse width is wrong or, as I suspect, the Z80 does not latch the external interrupts and some are being missed whilst the graphics routines have disabled interrupts. I will probably have to generate a signal on the EXTIO bus in my ISR and see what is happening on the CRO... all  a pain BTW because there's no power coming off the TRS-80 EXTIO bus.

A colleague also suggested it might be a lot easier just to use a PIC (e.g. 12C508) which, using the internal oscillator, is a single-chip solution. Doh!

25th October 2003

It works!!! The original arcade Space Invaders at 100% on the TRS-80 Model 4P!

Well, close enough for starters, anyway. Connected up my function generator with a 120Hz square wave but can't adjust the duty cycle down enough to get a short enough pulse width. So I'm getting multiple interrupts firing - but the game is holding up very nicely indeed. It "plays" at about 100% regardless, and no graphics or logic glitches at all. Once I've built a simple pulse generator it should play flawlessly at full speed.

In the next few days I'll upload the final binary, the interrupt generation schematic, and all my development tools, source and disassembly.

23rd October 2003

Space Invaders v1.0.0 released! Here's the README.TXT.

I've spent the last 2 days optimising the graphics performance, and have managed to achieve a satisfactory result. The odd graphics glitch remains, despite the fact that I ended up disabling interrupts around the TRS-80 graphics routines, but it's definitely playable. This version runs at 50% on an un-patched xtrs and a real Model 4/4P!

All that remains is to hook up an external interrupt source and get it running at 100%. If results in xtrs are anything to go by, it should stand up to the increased frequency!

Old News - HERE



Full source and virtual disk development environment.
Initial release of Space Invaders for the TRS-80. Runs at 50% on an unpatched xtrs or a real Model 4/4P. Release includes self-booting virtual disk image, binary image for serial booting, and HEX2BIN utility. See below or the included README.TXT file for instructions.
Preview version of Space Invaders. Virtual disk image (.DSK) that will run on an un-patched version of xtrs at 50%. Simply change the #define TIMER_HZ_4 60 to 120 in trs_interrupt.c to run at full speed.
Note that this version will run on a real TRS-80 Model 4/4P (at 50%).
Binary image of SI loader code for serial booting on Model 4P (see below).
Win32 binary and source (for linux etc) for creating an intel hex format file for serial booting on Model 4P (see below).
Preview-only version of Space Invaders that will only run on a patched version of xtrs (patch included). Note that the screen has yet to be rotated and doubled, but otherwise it is fully playable. (Hint: in xtrs use -scale 1,1 for best viewing.)

In order to play Space Invaders on the TRS-80 (emulator or actual machine), you'll need a copy of the original arcade ROM image. The ROM image is copyrighted and not mine to give away, so please do not ask me for it. Unless this is your first time on the internet, you should be able to find it within a couple of minutes!
You'll need the romset that MAME identifies as 'INVADERS'.

Name              Size       Checksum
invaders.h      2048 CRC(734f5ad8) SHA1(ff6200af4c9110d8181249cbcef1a8a40fa40b7f)
invaders.g      2048 CRC(6bfaca4a) SHA1(16f48649b531bdef8c2d1446c429b5f414524350)
invaders.f      2048 CRC(0ccead96) SHA1(537aef03468f63c5b9e11dd61e253f7ae17d9743)
invaders.e      2048 CRC(14e538b0) SHA1(1d6ca0c99f9df71e2990b610deb9d7da0125e2d8)

The ROM image files need to be concatenated together as follows:
cat invaders.h invaders.g invaders.f invaders.e >invaders.rom (on Linux)
copy /b invaders.h+invaders.g+invaders.f+invaders.e invaders.rom (on Windows)

Virtual Disk Image

The image is a bootable (LDOS) virtual disk image with the SI/CMD executable. This executable reads the ROM image from a disk file named 'INVADERS/ROM'. After you've created the ROM image above, simply import the file into xtrs using the IMPORT/CMD command file included on the image.
Execute SI/CMD to play the game.

Intel Hex Image and Serial Booting

The SILDR.BIN file is binary image that may be concatenated with the invaders ROM image and downloaded to the Model 4P via the serial boot ROM procedure.
First, concatenate SILDR.BIN to the end of the ROM image:
cat invaders.rom sildr.bin >sitrs.bin (on Linux)
copy /b invaders.rom+sildr.bin sitrs.bin (on Windows)
Next, convert the binary image to intel hex format, using the bin2hex package I've provided above.
bin2hex -b6000 -t8000 sitrs.bin >sitrs.hex
This image may now be downloaded from a (Win32) PC to the Model 4P using SBOOT4T.

Playing Space Invaders on the TRS-80

Standard MAME keys apply (more-or-less).

Insert Coin
1P Start
2P Start
Joystick Left
Joystick Right
Space Bar

Feedback welcome!