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.
Basically I want to divide my world into different banks since they wont fit. in one.
But i fear what happens at a cross point where 4 sections are visible at once.
During the tile loading does bank switching multiple times a frame cause a problem ?
Or is this exactly how you would be expected to do it ?
Offline
Well, it is as expensive as the overhead of the CPU instructions used to switch between the banks.
It could be as simple as...
ld A,5 ld [$2000],A
But in practice you also need to...
- Potentially keep track of which bank was previously selected, if you need to be able to return to that bank later. This is applicable if you have code in a selectable bank that can call other code in bank 0 to load data from another bank.
- Calculate which bank you want to read from.
- Calculate which other bank you want to read from. (For example if one bank contains metatile data, and the other bank contains the corresponding tile data.)
In general, you would need to actually benchmark/calculate the worst case runtime for your code, for example using breakpoints in BGB. It' may also be a good idea to plan ahead and make it possible to load data over multiple frames, ahead of scrolling in a certain direction.
For loading bulk data (ie loading a new level/screen) it's generally recommended to disable the LCD, which gives you uninterrupted access to VRAM. The screen will go blank during this time, but this generally isn't a problem during a screen transition.
Offline
Ty i've been using it now in code to see how it goes.
Offline