Пример #1
0
        private void FinaliseSegment()
        {
            if (instructions.Count > 0)
            {
                ISegment newSegment;

                switch (context)
                {
                    case SegmentType.Basic:
                        newSegment = new BasicSegment(instructions.DequeueAll(), relativeLabels.DequeueAll());
                        break;

                    case SegmentType.Code:
                        newSegment = new CodeSegment(instructions.DequeueAll(), relativeLabels.DequeueAll());
                        newSegment.Base = segments.AssembledLength();
                        break;

                    default:
                        throw new FormatException("Unimplemented segment type " + context);
                }

                segments.Add(newSegment);
            }
        }
Пример #2
0
 public FreestandingExecutable(CodeSegment csect, DataSegment dsect)
 {
     text = csect;
     globals = dsect;
 }