Liber VII · Capitulum II
Bus stuffing
An arbitrary write every three cycles.
The trick
For the TIA to receive a value, the 6507 loads it into a register and stores it to the TIA: lda #value (2 cycles) and sta COLUBK (3 cycles). With bus stuffing the 6507 only executes the sta, and the cartridge forces the data bus lines during the write cycle: what reaches the TIA is decided by the ARM. That is 3 cycles per write instead of 5: up to 25 arbitrary writes in a 76-cycle line, against 15.
There is one condition: the cartridge can only pull bits down to 0 on the bus, not raise them. The 6507 register must hold 1 in the bits you want to leave free, and bits 7 and 6 are not forced: they come from the register itself. That is why vcsWrite3 picks the instruction according to those two bits of the data: sta, stx, sty or sax (A AND X), with A, X and Y loaded beforehand with their masks. If X or Y lacks its mask, you get another colour or another volume.
| Bits 7 and 6 of the data | Instruction | Register |
| 0 1 | sta | A = $7F |
| 1 0 | stx | X = $BF |
| 1 1 | sty | Y = $FF |
| 0 0 | sax | A AND X = $3F |
Why it is needed
A 128-pixel high-resolution room requires delivering bytes to GRP0 and GRP1 in 8-pixel windows, besides the RESP writes to reposition the players, the HMOVE, the playfield and a sound sample on every line. In FULL each line carries eight GRPs, three RESP0s, the HMOVEs and the sound sample, each on its exact cycle, and at 5 cycles per write there is no time. The chapter on the modes explains how they are laid out.
Where it is used
| Mode | Room image | Scoreboard |
| FULL | Yes | Yes (in the same kernel) |
| STRIP+ | Yes (asymmetric playfield and 48 px window) | No |
| DOUBLE | No | No |
| STRIP | No | No |
The cover does not use it either, so that it looks the same on any console. One caveat: even though the DOUBLE and STRIP images do not need it, the upload of the sound samples that the 6507 writes in the overblank (32 bytes per frame) is done with bus stuffing in every mode.
Consoles that do not tolerate it
According to experience gathered on the AtariAge forums (not measurements by the project), some PAL 7800s do not fill bit 7 properly, some Atari Jr. units with a Taiwanese-made TIA lose several bits, and the bus low level is marginal, so dirty contacts make it worse. On those consoles it is best to choose DOUBLE or STRIP in the menu. The 2600+ and 7800+ do not support ELF cartridges.
Stella 7 implements vcsWrite3 by forcing the whole byte, so it does not detect a forgotten mask. For that the project has a Stella patch that imitates the PlusCart by Wolfgang Stubig (Al_Nafuur) (it chooses sta/stx/sty/sax and warns on the console if the value that comes out is not the one requested): that is how the failure in the first tests showed up, some black bands because only A was loaded.