# The Special Chips (SC1, SC2): the blitter Two identical 40-pin VTI chips on the ROM board, one per nibble (VL2001 "Special Chip 1", VL2001A "Special Chip 2"), from Robotron on (SR-BLIT; SR-SC1DIE). Defender and Stargate have none. Almost everything here comes from Sean Riddle's study on real boards: 256 + 222 test blits on two Joust machines with five sets of SC1s, every result dumped and timed (MEASURED, SR-BLIT), and SC2s tested on loan (MEASURED: identical but for the bug fix). His RAM dumps are pinned (`reference/data/blitdump.zip`, `blitpass1-3`) and are **the tier-1 judge**. ## Registers (write-only, CA00-CA07) | Address | Register | Evidence | | --- | --- | --- | | CA00 | control byte; **writing it starts the blit** | SR-BT, SR-BLIT | | CA01 | mask / solid colour | SR-BT | | CA02-CA03 | source address, high then low | SR-BT | | CA04-CA05 | destination address | SR-BT | | CA06 | width in bytes | SR-BT | | CA07 | height | SR-BT | - Write-only: reads return no register and a read of CA00 does not start a blit (MEASURED). Registers keep their values between blits **and across a reset** (MEASURED: "Even if you reset the game!"). - **The SC1 bug**: bit 2 of the width and height is inverted, so programs XOR both with 4; SC2 fixed it (SR-BT: "D2 is inverted"; SR-BLIT; SR-SC1DIE). A game written for SC1 on SC2 (or the reverse) draws wrong sizes; Riddle's `schack.gif`/GAL hack swaps them. The board takes the chip as a machine-row parameter (OBSERVED: MAME lists SC1 for Robotron, Joust, Bubbles, Sinistar, SC2 for Splat and Blaster). - A width or height of 0 behaves as 1 (MEASURED). ## Control byte (CA00) From SR-BT, with Williams's own names for the bits as posted from the Robotron development system's source (quoted on SR-BT as a KLOV post; cited as facts, not copied): | Bit | Meaning | | --- | --- | | 0 | source layout: 0 linear (stride 1), 1 screen (stride 256) | | 1 | destination layout, the same | | 2 | slow: synchronise with E; needed for RAM-to-RAM blits (half speed); not for ROM to RAM or from Sinistar's D000 RAM | | 3 | foreground only (do not write colour-0 pixels: transparency) | | 4 | solid: write the CA01 colour instead of the source data | | 5 | shift the source one pixel right ("any data on the far right jumps to the far left") | | 6 | suppress the even pixel (Williams: "B0-B3 write suppress") | | 7 | suppress the odd pixel ("B4-B7 write suppress") | Corners measured: with both nibble suppressions set, a foreground-only blit still changes the destination (MEASURED). Transparency is done by **write-inhibit signals per nibble (/WINH upper and lower), not by reading the destination** (SR-BLIT, from the chips' pinout and a logic analyser), so a model must not read the destination. ## How a blit runs 1. The write to CA00 makes the chips assert /HALT; the CPU finishes its current instruction, raises BA and BS (/BABS low), and "after nearly one instruction cycle" the blit begins (MEASURED: SR-BLIT logic-analyser pictures; the programming manual's "an additional dead cycle will elapse": 6809PM). 2. Four counters: 16-bit source and destination, 8-bit width and height preset from the registers; read source, write destination, step, reload width at the end of each row (SR-BLIT). The source and destination steps follow bits 0 and 1. 3. When done /HALT is released and "after nearly 2 instruction cycles" /BABS goes high and the CPU runs again (MEASURED). 4. A blit can write CA00 itself and start another blit, looping until the watchdog resets the game (MEASURED). 5. Blitting into the colour RAM half works: the chips change address and data before the 7489's write enable ends, so colours land wrong (MEASURED). Model: undefined, logged. 6. RAM-to-RAM without the slow bit corrupts data, differently run to run and board to board (MEASURED): the board logs it and does what the fast path does, marked HYPOTHESIS. 7. The LOWER chip is the master (it generates /HALT; pins 3 and 14 set the role); the UPPER one alone does not halt the CPU (MEASURED). 8. Sinistar adds a clipper on the ROM board that stops the chips writing the top of the screen, enabled by C900 bit 3 (SR-DIFF; SR-HW). ## Timing Fitted here from SR-BLIT's table (1000 blits each, the NO-BLIT loop of 132.504 ms subtracted; FITTED from MEASURED): | Mode | Time per blit | Fit over | Max residual | | --- | --- | --- | --- | | fast (bit 2 clear) | 5.0 µs + 1.001 µs a byte | 220 blits, 1-256 bytes | 4.9 µs | | slow (bit 2 set) | 6.2 µs + 2.001 µs a byte | 35 blits, 256-48,841 bytes | 6.2 µs | So one byte per E cycle fast, one per two slow, plus a fixed cost of about five cycles that includes the HALT handshake and the loop's own store (to be separated with the Saleae captures, U3). Riddle's WETS timing table (11 blits, real board against MAME 0.145) is the second judge: before Aaron Giles's MAME 0.145u2 change the slow blits ran in half the time (SR-WETS). ## What MAME does that the board must not copy MAME computes a blit at once and subtracts an estimated cycle count from the CPU (m6809-python's timing.md, from MAME's source before tonight's closed-box rule). The board models the chips' bus cycles and holds the CPU halted for them, so a blit is visible mid-way to the video and to a game that reads RAM in its IRQ. ## Judges - `blitdump.zip`: RAM after each of 256 blits on a real Joust, the parameters in the dump's 16-byte headers (tier 1). `willyblittestdump.asm` is the program that made it (public domain, SR willy.html); the board can run its blits from the dump's parameters without assembling it. - `blitpass1-3_0000-BFF7.bin`: three validation passes (tier 1, SR-WETS). - The per-blit times above (tier 1, fitted).