Cpu Functions (Common To Dmg/Cgb ) - Nintendo GAME BOY Programming Manual

Hide thumbs Also See for GAME BOY:
Table of Contents

Advertisement

Game Boy Programming Manual

2.4 CPU Functions (Common to DMG/CGB )

The CPU functions described here are those that are identical in DMG and CGB. CPU functions that
are enhanced in CGB are described in Section 2.5, CPU Functions (Common to DMG/CGB ). CPU
functions that cannot be used for DMG are described in Section 2.6, CPU Function (CGB only).
2.4.1 Controller Data
The P1 ports are connected with a matrix for reading key operations.
Name
Address
Bit
7
P1
FF00
When key input is read, a brief interval is interposed between P14 and P15 output and reading of the
input, as shown below.
Example: KEY
LD
LD
LD
.
.
LD
LD
LD
LD
LD
.
.
LD
LD
.
RET
6
5
4
3
2
1
VDD
P14
Res.
x4
RIGHT
P10
LEFT
P11
UP
P12
DOWN
P13
LD
($FF00), A
A, ($FF00)
A, ($FF00)
A, ($10)
($FF00), A
A, ($FF00)
A, ($FF00)
A, ($FF00)
;
;
A, $30
($FF00), A
0
R/W Ports P10-P15
P10
P11
Input Ports
P12
P13
P14
Output Ports
P15
P15
A
B
All inputs are
pulled High
SELECT
START
A, $20
; Read U, D, L, R keys
; Port P14 ← LOW output
; A Register ← Port P10-P13
; Perform this operation twice
; Reads keys A, B, SE, ST
; Port P15 ← LOW output
; A Register ← Ports P10-P13
; Perform this operation 6 times
;
; Port reset
24

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents