gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Speculation on reading extra DS buttons from GBA mode

#30055 - tepples - Sun Nov 28, 2004 12:35 am

Wild speculation about the DS controller:

It could be possible that the GBA register 0x4000130 - REG_KEY is no longer read-only. One way Nintendo could have designed it, similar to how the reading the DMG controller works, would be to make some of the bits writable such that writing to the bits would either unmask or bankswitch which buttons can be read.

Example of hypothetical unmaskable register:
Write 0x03FF to REG_KEY, and reading REG_KEY returns only the GBA buttons.
Write 0x0FFF to REG_KEY, and reading REG_KEY returns the X and Y buttons as well.

Example of hypothetical bankswitchable register:
Write 0x0000 to REG_KEY, and reading REG_KEY returns the GBA buttons.
Write 0x4000 to REG_KEY, and reading REG_KEY returns the X and Y buttons.
Write 0x8000 to REG_KEY, and reading REG_KEY returns the X coordinate of the touch screen.
Write 0xC000 to REG_KEY, and reading REG_KEY returns the Y coordinate of the touch screen.

Has anybody else thought to try this?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#30058 - Lord Graga - Sun Nov 28, 2004 1:36 am

I am 100% sure that the pad is read the same way on the DS as it is on GBA, just with two extra bits to read from.

#30059 - tepples - Sun Nov 28, 2004 1:49 am

Lord Graga wrote:
I am 100% sure that the pad is read the same way on the DS as it is on GBA, just with two extra bits to read from.

Which would confuse games that expect all-buttons-up to be exactly 0x03FF; hence my bitmasking idea.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#30060 - Krakken - Sun Nov 28, 2004 1:50 am

Joat has tried reading the key input register with no luck on a GBA flash cart. I don't believe he tried it using your method though which seems quite feasible.

http://zerohaven.com/ds/wiki/index.php?title=Misc:Misc

#30488 - abilyk - Wed Dec 01, 2004 5:35 pm

Though it was a sound idea, writing to REG_KEY has no effect on the data read from REG_KEY. I tested using a fleshed-out version of this pseudocode:

Code:
for(temp_index = 0; temp_index < 65536; temp_index++)
{
   REG_KEYINPUT = temp_index;
   if(REG_KEYINPUT != 0x3ff)
   {
      PRINT(temp_index, REG_KEYINPUT);
   }
}