Empty program: Difference between revisions

Content deleted Content added
Puppydrum64 (talk | contribs)
Puppydrum64 (talk | contribs)
Line 23: Line 23:
Without an infinite loop the program counter will execute undefined behavior, depending on how "empty" bytes are padded. If we're generous and assume that empty bytes are padded with <code>NOP</code>, eventually the program counter will attempt to execute the interrupt vectors as executable code. If we assume that an "empty program" needs to not crash (even though you really can't tell the difference with nothing on screen), we need a way to "trap" the program counter.
Without an infinite loop the program counter will execute undefined behavior, depending on how "empty" bytes are padded. If we're generous and assume that empty bytes are padded with <code>NOP</code>, eventually the program counter will attempt to execute the interrupt vectors as executable code. If we assume that an "empty program" needs to not crash (even though you really can't tell the difference with nothing on screen), we need a way to "trap" the program counter.


<lang 6502asm>.org $8000 ;usually $8000 but it depends on the mapper.
<lang 6502asm>.org $8000 ;usually $8000 but it depends on the mapper.
RESET: ;execution starts here
RESET: ;execution starts here
JMP RESET
JMP RESET