コード例 #1
0
ファイル: RandomAccessMemory.cs プロジェクト: wchill/Z80Sharp
 public RandomAccessMemory(ushort beginAddress, ReadOnlySpan <byte> memory, MemoryLines connections)
 {
     _memory      = memory.ToArray();
     BeginAddress = beginAddress;
     EndAddress   = (ushort)(beginAddress + _memory.Length - 1);
     Connections  = connections;
     Connections.AttachMemory(this);
 }
コード例 #2
0
ファイル: RandomAccessMemory.cs プロジェクト: wchill/Z80Sharp
        public RandomAccessMemory(ushort beginAddress, int size, MemoryLines connections)
        {
            if (size < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(size), "Size must be greater than zero");
            }

            _memory      = new byte[size];
            BeginAddress = beginAddress;
            EndAddress   = (ushort)(beginAddress + _memory.Length - 1);
            Connections  = connections;
            Connections.AttachMemory(this);
        }
コード例 #3
0
        public Z80System()
        {
            DataBus    = new DataBus();
            AddressBus = new AddressBus();
            Z80Clock   = new PassthroughClock();
            CpuLines   = new Z80CPULines
            {
                AddressBus  = AddressBus,
                DataBus     = DataBus,
                SystemClock = Z80Clock,
                BUSACK      = new TristateWire(),
                BUSREQ      = new TristateWire(TristateWireState.PullUp),
                HALT        = new TristateWire(),
                INT         = new TristateWire(TristateWireState.PullUp),
                IORQ        = new TristateWire(),
                M1          = new TristateWire(),
                MREQ        = new TristateWire(),
                NMI         = new TristateWire(TristateWireState.PullUp),
                RD          = new TristateWire(),
                RESET       = new TristateWire(TristateWireState.PullUp),
                RFSH        = new TristateWire(),
                WAIT        = new TristateWire(TristateWireState.PullUp),
                WR          = new TristateWire()
            };

            var memoryConnects = new MemoryLines
            {
                AddressBus = AddressBus,
                Clock      = Z80Clock,
                DataBus    = DataBus,
                MREQ       = CpuLines.MREQ,
                RD         = CpuLines.RD,
                WAIT       = CpuLines.WAIT,
                WR         = CpuLines.WR
            };

            Memory = new RandomAccessMemory(0, 0x10000, memoryConnects);
            Cpu    = new Z80CPU(CpuLines);
        }