ROM Hack Custom sensors in cartridges: how does one read data?

wgroeneveld

New Member
OP
Newbie
Joined
Jul 2, 2020
Messages
2
Trophies
0
Age
43
XP
41
Country
Belgium
Hi GBATemp community,

I'm trying to understand how custom sensors added to certain cartridges work, such as Boktai's sunlight sensor. the thread "boktai-solar-sensor-patch-kit.245127" (cant post a link...) lists a neat ROM hack where I can defer the address in the assembly where the sensor data is read. And I understand that any game can solder on any kind of sensor, it's game-specific, not platform-specific.

I'm a software guy, not a hardware one, so I wonder: to the devs just 'know' you have to read memory location XXXX and that's where the sensor will be? (like VRAM at 0x6000xx etc...) I presume that is the case. Meaning I can create a game that has a "light sensor" (at a certain pre-set address?) and mGBA could manipulate it's values using emulation->solar sensor->increase brightness menus. Or is there some kind of bridge between GBA BIOS/IRQ calls for sensors built-in?

Thanks for clearing that up!
 

Sterophonick

Stupid Retro Tech Cat
Member
Joined
Jul 17, 2018
Messages
565
Trophies
0
Location
Spamton's Keygen Dungeon
Website
sterophonick.github.io
XP
2,231
Country
United States
I believe the console has some GPIO ports that are located somewhere in the address space of ROM, (but these bytes are not part of ROM, and are erased when the console is shut off) and there is code to decode the data this is given to the system. This is how the RTC and Gyroscope work.
 
Last edited by Sterophonick,

FAST6191

Techromancer
Editorial Team
Joined
Nov 21, 2005
Messages
36,798
Trophies
3
XP
28,373
Country
United Kingdom
http://problemkaputt.de/gbatek.htm#gbacartridges if you just wanted protocols.

Beyond that not sure if you are asking for a reverse engineering guide (most such things are tapped every frame, or have direct things you can search for as cheats just like you would search for lives, hardware debugging was kind of a thing but easy enough to set a breakpoint or even static disassembly analysis for such things) or an electronics design guide (short version if you are software and are used to various APIs and whatever to communicate between programs then same applies to electronics -- http://dangerousprototypes.com/docs/Bus_Pirate is a reverse engineering tool but provides a nice overview of most of the comms protocols, you might even recognise a few of them from the gbatek document linked at the start. You then have two main approaches unless the console affords you another by some other bus, and that is you edit what it thinks is the ROM, which is technically how many flash carts work but was popular back in older devices, or you edit what it thinks/normally uses as a save which is what most things do).
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    BigOnYa @ BigOnYa: I haven't played my Switch n a month or so, just been playing Xbox, and just picked to play lil...