Skip to main content

current_bank

Function current_bank 

Source
pub fn current_bank() -> BankNumber
Available on crate feature bank only.
Expand description

Read the currently mapped bank from the software shadow.

The MBC register is write-only, so the active bank cannot be read from hardware; this returns the shadow maintained by switch_bank. Intended for interrupt save/restore; the normal call path restores via the caller’s group type and never needs it.

On a cartridge with no switchable window this is always bank 0, and no shadow is kept.