Miscellaneous Notes - Nintendo GAME BOY Programming Manual

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

When sound 3 is used, data should always first be specified for addresses FF30h-FF3Fh of
waveform RAM. If the initial flag is set during sound 3 operation (sound 3 ON flag = 1), the
contents of waveform RAM will be destroyed.

2.4 Miscellaneous Notes

2.4.1 Using Interrupts (Required)
Covers: DMG, SGB, and CGB
When interrupts are used, the IF register should be cleared before the IE register is set. If the IF
register is not first cleared, an interrupt may be generated immediately after interrupts are enabled.
2.4.2 Reading Keys (Required)
Covers: DMG
An interval of approximately 18 cycles should be used between output from P14 and P15 and
reading of input. Without this interval, normal key input cannot be read.
2.4.3 Using the Timer (Required)
Covers: DMG, SGB, and CGB
The timer should be started (TAC start flag set) after the count-up pulse is selected. Starting the
timer before or at the same time as the pulse is selected may result in an extra count-up operation
at the time of pulse selection.
Example:
LD
A,3
LD
(07),A
LD
A,7
LD
(07),A
If a write instruction is executed for the modulo register TMA with the same timing as the contents
of that register are transferred to TIMA as a result of a timer overflow, the same write data also will
be transferred to TIMA..
2.4.4 Using STOP Mode (Required)
Covers: DMG, SGB, and CGB
When STOP mode is used, all interrupt-enable (IE) flags should be reset before execution of a
STOP instruction. Otherwise, if an interrupt is generated during the period of oscillation
stabilization (HALT mode) following STOP mode cancellation, HALT mode will immediately be
canceled, preventing a stable system clock from being provided.
2.4.5 Using Paired Registers (Required)
Covers: DMG, SGB, and CGB
With instructions that use paired registers BC, DE, and HL, such as the following, there is some
chance that OAM RAM may be destroyed. Therefore, ensure that these paired registers are not
set to a value in the range FE00h-FE9Eh.
INC
ss
DEC
ss
LD
A,(HLI)
;Selects f/256 as the count-up pulse.
;Sets TAC ← 3
;Starts the timer
; ss : BC, DE, HL
257
Appendix 1: Programming Cautions

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents