Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Emulation & ROM Hacking

Changing the way the game receives input - Page 1

Changing the way the game receives input

Posted by: agusganog
Date: 2009-02-19 16:50:11
The addresses around 0160 seem to affect how the game receives input. For example, changing 0160 from 20 to 1F turns the A button into right on the d-pad, B into left, Select into up, and Start into down. A will still initiate a conversation, and start still brings up the start menu (to go down, press A or B and then immediately press and hold start).

Re: Changing the way the game receives input

Posted by: Bent`
Date: 2009-02-19 18:28:11
Address 0x15F?160 stores the value 0x20 in the accumulator, and later on the bytes 0xE0 0x00 cause this value to be written to the P1 hardware register. For more information, see the joypad input section of the Pandocs.

Re: Changing the way the game receives input

Posted by: agusganog
Date: 2009-02-22 11:46:49

Address 0x15F?160 stores the value 0x20 in the accumulator, and later on the bytes 0xE0 0x00 cause this value to be written to the P1 hardware register. For more information, see the joypad input section of the Pandocs.


Thanks for the explanation (and the awesome website). I understand how this happens, but do you have any idea why changing it to 1F specifically has these effects?

Re: Changing the way the game receives input

Posted by: Bent`
Date: 2009-02-22 22:20:06
It?s all there in the previous link. When working with bits you just need to convert the number from hexadecimal to binary. Bit 0 is the 20 position, bit 7 is the 27 position, and so forth.

Writing 0x20 (binary %00100000) to P1 sets bit 5 and unsets the other three high bits. Writing 0x1F (%00011111) sets bit 4 instead. Bits 0 through 3 are read‐only, so writing any value from 0x10?1F would have the same effect since the four lower bits are unchanged.

Re: Changing the way the game receives input

Posted by: agusganog
Date: 2009-02-23 16:44:18
Now it all makes sense. Thanks a lot for that explanation.