Alan-1 Atari Star Wars Mathbox ROM Replacement
WHAT IS THE PURPOSE OF THIS CHIP?
To create the math necessary to scale the continuous stream of 3D images.
WHAT ARE THE TECHNICAL DETAILS?
Learn more about it and the incredible history of how Atari Star Wars came about from it’s creator Jed Margolin (https://www.jmargolin.com/vgens/vgens.htm)
“The amount of math that was needed for the game was more than could be done with the Bit-Slice Math Box used in BattleZone, Red Baron, and Tempest, so I designed a new one. The basic function in the 3D math we used is a matrix multiply of the form:
This can be broken down into three operations of the form:
X’ = AX * (X-XT1) + BX * (Y-YT1) + CX * (Z-XT1) + XT1
The basic operation is a Multiply/Accumulate with a Pre-Multiply Subtract of the form:
ACC = ACC + (A-B) * C Equation 2
Although there were some very fast bipolar multiplier/accumulators available from TRW, they were much too expensive (and Star Wars was designed before the invention of the DSP), so I settled for 74LS384 Serial Multipliers and 74LS385 Serial Adder/Subtractors.
The 74LS384 multiplies an 8-bit word multiplicand by a 1-bit multiplier. It produces a 1-bit product and keeps a running sum for multiplying the next most-significant-bit. By using two 74LS384s we can multiply a 16-bit multiplicand by a 1-bit multiplier. The 74LS385 Serial Adder/Subtractor operates with two serial bit streams, adding with Carry or subtracting with Borrow (however it is set up) and producing a 1-bit result while saving the Carry (or Borrow) for the next most-significant-bit.
With a 12 MHz clock, Equation 2 takes 2.58 us to perform. This is for 31 clocks. Normally it would be 32 clocks to get the entire 32-bit result of multiplying two 16-bit numbers. Why there is one less clock relates to how we represent the number 1.000. I think it will take another article to explain it.
Although a TRW Multiplier/Accumulator would do it in 50 ns, the Bit-Slice Math Box would probably take
10 us (I’m guessing).
The basic block diagram for the Multiplier/Accumulator with Pre-Subtract (the MAC) is shown in Figure 25.
For controlling the Multiplier/Accumulator and keeping it supplied with data I designed a simple Data Pump. Although it is microprogrammed, it is not a State Machine.
We start with a PROM to provide the various strobe signals to load the shift registers and the parallel input to the Multipliers and to start the counter to provide the correct number of serial clocks to the MAC.
The PROM is programmed to provide the desired set of microinstructions starting from a selected address. After each micro-instruction a counter increments the PROM address. The last instruction in the sequence sets the MHalt flag which stops the process and alerts the 68B09E that it has finished its task.
The programmer selects different programs by selecting the appropriate starting address in the PROM.
The data for the MAC is stored in a completely separate memory (a RAM) that the 68B09E writes to when the MAC is halted. The results of the MAC are not stored in the RAM; the 68B09E reads the contents of the Accumulator directly.
The address for the RAM comes from a counter that can be set by the 68B09E. After each program this counter is automatically incremented to make it easy to perform an operation on blocks of data. An example is when we transform the points that make up an object (like Darth Vader’s ship).
The 3D math that Star Wars was capable of performing allowed any object (and the observer) to be in any orientation. However, it was decided that players might be confused by being approached by an upside-down TIE Fighter, so they were forced to be right-side up most of the time.”
WHY WOULD I NEED A REPLACEMENT?
These chips don’t go bad often, but when they do, you will see errant images, 3D lines that don’t look right, weird looking tie fighters, and sometimes the game just won’t boot at all.
If you suspect you are having math box rom issues, replace your OEM part with our high quality modern improved version for years of reliable game play.