diff options
author | Paul Duncan <pabs@pablotron.org> | 2018-06-20 13:55:39 -0400 |
---|---|---|
committer | Paul Duncan <pabs@pablotron.org> | 2018-06-20 13:55:39 -0400 |
commit | 064ab1a623e444bce788a3edb128443041e765aa (patch) | |
tree | 69d87b7f9969c70a09cc8f610d495ba49646a65e | |
parent | 33a4c7944cfa30b22fb2e79271c359174381ea05 (diff) | |
download | gb-c-064ab1a623e444bce788a3edb128443041e765aa.tar.bz2 gb-c-064ab1a623e444bce788a3edb128443041e765aa.zip |
clean up mbc1
-rw-r--r-- | ops.yaml | 58 |
1 files changed, 29 insertions, 29 deletions
@@ -7815,35 +7815,6 @@ templates: } } - static uint16_t - mbc1_eram_get_addr( - const gb_t * const ctx, - const uint16_t addr - ) { - // switchable ram bank - // AAB BBBB BBBB BBBB - return ( - // A: ram_bank (2 bits, if rom_ram_mode == 1) - (((ctx->mmu.mbc1.rom_ram_mode ? ctx->mmu.mbc1.ram_bank : 0) & 0x3) << 13) | - - // B: address (13 bits) - (addr & 0x1FFF) - ); - } - - static uint8_t - mbc1_eram_rb( - const gb_t * const ctx, - const uint16_t addr - ) { - if (ctx->mmu.eram && ctx->mmu.mbc1.ram_enable) { - return ctx->mmu.eram[mbc1_eram_get_addr(ctx, addr)]; - } else { - // FIXME: what do we do with no eram? - return 0; - } - } - static void mbc1_rom_wb( gb_t * const ctx, @@ -7877,6 +7848,35 @@ templates: } } + static uint16_t + mbc1_eram_get_addr( + const gb_t * const ctx, + const uint16_t addr + ) { + // switchable ram bank + // AAB BBBB BBBB BBBB + return ( + // A: ram_bank (2 bits, if rom_ram_mode == 1) + (((ctx->mmu.mbc1.rom_ram_mode ? ctx->mmu.mbc1.ram_bank : 0) & 0x3) << 13) | + + // B: address (13 bits) + (addr & 0x1FFF) + ); + } + + static uint8_t + mbc1_eram_rb( + const gb_t * const ctx, + const uint16_t addr + ) { + if (ctx->mmu.eram && ctx->mmu.mbc1.ram_enable) { + return ctx->mmu.eram[mbc1_eram_get_addr(ctx, addr)]; + } else { + // FIXME: what do we do with no eram? + return 0; + } + } + static void mbc1_eram_wb( gb_t * const ctx, |