B board · sheet 5/6 · manual page 36

The first line buffer sheet

One scanline of memory, a nine-bit counter that clips sprites for free, and the gate that decides which sprite wins when two overlap.

This sheet is part ofHow sprites work

The subsystem followed end to end, across every sheet that builds it.

What this sheet is for

3K and 4K are the buffer: a small strip of memory holding one line's worth of sprite pixels, four bits at each of 256 positions. This is the workbench where a scanline is assembled before the beam arrives.

Sprites are placed by counting rather than comparing. A sprite's X byte is loaded into the counter formed by 5L, 5M and 5K, which then counts upward as the sprite's pixels are written. Where the counter starts is where the sprite lands. 4L and 4M exclusive-OR the count with the flip signal so a mirrored sprite is genuinely reversed pixel by pixel.

The ninth bit, which is the best idea on the board

The counter is nine bits wide, and the ninth bit is not tested by any logic anywhere. It is wired straight to the chip-enable of the buffer memory.

When the count runs past 255 that bit flips, the memory switches off, and the remaining pixels are written nowhere. A sprite walking off the right-hand edge is clipped perfectly, pixel by pixel, by a wire.

There is no comparator, no boundary check, no special case. Someone noticed that the carry out of a counter already is the condition "we have gone too far", and connected it to the one pin that acts on it.

First sprite wins

Overlapping sprites are resolved with no priority encoder and no sorting. The buffer is wiped to pen 15 before the line is filled, so "still 15" means "nobody has claimed this pixel".

1L, a '20, asks exactly that question of whatever is already in the slot. 1K and 2K then choose between writing the incoming sprite pixel and writing the existing value straight back. Every pixel is read, judged and written back, at pixel rate.

So priority is first-come-first-served in object-table order, and the game controls layering by choosing where in the list to put things. Pen 15 doing double duty as both transparent and empty is confirmed from the other direction too: MAME passes 15 as the transparent pen.

3L and 3M hold each stored pixel during playback, 2L and 2M swap between the two buffers every line, and 1M is the last stop on this board before the pixel goes over the ribbon cable to the colour mixer.

Every chip on this sheet

Click any of them to open the schematic with that chip selected in both panels.

← open the schematic for this sheet