Empty program: Difference between revisions

m
Line 21:
 
===Nintendo Entertainment System===
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,. resultingIf inwe aassume crashthat oran unintended"empty behavior,program" dependingneeds onto wherenot theycrash are(even located.though Atyou that point thisreally can't reallytell bethe considereddifference anwith "empty"nothing programon screen), so we need at least onea instructionway to "trap" the program counter.
 
<lang 6502asm>.org $8000 ;on the NES it's usually $8000 but it depends on the hardwaremapper.
RESET: ;execution starts here
JMP RESET
 
 
NMI: ;NMI can't happen if the screen is off. No need for RTI
 
IRQ: ;this will never occur without a CLI command.
 
.org $FFFA ;all 6502 based hardware uses this section of memory to hold the addresses of interrupt routines
1,489

edits