// Start is called before the first frame update void Start() { // Fetch the display print("Getting graphics view!"); GameObject uiview = GameObject.FindWithTag("VirtualDisplay"); VirtualDisplayHAL display = uiview.GetComponent <VirtualDisplayHAL>(); // Create and launch a system! print("Building system components"); CPUCore mainCore = gameObject.AddComponent <CPUCore>(); ALU alu0 = gameObject.AddComponent <ALU>(); Memory ram = gameObject.AddComponent <Memory>(); CPU processor = gameObject.AddComponent <CPU>(); print("Building boot disk!"); Memory bootDisk = getBootDisk(); print("Building RAM!"); ram.Instantiate(1024); print("Building CORE0"); alu0.Instantiate(mainCore); mainCore.setALU(alu0); print("Building CPU"); processor.Instantiate(new CPUCore[] { mainCore }, ram, bootDisk, display); mainCore.setParent(processor); print("Booting!"); processor.bootup(); }
// Constructor public void Instantiate(CPUCore[] cores, Memory ram, Memory disk) { // this.bus_north = new Buss(); // this.bus_south = new Buss(); this.cores = cores; this.ram = ram; this.disk = disk; this.display = null; this.event_cpu_cycle = new UnityEvent(); }
public void Instantiate(CPUCore[] cores, Memory ram, Memory disk, VirtualDisplayHAL display) { // this.bus_north = new Buss(); // this.bus_south = new Buss(); this.cores = cores; this.ram = ram; this.disk = disk; this.display = display; // Setup event system! this.event_cpu_cycle = new UnityEvent(); foreach (CPUCore core in this.cores) { this.event_cpu_cycle.AddListener(core.cpu_clock); } }