Exemplo n.º 1
0
 public void Run(ComputerMemory computerMemory)
 {
     SetValueParameters(computerMemory);
     Value = ValueParameters[PARAMETER2] * ValueParameters[PARAMETER1];
     computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = Value;
     computerMemory.SetNewPointer(Length);
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     mem = GetComponent <ComputerMemory>();
     foreach (var watch in watches)
     {
         var addr = Convert.ToUInt32(watch.addr, 16);
         mem.Subscribe("memdebug", new ComputerMemory.MemoryRange(addr, addr), OnMemoryChange);
     }
 }
Exemplo n.º 3
0
 public void Run(ComputerMemory computerMemory)
 {
     SetValueParameters(computerMemory);
     if (ValueParameters[1] == ValueParameters[2])
     {
         computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = 1;
     }
     else
     {
         computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = 0;
     }
     computerMemory.SetNewPointer(Length);
 }
Exemplo n.º 4
0
 public void Reset()
 {
     SP = 0xffff;
     PC = 0;
     ComputerMemory.Clear();
     H = 0;
     L = 0;
     D = 0;
     E = 0;
     B = 0;
     A = 0;
     Flags.Reset();
     InterruptsEnabled = true;
     IM.Mask           = 0x0;   //TODO: verify that this is the reset conditions
 }
Exemplo n.º 5
0
            public void Run(ComputerMemory computerMemory)
            {
                SetValueParameters(computerMemory);
                switch (WriteMode)
                {
                case ParameterMode.Position:
                case ParameterMode.Relative:
                    computerMemory.RelativeBase += computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)];
                    break;

                case ParameterMode.Immediate:
                    computerMemory.RelativeBase += (int)ValueParameters[Length - 1];
                    break;
                }
                computerMemory.SetNewPointer(Length);
            }
Exemplo n.º 6
0
 void Start()
 {
     SetStatus(Status.Initializing);
     mem = GetComponent <ComputerMemory>();
     try
     {
         fs                = File.Open(driveFilename, FileMode.Open, FileAccess.ReadWrite);
         driveInfo         = new DriveInfo();
         driveInfo.bytes   = (uint)fs.Length;
         driveInfo.sectors = (uint)Mathf.CeilToInt(fs.Length / (float)DeviceMemoryMap.HDD_SectorSize);
         driveAttached     = true;
     }
     catch (Exception ex)
     {
         Debug.LogError(ex);
         driveAttached = false;
     }
     ts = new ThreadStart(ExecutionThread);
     th = new Thread(ts);
     th.Start();
 }
Exemplo n.º 7
0
 void Start()
 {
     BuildRegisterMap();
     mem    = GetComponent <ComputerMemory>();
     timer  = GetComponent <ComputerTimerDevice>();
     screen = GetComponent <ComputerScreen>();
     flash  = FindObjectOfType <Flash>();
     Cpu.Init();
     initiated = true;
     Cpu.SetCPUType(cpuType);
     Cpu.SetCpuFrequencyMhz(cpuFrequency);
     Cpu.Read8           += mem.Read8;
     Cpu.Read16          += mem.Read16;
     Cpu.Read32          += mem.Read32;
     Cpu.ReadDasm16      += mem.Read16;
     Cpu.ReadDasm32      += mem.Read32;
     Cpu.Write8          += mem.Write8;
     Cpu.Write16         += mem.Write16;
     Cpu.Write32         += mem.Write32;
     executionThreadStart = new ThreadStart(CpuExecutionThread);
     Invoke("StartEmulation", 0.1f);
 }
Exemplo n.º 8
0
            public void Run(ComputerMemory computerMemory)
            {
                SetValueParameters(computerMemory);
                if (ValueParameters[1] != 0)
                {
                    switch (WriteMode)
                    {
                    case ParameterMode.Position:
                    case ParameterMode.Relative:
                        computerMemory.SetPointer(computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)]);
                        break;

                    case ParameterMode.Immediate:
                        computerMemory.SetPointer(ValueParameters[Length - 1]);
                        break;
                    }
                }
                else
                {
                    computerMemory.SetNewPointer(Length);
                }
            }
Exemplo n.º 9
0
    void Start()
    {
        mem      = GetComponent <ComputerMemory>();
        modes    = new GraphicsMode[4];
        modes[0] = new GraphicsMode(charWidth * textWidth, charHeight * textHeight, 2);
        modes[1] = new GraphicsMode(800, 600, 2);
        modes[2] = new GraphicsMode(800, 600, 1);
        modes[3] = new GraphicsMode(1024, 768, 2);
        ComputerMemory.MemoryRange screenRange = new ComputerMemory.MemoryRange(videoMemStart, memEnd);
        mem.Subscribe("Screen", screenRange, OnScreenMemoryChange);
        ComputerMemory.MemoryRange paletteRange = new ComputerMemory.MemoryRange(paletteStart, paletteEnd);
        mem.Subscribe("ScreenPalette", paletteRange, OnPaletteChange);
        ComputerMemory.MemoryRange modeTriggerRange = new ComputerMemory.MemoryRange(modeTrigger, modeTrigger);
        mem.Subscribe("ScreenModeTrigger", modeTriggerRange, OnModeChange);

        SwitchMode(0);
        SetDefaultPalette();
        SetDefaultCharset();
        isReady = true;

        // WriteTestScreen();
        // WriteTestText();
    }
Exemplo n.º 10
0
 public void Run(ComputerMemory computerMemory)
 {
     SetValueParameters(computerMemory);
     computerMemory.Memory[(int)ValueParameters[Length - 1] + (int)RelativeBaseWhenWriteModeIsReliativeBase(computerMemory)] = computerMemory.ProgramValue;
     computerMemory.SetNewPointer(Length);
 }
Exemplo n.º 11
0
 public void Run(ComputerMemory computerMemory)
 {
     Exit = true;
     computerMemory.SetNewPointer(Length);
 }