示例#1
0
        public override void Reset()
        {
            PR  = 0x37;
            DDR = 0x2f;

            RAM = new RAMMemoryChip(0x0000, 0xffff);

            Kernel = new ROMMemoryChip(0xe000, 0xffff);
            Kernel.SetROM(ROM_KERNAL);

            BASIC_ROM = new ROMMemoryChip(0xa000, 0xbfff);
            BASIC_ROM.SetROM(ROM_BASIC);

            IO_MAP     = new IOMemoryChip(C64, 0xd000, 0xefff);
            CHAREN_ROM = new ROMMemoryChip(0xd000, 0xdfff);
            CHAREN_ROM.SetROM(ROM_CHAREN);

            ROM_HI_A000 = new ROMMemoryChip(0xa000, 0xbfff);
            ROM_HI_E000 = new ROMMemoryChip(0xe000, 0xffff);
            ROM_LO      = new ROMMemoryChip(0x8000, 0x9fff);

            // ROM_HI_A000.WriteToRam = false;
            ROM_HI_E000.WriteToRam = false;
            // ROM_LO.WriteToRam = false;

            PrepareBankCache(0x37);
        }
示例#2
0
        public override byte Read(int _address, bool _internal)
        {
            if (_address == 0x00)
            {
                //  DDR
                return(DDR);
            }
            if (_address == 0x01)
            {
                // PR

                //  datasette
                // bit 4: sense == 0 if any key pressed
                PR &= 0xef; // clear bit 4
                if (!C64.Datasette.Get_F6_SENSE())
                {
                    PR |= 0x10;
                }

                return(PR);
            }

            MemoryChip mem  = SelectBank(_address);
            byte       data = mem.Read(_address, _internal);

            return(data);
        }
示例#3
0
        public override void Write(int _address, byte _data, bool _internal)
        {
            if (_address == 0x00)
            {
                //  DDR
                DDR = _data;
            }
            if (_address == 0x01)
            {
                // PR
                if ((_data & 0x07) != (PR & 0x07))
                {
                    PrepareBankCache(_data);
                }

                PR = _data;

                //  datasette
                // bit 3: write
                C64.Datasette.Set_E5_WRITE((PR & 0x08) == 0);
                // bit 5: Motor
                C64.Datasette.Set_C3_MOTOR((PR & 0x20) == 0);
            }

            MemoryChip mem = SelectBank(_address);

            if (mem.IsROM)
            {
                //  write through?
                if (!mem.WriteToRam)
                {
                    return;
                }

                mem = GetRAM();
            }

            mem.Write(_address, _data, _internal);
        }