- Name
vcsWrite3
Writes any value in three cycles, with the cartridge forcing the data while the 6507 writes.
- Synopsis
#include "vcsLib.h" void vcsWrite3(uint8_t zeroPage, uint8_t value);- Description
This is bus stuffing. The 6507 stores a register that holds the mask, and in that same cycle the cartridge drives its own data onto the bus. The cartridge wins on the bits the 6507 leaves high, so the register ends up with the value you wanted. Each write costs two cycles less than a vcsWrite5, which takes a kernel from about 14 writes per line to about 24.
The firmware picks the opcode (STA, STX, STY or SAX) depending on which register holds the right mask for that value.
Consoles don’t all behave the same way, so the firmware calibrates at startup. A 7800 in 2600 mode handles it too.
- On the bus
It serves
85·86·84·87 zpand takes 3 cycles of the 6507. This is how it looks on the bus right after a vcsJmp3:1 sta zp2 COLUP03 the 6507 writes A and the cartridge forces 1Eserved by the cartridgeforced by the cartridge
- Example
vcsLdaForBusStuff2(); vcsLdxForBusStuff2(); vcsLdyForBusStuff2(); for (int line = 0; line < 192; line++) { vcsSta3(WSYNC); vcsWrite3(GRP0, sprite[line]); vcsWrite3(COLUP0, color[line]); }- Compatibility
● complete ◐ works with differences ○ exists but does nothing – missing ? no data
Implementation By version Notes Stella ◐ 7.0◐ master It always serves STA and writes the whole byte, so the fight over the bus isn’t simulated. Gopher2600 ● 2022-2023● 2025-04● v0.51.0● v0.53.0● master Test7800 ● 2025● v0.8.0 – v0.9.0 PlusCart and UnoCart ● 2.3.15 – 2.3.28● git 2025-11● 2.3.32 The loader only turns bus stuffing on if the ELF references vcsWrite3 or vcsWrite4. Chameleon Cart – 2025-10-23 It isn’t in the template firmware. Chameleon Cart, alternative firmware ● 2026-11-28 With calibration of the bits the console lets the cartridge force. Newbroo Wild Cart and Decker ? 2026 VCSIDE ACE adapter – 2026-11 - Known issues
- Stella: It always serves STA and writes the whole byte, so the fight over the bus isn’t simulated.
- PlusCart and UnoCart: The loader only turns bus stuffing on if the ELF references vcsWrite3 or vcsWrite4.
- Chameleon Cart: It isn’t in the template firmware.
- Chameleon Cart, alternative firmware: With calibration of the bits the console lets the cartridge force.
- See also You can’t test bus stuffing in Stella.
- See also
vcsWrite4(3V), vcsLdaForBusStuff2(3V), vcsWrite5(3V)