B13rg / pokecrystal

Improved version of Pokémon Crystal, with added features, bug fixes, and QoL changes
1 stars 0 forks source link

Remove RTC functionality #106

Closed B13rg closed 1 year ago

B13rg commented 3 years ago

Current;y, the game is built to use the real time clock, which was only part of the MBC3 type gameboy cartridge. This limits the ROM to taking up a maximum of 2MB. Since this version is being created in the modern era, where it most likely won't be ona real cartridge, it would be better to separate the cartridge time from real time. This would also allow us to use a MBC5 type cart, which allows us up to 8MB of ROM.

Instead of using the RTC, the game should instead just use in-game ticks. This can also speed up the time, so it'll take 1-2 real world hours for a day to pass in the game. Not only will it make the game move a little faster, it will make it easier to play on computers/emulators, as the time aspects doesn't continue counting when the emulator is closed (usually).

Summary:

Reference on MBCs: https://gbdev.gg8.se/wiki/articles/Memory_Bank_Controllers#MBC5_.28max_8MByte_ROM_and.2For_128KByte_RAM.29

B13rg commented 3 years ago
Memory map between the MBC3 and 5 are mostly the same. Differences: MBC3 MBC5
RAM Max 64k Max 128k
2000-2FFF 7 bits are written here to select RAM bank. Writing 0 will select ROM bank 1 lower 8 bits of ROM bank. Writing 0 will select ROM bank 0
3000-3FFF continuous with previous range 9th bit of ROM bank goes here

To begin, may only expand to 4MB of ROM, so I don't have to program setting the 9th bit, but it depends on how complex the bank switching code is.

B13rg commented 1 year ago

Instead of using an MBC5, we can instead switch to a tpp1 MBC: https://rgbds.gbdev.io/docs/master/rgbfix.1/#TPP1 This will give us the ROM and SRAM space we need, while preserving the RTC.

->> #109