예제 #1
0
 public Bus(RedBus redBus, int size)
 {
     RedBus      = redBus;
     devices     = new List <Device>(size);
     boundaries  = new int[0];
     BusCapacity = size;
 }
예제 #2
0
파일: Machine.cs 프로젝트: 0xF6/CPU-J65EL02
 public void Down()
 {
     //56mb
     this.cpu.Dispose();
     this.bios   = null;
     this.redBus = null;
     this.bus    = null;
     this.cpu    = null;
     GC.Collect();
     //55mb (-2.3kb)
 }
예제 #3
0
        public Device findDevice(int address)
        {
            if (RedBus.inRange(address))
            {
                return(RedBus);
            }
            var idx = Array.BinarySearch(boundaries, address);

            if (idx < 0)
            {
                idx = -idx - 2;
            }
            if (idx < 0)
            {
                return(new CorruptedDevice());
            }
            return(devices[idx]);
        }
예제 #4
0
파일: Machine.cs 프로젝트: 0xF6/CPU-J65EL02
        /// <summary>
        /// Constructs the machine with the given RAM size and load a bootloader into memory.
        /// The bootloader is loaded at address 0x400 to 0x500.
        /// </summary>
        /// <param name="bootloader">
        /// The path to the bootloader file
        /// </param>
        /// <param name="coreRamSize">
        /// The size of RAM in bytes
        /// </param>
        public Machine(string bootloader, string os, int coreRamSize)
        {
            try
            {
                bios    = new Bios(this, 0x0100, "PGX");
                cpu     = new CPU(IsLight);
                redBus  = new RedBus(cpu);
                bus     = new Bus(redBus);
                cpu.Bus = (bus);
                var deb = new Debugger(cpu);

                cpu.linkDebugger(deb);

                var ram = new Memory(0x0000, coreRamSize - 1, cpu);
                if (bootloader != null)
                {
                    ram.loadFromFile(bootloader, 0x0300, 0x4268, "bootloader");
                }
                if (os != null)
                {
                    ram.loadFromFile(os, 0x0300, 0x4268, "os");
                }
                bus.AddDevice(ram);
                //bus.AddDevice(new Acia6850(0x8800, cpu)); // invalid instruction page
                bus.AddDevice(new Acia6551(0x8800, cpu));
                bus.AddDevice(new CRTC(0x9000, cpu, ram));
                //bus.AddDevice(new WIFICard(0x10000, cpu)); // wtf, hault on divide by zero
                bus.AddDevice(new WirelessTerminal(0x9500, cpu)); // in address 0x10k, wsod on register overflow
            }
            catch (Exception e)
            {
                cpu.Hault(e);
                Down();
            }
            reset();
            coldUpCPU();
        }
예제 #5
0
 public void update() => RedBus.updatePeripheral();
예제 #6
0
 public Bus(RedBus redBus) : this(redBus, 0x10)
 {
 }
예제 #7
0
파일: Bios.cs 프로젝트: 0xF6/CPU-J65EL02
 public Bus initBus()
 {
     redBus = new RedBus(cpu);
     return(new Bus(redBus));
 }