Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2018-02-15 07:13:05

bingbong
New member
Registered: 2018-02-15
Posts: 1

ROM pages MBC1

Hi all,

I read about the MBC1 and its possibility of 125 ROM pages. But why 125?

In this schematic (https://fms.komkon.org/GameBoy/Tech/Carts.html) one can see, that 5 additional addresslines go from the mbc1 to the rom.

The rom has its standard of A0-A13, which matches the 0h-3FFFh adress space (16kb). The additional 5 address bits give me 1Fh (31) additional banks with 16kbyte, not 128 (125) banks.

Here (http://gbdev.gg8.se/wiki/articles/MBC1) one can read that its possible to choose ROM bank 01h-7Fh. But for 7Fh we need 7 bits! The MBC1 just uses D0-D5 for reading the used ROM bank and A14-A18 to set the ROM bank.

Here (https://github.com/Dooskington/GameLad/ … write-only) is written that writing the values 0x01-0x1F to address space 0x2000-0x3FFF will set the lower 5 bits of the bank. Where are the higer bits set? (Is writing to any address in the space 0x2000-0x3FFF possible?)

So where is my error in understanding?

thanks smile

Offline

 

#2 2018-02-18 17:05:00

Tauwasser
Member
Registered: 2010-10-23
Posts: 108

Re: ROM pages MBC1

Heya,

you can see the MBC1 pinout on my wiki's MBC1 page.

The pinout you describe is the 16 Mbit ROM/64 kbit SRAM mode, which is the default mode of MBC1 after reset. This means the cartridge uses the two RAM address lines as high address lines for ROM, so you have 5 bits from the ROMB register and the additional two bits from the RAMB register. The address lines all switch according to A14, so if ROM address is less than 0x4000, the high address lines will switch to 0 (thus yielding ROM bank 0x00).

The 125 banks instead of 128 banks stem from the fact that writing 0x00 to ROMB isn't allowed, so banks 0x20, 0x40 and 0x60 cannot be used, as they will select banks 0x21, 0x41 and 0x61 respectively regardless.

The high bits (RAMB) are set by writing to 0x4000-0x5FFF range while the low bits (ROMB) are written to 0x2000-0x3FFF range. You can use any address in that range, because MBC1 only sees the upper three address bits, so all write accesses on any of these addresses look identical from MBC1's point of view.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson