Nintendo DMG-01 - Game Boy Console Manual page 36

Manual
Table of Contents

Advertisement

2.13.1. I/O Registers
This is the matrix layout for register $FF00:
P10-------O-Right----O-A
P11-------O-Left-----O-B
P12-------O-Up-------O-Select
P13-------O-Down-----O-Start
Example code:
Game: Ms. Pacman
Address: $3b1
LD A,$20
LD ($FF00),A
LD A,($FF00)
LD A,($FF00)
CPL
AND $0F
SWAP A
LD B,A
LD A,$10
LD ($FF00),A
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
Page 36
P14
P15
|
|
|
|
|
<- bit 5 = $20
<- select P14 by setting it low
<- wait a few cycles
<- complement A
<- get only first 4 bits
<- swap it
<- store A in B
<- select P15 by setting it low
<- Wait a few MORE cycles
Game Boy
|
|
|
|
|
TM
CPU Manual
V 1.01

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Game boy

Table of Contents