Nintendo DMG-01 - Game Boy Console Manual page 20

Manual
Table of Contents

Advertisement

2.7.3. Low-Power Mode
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
3C
2) The next example is a bit more difficult.
The following code
76
FA 34 12
is effectively executed as
76
Page 20
halt
inc
a
halt
ld
a,(1234)
halt
TM
Game Boy
CPU Manual
V 1.01

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Game boy

Table of Contents