Nintendo GAME BOY Programming Manual page 258

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual
LD
A,(HLD)
LD
(HLI),A
LD
(HLD),A
2.4.6 Using the HALT Instruction (Required)
Covers: DMG, SGB, and CGB
When using a HALT instruction, always add an NOP instruction immediately after the HALT
instruction. Not adding the NOP instruction may in rare cases cause the instruction after the HALT
instruction not to be executed.
2.4.7 Switching the CPU Operating Speed (Recommended)
Covers: CGB
When switching the CPU operating speed, first confirm the current speed by checking the speed
flag (bit 7 of register KEY1). In double-speed mode, both the divider (DIV) and timer (TIMA)
registers will also be set for double-speed operation.
2.4.8 Using Horizontal Blanking DMA (Required)
Horizontal blanking DMA should always be started (bit 7 of HDMA5 set to 1) when the STAT mode
is not set to 00. If horizontal blanking DMA is started when STAT mode is 00, depending on the
timing, the data in LCD display RAM may be destroyed. In addition, execution of a HALT
instruction during horizontal blanking DMA may prevent normal cancellation of the HALT mode or
DMA. Therefore, HALT instructions should not be used while horizontal blanking DMA is being
started.
2.4.9 Using General-Purpose DMA (Required)
General-purpose DMA should be started (bit 7 of HDMA5 set to 0) with the LCDC off or during V-
blanking. However, when transferring data during V-blanking, ensure that the transfer period does
not overlap with STAT modes 10 or 11.
2.4.10 DMA Transfers to OAM (Required)
In DMG and in CGB in DMG mode, when transferring data to OAM by DMA, the user program
area (00h-7FFFh) should not be used as the starting address of the transfer. In some cases,
data cannot be transferred from the user program area normally. CGB mode, however, does
enable DMA transfers from the user program area.
2.4.11 Status Interrupts (Required)
Covers: DMG, SGB, and CGB
When using a status interrupt in DMG or in CGB in DMG mode, register IF should be set to 0 after
the value of the STAT register is set. (In DMG, setting the STAT register value changes the value
of the IF register, and an interrupt is generated at the same time as interrupts are enabled.)
258

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents