Mbcs.Mbc
mbc.ml - Definitions for the memory-bank controller type
https://gbdev.gg8.se/wiki/articles/Memory_Bank_Controllers
type mbc =
| Mbc0 of mbc_funcs
| Mbc1 of {
title : string;
rom_bank : Utils.U8.u8;
ram_bank : Utils.U8.u8;
ram_enabled : bool;
ram_selected : bool;
eram : bytes;
}
| Mbc2 of {
rom_bank : Utils.U8.u8;
}
| Mbc3 of {
title : string;
rom_bank : Utils.U8.u8;
ram_bank : Utils.U8.u8;
rtc_register : Utils.U8.u8;
ram_timer_enabled : bool;
ram_selected : bool;
eram : bytes;
}
Constructors for each MBC to implement
and mbc_funcs = {
read : mbc -> bytes -> Utils.U16.u16 -> Utils.U8.u8;
write : mbc -> Utils.U16.u16 -> Utils.U8.u8 -> unit;
set_title : mbc -> string -> unit;
load : mbc -> unit;
}
Common functions shared by all MBCs