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); } }
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; } }
public int Invoke(LibraryHandler lh, ProgramReader r) { lh.Invoke(r, Library, Function); return(r.Elapsed()); }