Key Register

This is the register that contains information on which keys are being pressed.


Run and Finish

The Gameboy Advance has 10 buttons or keys. Check out the image on the right and you'll see all of the buttons colored red. Before you look at that and tell me that I'm wrong and that there are only 7 buttons, keep in mind that the directional pad has 4 buttons.

This is how I will label each key:

  1. UP
  2. DOWN
  3. LEFT
  4. RIGHT
  5. B
  6. A
  7. L
  8. R
  9. SELECT
  10. START

VisualBoy Advance


REG_KEYS

Address Size
0x0400:0130h 2KB

Bit Labels

F E D C
0 0 0 0
B A 9 8
0 0 L R
7 6 5 4
DOWN UP LEFT RIGHT
3 2 1 0
START SELECT B A

Key Register Explanation

First off, this is a read-only register. The bits only change when a key has been pressed, so we just need to read this register to know when and which keys have been pressed. The weird thing about this register is that all of the bits that are used for the 10 keys are normally set to 1, not 0. So the default value in hexidecimal of this register when no keys are being pressed is 0x03FF. So if you were to just press the 'A' button, then that would change the 'A' bit (which is bit 0) from 1 to 0. This would change the value of the register from 0x03FF to 0x03FE.

Below is a calculator that will allow you to select any of the buttons to similate pressing down. Then just click on the HEX or the BIN buttons to see the result.


Button Calculator

0x03FF
CLEAR
HEX
BIN