Nintendo DMG-01 Manual - Page 20
Warning, Examples
View all Nintendo DMG-01 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 20 highlights
2.7.3. Low-Power Mode Game BoyTM CPU Manual is executed. If interrupts are disabled (DI) then halt doesn't suspend operation but it does cause the program counter to stop counting for one instruction on the GB,GBP, and SGB as mentioned below. Depending on how much CPU time is required by a game, the HALT instruction can extend battery life anywhere from 5 to 50% or possibly more. WARNING: The instruction immediately following the HALT instruction is "skipped" when interrupts are disabled (DI) on the GB,GBP, and SGB. As a result, always put a NOP after the HALT instruction. This instruction skipping doesn't occur when interrupts are enabled (EI). This "skipping" does not seem to occur on the GameBoy Color even in regular GB mode. ($143=$00) EXAMPLES from Martin Korth who documented this problem: (assuming interrupts disabled for all examples) 1) This code causes the 'a' register to be incremented TWICE. 76 halt 3C inc a 2) The next example is a bit more difficult. The following code 76 halt FA 34 12 ld a,(1234) is effectively executed as 76 halt Page 20 V 1.01