Skip to content

Instantly share code, notes, and snippets.

@Dhole
Created December 25, 2014 00:52
Show Gist options
  • Save Dhole/a097cee60b990f65d869 to your computer and use it in GitHub Desktop.
Save Dhole/a097cee60b990f65d869 to your computer and use it in GitHub Desktop.
custom logo
/* Read cartridge operation for MBC1 */
inline uint8_t mbc1_read(uint16_t addr) {
if (addr < 0x4000) {
/* 16KB ROM bank 00 */
if (no_show_logo) {
/* Custom logo disabled */
return rom_gb[addr];
} else {
/* Custom logo enabled, only during first read at boot */
if (addr == 0x133) {
no_show_logo = 1;
}
return logo_bin[addr - 0x104];
}
} else if (addr < 0x8000) {
/* 16KB ROM Bank 01-7F */
return rom_gb[addr + 0x4000 * (rom_bank - 1)];
} else if (addr >= 0xA000 && addr < 0xC000) {
/* 8KB RAM Bank 00-03, if any */
return ram[addr - 0xA000 + 0x2000 * ram_bank];
}
return 0x00;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment