Beispiel #1
0
        public CompiledZMachine(Story story, bool precompile = false, bool debugging = false, IZMachineProfiler profiler = null)
            : base(story)
        {
            this.profiler   = profiler;
            this.precompile = precompile;
            this.debugging  = debugging;

            this.objectTableAddress               = this.Memory.ReadWord(0x0a);
            this.propertyDefaultsTableSize        = (byte)(this.Version < 4 ? 31 : 63);
            this.objectEntriesAddress             = (ushort)(this.objectTableAddress + (this.propertyDefaultsTableSize * 2));
            this.objectEntrySize                  = (byte)(this.Version < 4 ? 9 : 14);
            this.objectParentOffset               = (byte)(this.Version < 4 ? 4 : 6);
            this.objectSiblingOffset              = (byte)(this.Version < 4 ? 5 : 8);
            this.objectChildOffset                = (byte)(this.Version < 4 ? 6 : 10);
            this.objectPropertyTableAddressOffset = (byte)(this.Version < 4 ? 7 : 12);
            this.objectAttributeByteCount         = (byte)(this.Version < 4 ? 4 : 6);
            this.objectAttributeCount             = (byte)(this.Version < 4 ? 32 : 48);

            this.dictionaryAddress = this.Memory.ReadWord(0x08);

            this.packResolution = this.Version < 4 ? 2 : this.Version < 8 ? 4 : 8;
            this.routinesOffset = (this.Version >= 6 && this.Version <= 7) ? Memory.ReadWord(0x28) : 0;
            this.stringsOffset  = (this.Version >= 6 && this.Version <= 7) ? Memory.ReadWord(0x2a) : 0;

            this.routineTable            = new ZRoutineTable(story);
            this.addressToRoutineCallMap = new IntegerMap <ZRoutineCall>(8192);
            this.compilationResults      = new IntegerMap <ZCompilerResult>(8192);

            this.localArrayPool = new Stack <ushort[]>();

            if (this.precompile)
            {
                foreach (var routine in routineTable)
                {
                    GetRoutineCall(routine.Address);
                }

                this.precompile = false;
            }
        }
 public StackFrameViewModel(StackFrame stackFrame, ZRoutineTable routineTable)
 {
     this.stackFrame   = stackFrame;
     this.routineTable = routineTable;
 }
Beispiel #3
0
 public StackFrameViewModel(StackFrame stackFrame, ZRoutineTable routineTable, uint jumpToAddress)
 {
     this.stackFrame    = stackFrame;
     this.routineTable  = routineTable;
     this.jumpToAddress = jumpToAddress;
 }
Beispiel #4
0
 private void StoryService_StoryClosed(object sender, StoryClosedEventArgs e)
 {
     routineTable = null;
 }
Beispiel #5
0
 private void StoryService_StoryOpened(object sender, StoryOpenedEventArgs e)
 {
     routineTable = new ZRoutineTable(e.Story);
 }