Heap? Lol you are not doing ANY dynamic allocation of any kind on the Atari 2600.
Also you're not using the stack to pass parameters to routines here either. You might not even use subroutines.
> This pin-reduced 6507 eliminated the 6502’s NMI and IRQ pins, so there was no hardware interrupt capability at all. Everything had to be accomplished with software timing and polling.
STA WSYNC will make the CPU halt until the TIA is at the next scan line. This is the chief video synchronization tool on the Atari 2600. You do have to keep track of the number of scanlines you've generated. Horizontal timing takes care of itself but you need to track that too for various effects.