Page 127 of 127 FirstFirst ... 2777117125126127
Results 1,261 to 1,263 of 1263

Thread: Game Boy

  1. #1261
    EmuTalk Member
    Join Date
    Jun 2013
    1 Post(s)
    Quote Originally Posted by shutterbug2000 View Post
    I came to the conclusion of it being "switchable memory banks". (Feel free to correct me.) How would I implement this?
    Yes, while the region from 0x0000 to 0x3FFF always maps to the first 16KiB, the region from 0x4000 to 0x7FFF can be switched to any ROM bank depending on the MBC (memory bank controller) in the game cartridge.
    There are different ways to implement this. I use a lookup table with 16 entries so that each entry maps 4KiB of memory, using the highmost 4 bits of the address. That size also fits nicely for the switchable RAM banks in the GBC and some other special regions.
    This of course means that you can no longer access the whole memory as a single array.

    Related to your second question, you might also want to treat memory access to 0xFF00-0xFFFF (and maybe some other regions) differently than regular memory, as some of them will trigger special behaviour.
    For example, writing to 0xFF0F might trigger an interrupt after the current instruction, or writing to the ROM banks accesses the MBC.
    Your console output looks fine, at least if you call it only after a write to 0xFF01.

    And a (not so) small update from me: I reimplemented the CPU core in arm assembly, this time avoiding some of the bottlenecks of my old implementation, mainly interrupts and timer handling. Instruction decode/dispatch should also be faster.
    The CPU passes almost all tests, with the only failures due to missing timers. Next up are the callbacks for special registers (timers, interrupts...) and graphics. It looks like I can't reuse too much of my old code, either due to the different structure of the emulator or because it is too slow. For the graphics, I'm considering caching the tiles to speed up the rendering, as the tile accesses seem to take a considerable amount of time.
    It will probably take some weeks before I can work on it again, but I plan to have it running on the arm board at usable speed in the next few months.

    In other news, it looks like one of my favorite gameboy emulators goomba color is under development again.

  2. #1262
    EmuTalk Member
    Join Date
    Nov 2014
    0 Post(s)
    Ok, that helps, but I still need help with one thing. What determines which MBC to use?


  3. #1263
    EmuTalk Member
    Join Date
    Mar 2014
    Chicago, IL
    4 Post(s)
    There are three bytes in the cartridge header that determine all you need to know. They'll tell you the MBC type, how much ROM there is, and how much (if any) external RAM is present. ->

    You'll need to look at the bytes at 0x147, 0x148, and 0x149. It may seem a bit confusing, but handling MBCs is much more sane than trying to handle all of the various NES cartridge types Info on how each MBC works can be found here ->

    There are a few MBC types not listed in the link provided, only because they were exotic (MBC6 for multi-carts? and MBC7 for Kirby Tilt 'n' Tumble) and technically came out after Pan Docs was initially released. VBA-M's source code is probably the 'best' (and I use that word loosely, there are hardly any comments in the code!) documentation of the MBC7. MESS supports MBC6, but if you're looking at its code, just be aware that it's not technically FOSS. Those games are edge cases though; if you just want to run 99% of commercial games, MBC1, MBC2, MBC3, and MBC5 are what you should focus on.

Page 127 of 127 FirstFirst ... 2777117125126127

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts