Atari
Star Wars Theory of Operation
All source code here is reverse engineered from Atari original ROM data, and remains their copyright.
I've been fascinated by Atari's Star Wars arcade machine since I
first saw it in an arcade in October 1983
By 1987 I owned my own upright machine, and was curious how it
all worked. I understood the basics of the hardware, CPU, ROM, RAM, etc
and had a fairly good clue how the AVG vector generator worked too,
thanks to having an Asteroids machine and spending many hours fixing
it! But the mathbox part was new to me, and I had no idea how it
actually worked.
By the early 1990's I'd even written a small piece of self taught 6809
assembler and got some vector lines showing to try to understand more.
Loss of interest and lack of information prevented any further progress.
More recently I've recovered the interest and also found much more
information and disassembly tools thanks to the Internet. Many years of
embedded system programming have helped my understanding of software
much more, and thanks to Jed Margolin (pretty much Atari's "Mr
Star Wars ") having his own website explaining much of the 3D maths, it
seemed like time to dig deeper into the theory of operation of this
wonderful arcade game.
I'm now to a point where I've taken the original ROM code and
disassembled it into useable ASM source files that can be asembled back
into working game code. By altering parts of the code and running in
MAME, I've managed to work out how parts of the game work. I've also
been slowly commenting the parts of the code that I think I understand.
Maximum 6 fireball slots
Maximum 3 tie fighter slots
3D object handling. Tie fighters and bunker/tower explosion fragments
are handled differently from bunkers/towers/trench. Functions to
convert object points to AVG vectors are different depending on object
type. There is a table of data to determine which points need visible vector lines generating. There is another table of data for how many XYZ points are in each object.
Starting wave completion bonus. You can select Easy, Medium or Hard
starting waves, with bonus points of nothing, 400,000 and 800,000. But
the game code table also has bonus points of 200,000 and 600,000 for
non-existant starting waves 2 and 4.
The large blue 'Star Wars' 3D-like text on the attract screen is stored as vector instructions in the main ROM code, and copied to vector RAM.
Hidden text:
DURFEY GOT WIRED
HALLY WAS THE WHIPCRACKER
The text above is not exact, the first character of each phrase is not
correct, so the 'D' and 'H' of Durfey and Hally are hex C4 and 28 for
some reason. Erik Durfey was the technician, Mike Hally was project
leader.
Text is stored as ASCII, but the last character of a string has bit 7 set. There is a data table of pointers to text string start sddresses. There are data tables for text position and text colour, stored as vector instructions ready to copy into vector RAM.
Math Box
The following files can be unzipped and assembled using
AS09 V1.42
Command to assemble is AS09 -l -s -n StarWars.asm
Options -l, -s amd -n turn on list file, produce Motorola S19 output and turn off optimisations to give same binary as original game code.
When assembled they will produce an exact binary copy of the original
Star Wars code (Ver 2 ROMs)
You'll have to assemble 'StarWars.asm' and 'SW_M_Hi.asm' as two
separate projects, as the Hi memory bank is in the same address space
0x6000-0x7FFF as the start of the maincode.
Other source files are included as INCLUDE's
Zipfile of main assembler source
For the sound simply assemble 'SW_Sound.asm'
Tools
This small application allows you to point to a Motorola S Record file,
generated by the assembler, and create the correct MAME named ROM files
ready to run in MAME.
This way you can assemble the files above, point the splitter to the
resulting S Record files, and put the output ROMs in a MAME folder
named 'starwars' in your MAME roms folder.
This allows quick and easy assembly and testing of code.
When you select a file path, it remains sticky for next time by saving
the details in a small INI file in your Windows folder.
AVG assembler/disassembler
This application allows you to load in vector hex data and disassemble
into a text instruction file, and vice versa.
It's pretty crude, and surely has bugs in it! Though it has been useful
to me for exploring vector games.
This is a WAV to TMS5220 LPC converter. I've successfully put a chunk of my own speech into a Star Wars sound ROM, so it does work.
Source wav files must be 8000Hz mono 16 bit
Start new QBOX project Byte aligned, 8KHz, 5220 coding table
Add wav file you want to compress
Select 'Process...' menu then 'Medium Bit Rate' and then 'Compress'
Now select 'Edit -> Concatenations'
Add new concatenation. Then add wav file that has already been compressed previously.
Then 'Format..' menu 'LPC 10V 4UV' No flip byes, no list frames
Generates a BIN file that can be included into Star Wars EPROM.