Nintendo GAME BOY Programming Manual page 36

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual
Flow of Switching (when switching to double-speed mode)
In case the CPU operating speed needed to be switched, the current speed should always
be checked first using the speed flag (bit 7 of the KEY 1 register). This ensures that the
speed will be switched to the intended speed.
Reset interrupt-request register IF
Reset interrupt-enable register IE
Set bits 4 and 5 of the P1 port register to 1
Switching Routine (example)
LD
BIT
JR
SET
XOR
LD
LD
LD
LD
STOP
_NEXT
Read the speed flag
(Bit 7 of register Key 1)
Speed flag = 0?
Yes
Enable speed switching
(Set bit 0 of register Key 1)
Execute STOP instruction
HL, KEY1
7, (HL)
NZ, _NEXT
0, (HL)
A
(IF), A
(IE), A
A, $30
(P1), A
No
Switching unnecessary
36

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents