Cpu Functions (Cgb Only) - Nintendo GAME BOY Programming Manual

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual

2.6 CPU Functions (CGB only)

This section describes CPU functions that can be used only with CGB. Functions that are identical in
DMG and CGB are described in Section 2.4, CPU Functions (Common to DMG/CGB ). For
information on CPU functions enhanced in CGB, see Section 2.5, CPU Functions (Common to
DMG/CGB ).
2.6.1 Bank Register for Game Boy Working RAM
The 32 KB of Game Boy working RAM is divided into 8 banks of 4 KB each. The CPU memory
space C000h-CFFFh is set to Bank 0, and the space D000h-DFFFh is switched between
banks 1-7. Switching is performed using the lowest 3 bits of the bank register, SVBK. (If 0 is
specified, Bank 1 is selected.)
NAME
ADDRESS
SVBK
FF70
Note: This register cannot be written to in DMG mode.
2.6.2 CPU Operating Speed
The speed of the CGB CPU can be changed to suit different purposes. In normal mode, each
block operates at the same speed as with the DMG CPU. In double-speed mode, all blocks
except the liquid crystal control circuit and the sound circuit operate at twice normal speed.
Normal mode: 1.05 MHz (CPU system clock)
Double-speed mode: 2.10 MHz (CPU system clock)
Switching the CPU Operating Speed
Immediately after the CGB CPU is reset (immediately after reset cancellation), it operates in
normal mode. The CPU mode is switched by executing a STOP instruction with bit 0 of
register Key 1 set to a value of 1. If this is done in normal mode, the CPU is switched to
double-speed mode; otherwise it is switched to normal mode. Bit 0 of register Key 1 is
automatically reset after the operating speed is switched. In addition, bit 7 of register Key 1
serves as the CPU speed flag, indicating the current CPU speed.
BIT
7
6
5
4
3
2
1
0
R/W
Bank Specification
0,1: Specify Bank 1
2-7: Specify Banks 2-7
34

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents