コード例 #1
0
    // 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();
    }