Ejemplo n.º 1
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);                                 // 101 4 105
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);  //106

            InstructionParam2 param2 = factory.getParam(9);                                 // 110 4 114
            int param2V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 10); //115


            if (param2 == InstructionParam2.Value)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(param2V);
            }
            else if (param2 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters [param2V].Name));
            }

            if (param1 == InstructionParam2.Value)
            {
                MemoryMap.Write(VM.Instance.CurrentCore.Neg(VM.Instance.CurrentCore.Register.Stack.Pop32()), (uint)param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Set(factory.m_pRegisters [param1V].Name, VM.Instance.CurrentCore.Neg(VM.Instance.CurrentCore.Register.Stack.Pop32()));
            }

            return(true);
        }
Ejemplo n.º 2
0
        public bool ParseAndRun(ParserFactory factory)
        {
            // 97 - 110
            // OP(97,4) P(101,1) VAL(102 ,4) P(106,1) VAL(107, 4) 111
            InstructionParam2 param1 = factory.getParam(4);                                 // 101 4
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);  //106
            InstructionParam2 param2 = factory.getParam(9);                                 // 110
            int param2V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 10); // 111

            if (param2 == InstructionParam2.Value)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(param2V);
            }
            else if (param2 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters [param2V].Name));
            }
            else if (param2 == InstructionParam2.Pointer)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(MemoryMap.Read32(param2V));
            }

            if (param1 == InstructionParam2.Pointer)
            {
                MemoryMap.Write(VM.Instance.CurrentCore.Register.Stack.Pop32(), (uint)param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Set(factory.m_pRegisters [param1V].Name, VM.Instance.CurrentCore.Register.Stack.Pop32());
            }

            return(true);
        }
Ejemplo n.º 3
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);

            InstructionParam2 param2 = factory.getParam(9);                                 // 110 4 114
            int param2V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 10); //115

            if (param1 == InstructionParam2.Value)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Stack.Push32(VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters[param1V].Name));
            }

            if (param2 == InstructionParam2.Value)
            {
                VM.Instance.CPU[VM.Instance.CurrentCore.Register.Stack.Pop32()].Running =
                    param2V == 1;
            }
            else if (param2 == InstructionParam2.Register)
            {
                VM.Instance.CPU[VM.Instance.CurrentCore.Register.Stack.Pop32()].Running =
                    VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters[param2V].Name) == 1;
            }

            return(true);
        }
Ejemplo n.º 4
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);                                 // 101 4 105
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);  //106

            InstructionParam2 param2 = factory.getParam(9);                                 // 110 4 114
            int param2V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 10); //115

            InstructionParam2 param3 = factory.getParam(14);                                // 119 4 123
            int param3V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 15);

            int x = 0, y = 0, colorRef = 0;

            if (param1 == InstructionParam2.Value)
            {
                x = (param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                x = (VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters [param1V].Name));
            }
            else if (param2 == InstructionParam2.Pointer)
            {
                x = MemoryMap.Read32(param1V);
            }

            if (param2 == InstructionParam2.Value)
            {
                y = (param2V);
            }
            else if (param2 == InstructionParam2.Register)
            {
                y = (VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters [param2V].Name));
            }
            else if (param2 == InstructionParam2.Pointer)
            {
                y = MemoryMap.Read32(param2V);
            }

            if (param3 == InstructionParam2.Value)
            {
                colorRef = (param3V);
            }
            else if (param3 == InstructionParam2.Register)
            {
                colorRef = (VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters [param3V].Name));
            }
            else if (param3 == InstructionParam2.Pointer)
            {
                colorRef = MemoryMap.Read32(param3V);
            }

            VM.Instance.FBdev.SetPixel(colorRef, x, y);
            return(true);
        }
Ejemplo n.º 5
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);

            if (!VM.Instance.CurrentCore.Register.OverFlow)
            {
                if (param1 == InstructionParam2.Value || param1 == InstructionParam2.Lable)
                {
                    VM.Instance.CurrentCore.Register.Set("IP", param1V);
                }
                else if (param1 == InstructionParam2.Register)
                {
                    VM.Instance.CurrentCore.Register.Set("IP", VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters[param1V].Name));
                }
                else if (param1 == InstructionParam2.Pointer)
                {
                    VM.Instance.CurrentCore.Register.Set("IP", MemoryMap.Read32(param1V));
                }
            }
            else
            {
                VM.Instance.CurrentCore.Register.Set("IP", VM.Instance.CurrentCore.Register.ip + 9);
            }
            return(true);
        }
Ejemplo n.º 6
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);

            if (param1 == InstructionParam2.Pointer)
            {
                MemoryMap.Write(VM.Instance.CurrentCore.Register.Stack.Pop32(), (uint)param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Register.Set(factory.m_pRegisters [param1V].Name, VM.Instance.CurrentCore.Register.Stack.Pop32());
            }
            return(true);
        }
Ejemplo n.º 7
0
        public bool ParseAndRun(ParserFactory factory)
        {
            InstructionParam2 param1 = factory.getParam(4);
            int param1V = VM.Instance.Ram.Read32(VM.Instance.CurrentCore.Register.ip + 5);

            if (param1 == InstructionParam2.Value)
            {
                VM.Instance.CurrentCore.Akku.Div(param1V);
            }
            else if (param1 == InstructionParam2.Register)
            {
                VM.Instance.CurrentCore.Akku.Div(VM.Instance.CurrentCore.Register.Get(factory.m_pRegisters [param1V].Name));
            }
            else if (param1 == InstructionParam2.Pointer)
            {
                VM.Instance.CurrentCore.Akku.Div(MemoryMap.Read32(param1V));
            }

            return(true);
        }