Nintendo DMG-01 Manual - Page 36
I/O Registers
View all Nintendo DMG-01 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 36 highlights
2.13.1. I/O Registers Game BoyTM CPU Manual This is the matrix layout for register $FF00: P14 P15 | | 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)
2.13.1. I/O Registers
Game Boy
TM
CPU Manual
This is the matrix layout for register $FF00:
P14
P15
|
|
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
<- bit 5 = $20
LD ($FF00),A
<- select P14 by setting it low
LD A,($FF00)
LD A,($FF00)
<- wait a few cycles
CPL
<- complement A
AND $0F
<- get only first 4 bits
SWAP A
<- swap it
LD B,A
<- store A in B
LD A,$10
LD ($FF00),A
<- select P15 by setting it low
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
LD A,($FF00)
<- Wait a few MORE cycles
Page 36
V 1.01