Beispiel #1
0
        private void LoadSymbols(byte[] prg, int start)
        {
            ProgramReader r = new ProgramReader(prg, start);

            while (r.GetCounter() < Functions[0] + start)
            {
                string         str = r.NextString();
                RangeContainer c   = MMU.Alloc(str.Length + 1);

                Array.Copy(str.Select(i => (byte)i).ToArray(), c.Memory, str.Length);
            }
        }
Beispiel #2
0
        public void ExecNextOp()
        {
            Registers.JumpCarry = false;

            if (!Stack.Any())
            {
                Running = false;
                return;
            }

            ActiveStackContainer = Stack.Peek();
            int counter = ActiveStackContainer.ProgramCounter;

            OPCodes.Codes code   = GetOPCode(counter);
            ProgramReader reader = new ProgramReader(this, counter);

            reader.NextInt();

            if (ActiveStackContainer is LibStackContainer)
            {
                ProgramReader r = new ProgramReader(ActiveStackContainer.Memory.Memory, 0);

                ActiveStackContainer.As <LibStackContainer>().Invoke(LibraryHandler, r);
                OPCalls.Functions.FunctionPop(this, reader);
            }
            else
            {
                Func <Processor, ProgramReader, int> fct = OPCodesActions.Actions[code];
                counter += fct(this, reader);
            }

            if (!Registers.JumpCarry)
            {
                ActiveStackContainer.ProgramCounter = counter;
            }
        }
Beispiel #3
0
        public int Invoke(LibraryHandler lh, ProgramReader r)
        {
            lh.Invoke(r, Library, Function);

            return(r.Elapsed());
        }