Exemplo n.º 1
0
        /// <summary>
        /// Gets the number of ROM banks required by the specified cartridge ROM size.
        /// </summary>
        /// <param name="cartridgeRomSize">Size of the cartridge rom.</param>
        /// <returns></returns>
        /// <exception cref="System.NotSupportedException">RomSize:  + cartridgeRomSize</exception>
        public static int NumberOfBanks(this CartridgeRomSize cartridgeRomSize)
        {
            switch (cartridgeRomSize)
            {
            case CartridgeRomSize.Fixed32:
                return(2);

            case CartridgeRomSize.Banked64:
                return(4);

            case CartridgeRomSize.Banked128:
                return(8);

            case CartridgeRomSize.Banked256:
                return(16);

            case CartridgeRomSize.Banked512:
                return(32);

            case CartridgeRomSize.Banked1024:
                return(64);

            case CartridgeRomSize.Banked2048:
                return(128);

            case CartridgeRomSize.Banked4096:
                return(256);

            case CartridgeRomSize.Banked8192:
                return(512);

            default:
                throw new NotSupportedException("RomSize: " + cartridgeRomSize);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CartridgeHeader"/> class.
 /// </summary>
 /// <param name="entryPoint">The entry point.</param>
 /// <param name="title">The title.</param>
 /// <param name="isGameBoyColour">if set to <c>true</c> [supports game boy colour].</param>
 /// <param name="licenseCode">The license code.</param>
 /// <param name="isSuperGameBoy">if set to <c>true</c> [supports super game boy].</param>
 /// <param name="cartridgeType">Type of the cartridge.</param>
 /// <param name="romSize">Size of the rom.</param>
 /// <param name="ramSize">Size of the ram.</param>
 /// <param name="destinationCode">The destination code.</param>
 /// <param name="romVersion">The rom version.</param>
 /// <param name="headerChecksum">The header checksum.</param>
 /// <param name="romChecksum">The rom checksum.</param>
 public CartridgeHeader(byte[] entryPoint,
                        string title,
                        bool isGameBoyColour,
                        string licenseCode,
                        bool isSuperGameBoy,
                        CartridgeType cartridgeType,
                        CartridgeRomSize romSize,
                        CartridgeRamSize ramSize,
                        DestinationCode destinationCode,
                        byte romVersion,
                        byte headerChecksum,
                        ushort romChecksum)
 {
     EntryPoint      = entryPoint;
     Title           = title;
     IsGameBoyColour = isGameBoyColour;
     LicenseCode     = licenseCode;
     IsSuperGameBoy  = isSuperGameBoy;
     CartridgeType   = cartridgeType;
     RomSize         = romSize;
     RamSize         = ramSize;
     DestinationCode = destinationCode;
     RomVersion      = romVersion;
     HeaderChecksum  = headerChecksum;
     RomChecksum     = romChecksum;
 }