I'm having a project of a Gameboy emulator for android, so far what I got was:
- Identify the type of game (GameBoy, Super GameBoy, GameBoy Color, etc.).
- Identify the game region.
- Extract the game title.
First of all, all the references to build it, I'm getting from this site that mapped the gameboy full, and from this cpu handbook (aside from some open-source emulators).
In the code snippet I use to identify the type of game I do as follows:
if (m_ROM[0x0143] & 0x80){
__android_log_write(ANDROID_LOG_DEBUG, "Cartridge", "GameBoy Color Game");
return 1;
}else if(m_ROM[0x0146] & 0x03){
__android_log_write(ANDROID_LOG_DEBUG, "Cartridge", "Supper GameBoy Game");
return 2;
}else{
__android_log_write(ANDROID_LOG_DEBUG, "Cartridge", "GameBoy or other");
return 0;
}
It works perfectly, it's even easy to understand because everything is very well documented, but what I can not understand is what & is doing, from what I read in some books I have it works to get the address of something like reference operator, or turning off bits, which makes me confused, since in practice this is like "if address 0x0143 contain 0x80 then it is a color gameboy game. "