Skip to main content


Wait, the 6502's stack pointer is eight bits? I knew it was resource constrained, but damn!
in reply to Jonathan Lamothe

Yeah, and you have no choice about the location of the stack. Yippee!

The 6502 was designed around minimizing cost, and this is one fun example.

But to be honest, I've never found the limited stack size to be a problem in practice.

in reply to Isaac Kuo

@Isaac Kuo I guess writing any kind of asynchronous code is off the table then, unless I implement some kind of virtual stack system.
in reply to Jonathan Lamothe

The largest embedded assembly projects I wrote used about 20 bytes of stack at most. But I didn't use C or recursive functions, which would been an exponentially larger stack crasher
in reply to Jonathan Lamothe

@Jonathan Lamothe Depending on the specific system, complex asynchronous code via timer interrupts (or raster interrupts, or I/O interrupts) is possible, but only one "thread" should use the stack.

For example, by default the Commodore 64 has a timer interrupt to trigger code to handle keyboard scanning, blinking the cursor, and other stuff. It's a non-trivial amount of code, but it does not mess with the stack.

This website uses cookies. If you continue browsing this website, you agree to the usage of cookies.