internal Cartridge(byte[] contents)
 {
     Contents     = contents;
     RamBanks     = new byte[RAMSize.NumberBanks() * RAMSize.BankSizeBytes()];
     RamBank      = 0x0;
     RomBank      = 0x1;
     IsRamEnabled = false;
 }
        internal virtual void WriteRam(ushort address, byte value)
        {
            // Don't accept writes if RAM disabled
            if (!IsRamEnabled || RAMSize == CartridgeRAMSize.None)
            {
                return;
            }

            var bankedAddress = (address - RamAddressStart + RamBank * RAMSize.BankSizeBytes()) % RamBanks.Length;

            RamBanks[bankedAddress] = value;
        }
        internal virtual byte ReadRam(ushort address)
        {
            // If RAM isn't enabled or there isn't any all wires return high (i.e. 0xFF)
            if (!IsRamEnabled || RAMSize == CartridgeRAMSize.None)
            {
                return(0xFF);
            }

            var bankedAddress = (address - RamAddressStart + RamBank * RAMSize.BankSizeBytes()) % RamBanks.Length;

            return(RamBanks[bankedAddress]);
        }