Empty program: Difference between revisions

m
(Add CLU)
Line 1,655:
===Game Boy===
{{trans|Game Boy Advance}}
The Nintendo logo is loaded from the cartridge header, and the Game Boy's firmware won't boot the game without it. In addition, the firmware also reads a checksum of the cartridge contents and won't boot the game if it doesn't match the checksum stored in the header. So a truly "empty" program can't be run at all. Thus a minimum of a valid cartridge header is required for an empty program that the Game Boy can actually run.
The beginning of the cartridge header is a jump to the program's start. Simply duplicate this instruction at that address and voila:
 
<lang z80>ProgramStart:
nop ;not sure if this is needed but Game Boy is somewhat buggy at times and the tutorials I used all did it
jp ProgramStart</lang>
di ;disable interrupts
foo:
jp foo ;trap the program counter here. (Don't do this on a real Game Boy, you'll drain the batteries much faster than usual.)</lang>
 
=={{header|Zig}}==
1,489

edits