Home » Archimedes archive » Zipped Apps » BCPL » BCPL/b/cge

BCPL/b/cge

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Zipped Apps » BCPL
Filename: BCPL/b/cge
Read OK:
File size: 496D bytes
Load address: 0000
Exec address: 0000
File contents
SECTION "CGE"

GET "b.CGheader"

STATIC
$( /* Version of 11 Sep 87 13:42:08
   */
   dummy = VersionMark
   version = 1*256+9 $);

MANIFEST
$( PendingBufferSize = 10;
   MaxPendingInst = 4;
   pi.size = 10;

   pi.F1Inst=1; pi.F2Inst=2; pi.F4Inst=4; pi.F5Inst=5;
   pi.GenF2=6; pi.F5InstL=7; pi.F5InstLM=8;
   pi.SetRtoRplusLplusK=9;
   pi.SetLabel=10;
   pi.f5InstX=11 $);

MANIFEST
$( sll.loc = 1; sll.reg = 2; sll.offset = 3;
   sll.size = 4 $);

STATIC
$( pendingCount = 0;
   pendingInsts = 0; otherBranch = 0;
   eightBitMask = 0 $);

LET InitPendingInsts() BE
$( pendingInsts, otherBranch := 0, 0;
   pendingLab, pendingCount := Null, 0
$)

AND AddPendingInst(a, b, c, d, e, f, g, h, i) BE
$( pendingInsts := FillBlk(pi.size, pendingInsts,
			       a, b, c, d, e, f, g, h, i);
   pendingCount := pendingCount+1
$)

AND PlantInstructionChain(p, m) BE
$( p := ReverseInPlace(p);
   WHILE p~=0 DO $(
      SWITCHON 1!p INTO
      $( CASE pi.SetLabel:
	    RealSetLabel(2!p);
	    ENDCASE
	 CASE pi.F5Inst:
	    F5Inst(2!p, 3!p, m);
	    ENDCASE
	 CASE pi.F5InstX:
	    F5InstX(2!p, 3!p, m);
	    ENDCASE
	 CASE pi.F4Inst:
	    F4InstM(2!p, 3!p, 4!p, 5!p, m);
	    ENDCASE
	 CASE pi.F2Inst:
	    F2Inst(2!p, 3!p, 4!p, 5!p, 6!p, 7!p, 8!p, 9!p, m);
	    ENDCASE
	 CASE pi.F1Inst:
	    F1Inst(2!p, 3!p, 4!p, 5!p, 6!p, 7!p, 8!p, m);
	    ENDCASE
	 CASE pi.GenF2:
	    GenF2M(2!p, 3!p, 4!p, 5!p, 6!p, m);
	    ENDCASE
	 CASE pi.F5InstL:
	    F5InstL2(2!p, 3!p, m);
	    ENDCASE
	 CASE pi.F5InstLM:
	    F5InstL2(2!p, 3!p, 4!p);
	    ENDCASE
	 CASE pi.SetRtoRplusLplusK:
	    SetRtoRplusLplusKM(2!p, 3!p, 4!p, 5!p, m);
	    ENDCASE
      $);
      p := FreeBlk(p, pi.size) $)
$)

AND PlantCopy(l, m) BE
   PlantInstructionChain(CopyOfList(l, pi.size), m)

AND SameInstruction(p, q) = VALOF
$( IF 1!p~=1!q | 2!p~=2!q | 3!p~=3!q THEN RESULTIS FALSE;
   SWITCHON 1!p INTO
   $( CASE pi.F5Inst:
      CASE pi.F5InstX:
      CASE pi.F5InstL:
	 RESULTIS TRUE
      CASE pi.F2Inst:
	 IF 9!p~=9!q THEN RESULTIS FALSE
      CASE pi.F1Inst:
	 IF 7!p~=7!q | 8!p~=8!q THEN RESULTIS FALSE
      CASE pi.GenF2:
	 IF 6!p~=6!q THEN RESULTIS FALSE
      CASE pi.F4Inst:
      CASE pi.SetRtoRplusLplusK:
	 IF 5!p~=5!q THEN RESULTIS FALSE
      CASE pi.F5InstLM:
	 RESULTIS 4!p=4!q
   $)
$)

AND CommonSequence(p) = VALOF
$( WHILE SameInstruction(pendingInsts, otherBranch) DO $(
      LET q = pendingInsts;
      pendingInsts := !pendingInsts;
      !q := p; p := q;
      otherBranch := FreeBlk(otherBranch, pi.size) $);
   IF (CGDebugMode&db.cs)~=0 THEN
      PrintList(p, pi.size, "common", ":", "*n")
   RESULTIS p
$)

AND LabelInPendingInsts(p) = VALOF
$( IF Assoc(pi.SetLabel, 1, p)=Null THEN RESULTIS FALSE;

   WHILE p~=0 DO $(
      IF 1!p~=pi.SetLabel THEN RESULTIS TRUE;
      p := !p $);
   RESULTIS FALSE
$)

AND FirstPendingInst(a, b, c, d, e) =
	 1!pendingInsts=a &
	 (b=Null | 2!pendingInsts=b) &
	 (c=Null | 3!pendingInsts=c) &
	 (d=Null | 4!pendingInsts=d) &
	 (e=Null | 5!pendingInsts=e)

AND FlushPendingInsts(m, atLab) BE
$( LET pl = pendingLab;
   LET dc = deadCode;
   LET mcopy = m;
   LET plantAtEnd = 0;
   LET labAtEnd, otherCaseLab = Null, Null;

   IF pendingLab=Null THEN RETURN;
   IF (CGDebugMode&db.cs)~=0 THEN $(
      WriteF("FlushPI %x8 %n op %n lab %n*n", m, atLab, op, pendingLab);
      PrintList(pendingInsts, pi.size, "pending", ":", "*n");
      PrintList(otherBranch, pi.size, "other", ":", "*n") $);

   IF atLab & m=Null &
      FirstPendingInst(pi.F5InstL, pendingLab, f.b, Null, Null) THEN $(
      LET q = pendingInsts;
      pendingInsts := !pendingInsts;
      plantAtEnd := q; !q := 0;
      m := pendingMask $);

   deadCode := Alive;
   pendingLab := Null;
   m := ComplementCondition(m);

   IF plantAtEnd=0 & m~=m.always &
      ([FirstPendingInst(pi.F5InstL, Null, f.b, Null, Null) &
	LabelFlagged(pl, lab.onlyonejump)] |

       FirstPendingInst(pi.F1Inst, f.mov, r.pc, r.pc, r.b) |

       FirstPendingInst(pi.F1Inst, f.movs, r.pc, 0, r.14) |

       FirstPendingInst(pi.F2Inst, f.ldr, r.pc, r.pc, Null) |

       FirstPendingInst(pi.GenF2, f.ldr, r.pc, Null, Null) |

       FirstPendingInst(pi.F4Inst, f.ldm, r.p, f4.plpc, Null)) THEN $(
      LET l = 2!pendingInsts;
      LET o = otherBranch;
      IF 1!pendingInsts~=pi.F5InstL THEN l := -2;
      IF l<0 | ValueOfLabel(l)=Null THEN $(
	 otherBranch:= l<0 -> pendingInsts,
			      FreeBlk(pendingInsts, pi.size);
	 pendingInsts := o;
	 pendingCount := LengthOfList(o);
	 pendingLab, pendingMask := l, m;
	 RETURN $) $);

   IF otherBranch~=0 THEN $(
      // see whether there are common sets of instructions
      // between the two sequences.
      LET plantAtStart = 0;
      LET p = plantAtEnd;

      IF atLab THEN plantAtEnd := CommonSequence(plantAtEnd);

      pendingInsts := ReverseInPlace(pendingInsts);
      otherBranch := ReverseInPlace(otherBranch);
      plantAtStart := CommonSequence(0);

      pendingInsts := ReverseInPlace(pendingInsts);
      otherBranch := ReverseInPlace(otherBranch);

      PlantInstructionChain(plantAtStart, m.always);

      TEST LengthOfList(otherBranch)<=MaxPendingInst &
	   ~LabelInPendingInsts(otherBranch) THEN $(
	 PlantInstructionChain(otherBranch, pendingMask);
	 IF plantAtEnd~=p THEN
	    TEST pl<0 & LengthOfList(plantAtEnd)=1 &
		 1!plantAtEnd=pi.F5InstL THEN $(
	       PlantCopy(plantAtEnd, pendingMask);
	       m := m.always $)
	    ELSE $(
	       m := ComplementCondition(pendingMask);
	       labAtEnd := NextLabel() $) $)

      ELSE $(
	 otherCaseLab := NextLabel();
	 F5InstL2(otherCaseLab, f.b, ComplementCondition(pendingMask));
	 PlantInstructionChain(otherBranch, m.always);
	 IF plantAtEnd~=p THEN $(
	    PlantCopy(plantAtEnd, m.always);
	    m := m.always $) $)
   $);

   TEST pl>=0 & m=m.always THEN
      F5InstL2(pl, f.b, pendingMask)

   ELSE IF LengthOfList(pendingInsts)>MaxPendingInst |
	   LabelInPendingInsts(pendingInsts) THEN $(
      TEST labAtEnd~=Null THEN
	 F5InstL2(labAtEnd, f.b, PendingMask)
      ELSE IF pl>=0 THEN
	 F5InstL2(pl, f.b, PendingMask);
      m := m.always $);

   IF otherCaseLab~=Null THEN RealSetLabel(otherCaseLab);
   PlantInstructionChain(pendingInsts, m);

   plantAtEnd := ReverseInPlace(plantAtEnd);
   IF labAtEnd~=Null THEN SetLabel(labAtEnd);
   PlantInstructionChain(plantAtEnd, m.always);
   IF mcopy=Null & labAtEnd~=Null & pl>=0 THEN
      f5InstL2(pl, f.b, pendingMask);

   pendingCount := 0;
   otherBranch, pendingInsts := 0, 0;
   deadCode := dc
$)

AND SetLabel(l) BE
   TEST PendingLab~=Null
      THEN AddPendingInst(pi.SetLabel, l)
      ELSE RealSetLabel(l)

AND ShiftValue(shiftType, shiftBy, r2) =
  // shiftBy is positive if the shift is by a constant,
  // negative if by the value of a register (= -regno)
   shiftType=Null -> r2,
   shiftBy>=0 -> r2+shiftType+(shiftBy<<7),
		 r2+shiftType+#x10+((-shiftBy)<<8)

AND LogBase2(n) = VALOF
$( LET i = 0;
   WHILE (n&1)=0 DO n, i := n>>1, i+1;
   RESULTIS i
$)

AND F5Inst(opcode, offset, mask) BE
   IF deadCode~=Dead THEN $(
      IF pendingLab~=Null THEN
	 TEST pendingCount<PendingBufferSize THEN $(
	    AddPendingInst(pi.F5Inst, opcode, offset);
	    RETURN $)
	 ELSE
	    FlushPendingInsts(Null, FALSE);

      PutWord(opcode+mask+(([offset-LocCtr-8]>>2)&#x00ffffff))
$)


AND F5InstX(opcode, sym, mask) BE
   IF deadCode~=Dead THEN $(
      IF pendingLab~=Null THEN
	 TEST pendingCount<PendingBufferSize THEN $(
	    AddPendingInst(pi.F5InstX, opcode, sym);
	    RETURN $)
	 ELSE
	    FlushPendingInsts(Null, FALSE);

      AddXRelocatedLoc(locCtr, sym, RelWord+RelPCRel+RelSymbol);
      PutWord(opcode+mask)
$)

AND F4Inst(opcode, base, RegList, wb.dir.prepost.pc) BE
   F4InstM(opcode, base, RegList, wb.dir.prepost.pc, m.always)

AND F4InstM(opcode, base, regList, wb.dir.prepost.pc, mask) BE
   IF deadCode~=Dead THEN $(
      IF pendingLab~=Null THEN
	 TEST pendingCount<PendingBufferSize THEN $(
	    AddPendingInst(pi.F4Inst, opcode, base, regList,
				      wb.dir.prepost.pc);
	    RETURN $)
	 ELSE
	    FlushPendingInsts(Null, FALSE);

   PutWord(opcode+mask+wb.dir.prepost.pc+(base<<16)+regList)
$)

AND F2Inst(opcode, reg, base, offset, r2,
	   prepost, shiftType, shiftBy, mask) BE
   IF deadCode~=Dead THEN $(
      LET addrType = ?;
      IF pendingLab~=Null THEN
	 TEST pendingCount<PendingBufferSize THEN $(
	    AddPendingInst(pi.F2Inst, opcode, reg, base, offset, r2,
				      prepost, shiftType, shiftBy);
	    RETURN $)
	 ELSE
	    FlushPendingInsts(Null, FALSE);

      TEST r2~=Null THEN $(
	 addrType := #x2000000
	 offset := ShiftValue(shiftType, shiftBy, r2) $)

      ELSE TEST offset<0 THEN
	 addrType, offset := f.down, -offset
      ELSE
	 addrType := f.up;

      IF ~(0<=offset<=f2.max.offset) THEN $(
	 CGError(FALSE, "F2Inst: offset %n", offset);
	 offset := 0 $);

      PutWord(mask+opcode+prepost+addrType+(base<<16)+
	      (reg<<12)+offset) $)

AND PackUp(offset) =
   offset=0 -> 0, VALOF
   $( LET lsbit = offset&(-offset);
      LET shift = 0;
      TEST lsbit>2 THEN $(
	 shift := 32-[LogBase2(lsbit) & (-2)];
	 TEST shift=32 THEN
	    shift := 0
	 ELSE
	    offset := offset>>(32-shift) $)
      ELSE $(
	 LET n = offset;
	 WHILE (n&#xc0000000)~=0 DO $(
	    n := n<<2; shift := shift+2 $);
	 offset := RotateRight(offset, 32-shift) $);

      IF offset>=#x100 THEN $(
	 CGError(FALSE, "F1Inst: Offset %x8 will not fit in 8 bits",
			RotateRight(offset, shift));
	 offset := 0 $);

      RESULTIS offset + (shift<<7)
   $)

AND F1Inst(opcode, reg, base, r2, offset, shiftType, shiftBy, m) BE
   IF deadCode~=Dead THEN $(
      LET addrType = ?
      IF pendingLab~=Null THEN
	 TEST m=m.always & pendingCount<PendingBufferSize THEN $(
	    AddPendingInst(pi.F1Inst, opcode, reg, base, r2,
				      offset, shiftType, shiftBy);
	    RETURN $)
	 ELSE
	    FlushPendingInsts(Null, FALSE);

      TEST r2=Null THEN $(
	 addrType := #x2000000;
	 offset := PackUp(offset) $)
      ELSE $(
	 addrType:= 0;
	 offset := ShiftValue(shiftType, shiftBy, r2) $);

      PutWord(m+opcode+addrType+(base<<16)+offset+(reg<<12)) $)

AND GenF1K(f, r, s, k) BE
$( LET e = EightBitsOrFewer(k);
   LET m = eightBitMask;
   TEST e THEN
      F1Inst(f, r, s, Null, k, Null, 0, m.always)
   ELSE TEST (f=f.add | f=f.sub | f=f.orr | f=f.eor | f=f.bic) &
	     EightBitsOrFewer(k&~m) THEN $(
      GenF1K(f, r, s, k&m);
      GenF1K(f, r, r, k&~m) $)
   ELSE $(
      SetRtoK(r.0, k);
      r0Offset := Null;
      GenRR(f, r, s, r.0) $)
$)

AND CompareAgainstK(r, k, cm) BE {
   LET e = EightBitsOrFewer(k);
   LET m = eightBitMask;
   LET unsigned = cm=m.gtu | cm=m.geu | cm=m.ltu | cm=m.leu;
   TEST e THEN
      F1Inst(f.cmps, r, r, Null, k, Null, 0, m.always)
   ELSE TEST k<0 & ~unsigned & EightBitsOrFewer(-k) THEN
      F1Inst(f.cmns, r, r, Null, -k, Null, 0, m.always)
   ELSE TEST ~unsigned & k>0 & EightBitsOrFewer(k&~m) THEN
      TEST cm=m.eq | cm=m.ne THEN {
	 GenF1K(f.sub, r.0, r, k&m);
	 GenF1K(f.subs, r.0, r.0, k&~m);
	 r0Offset := Null }
      ELSE {
	 F1Inst(f.subs, r.0, r, Null, k&m, Null, 0, m.always);
	 F1Inst(f.subs, r.0, r.0, Null, k&~m, Null, 0, m.ge);
	 r0Offset := Null }
   ELSE TEST unsigned & EightBitsOrFewer(k&~m) THEN {
      F1Inst(f.subs, r.0, r, Null, k&m, Null, 0, m.always);
      F1Inst(f.subs, r.0, r.0, Null, k&~m, Null, 0, m.geu);
      r0Offset := Null }
   ELSE {
      SetRtoK(r.0, k);
      r0Offset := Null;
      GenRR(f.cmps, r, r, r.0) } }

AND GenRR(f, r, s, r2) BE
   F1Inst(f, r, s, r2, 0, Null, 0, m.always)

AND GenF2(f, r, base, lab, offset) BE
$( IF pendingLab~=Null THEN
      TEST pendingCount<PendingBufferSize THEN $(
	 AddPendingInst(pi.GenF2, f, r, base, lab, offset);
	 RETURN $)
      ELSE
	 FlushPendingInsts(Null, FALSE);
   GenF2M(f, r, base, lab, offset, m.always)
$)

AND GenF2M(f, r, base, lab, offset, m) BE
   TEST lab~=0 THEN $(
      LET laboffset = ValueOfLabel(lab);
      LET fop = (f&#xf00)~=0;
      IF laboffset~=Null & fop THEN
	 laboffset := laboffset/BytesPerWord
      /* Yeuch!!  Floating point offsets are scaled */
      TEST laboffset=Null THEN $(
	 addref(LocCtr, (fop -> 6, 2), lab)
	 F2Inst(f, r, base, offset, Null, f.pre, Null, 0, m) $)
      ELSE F2Inst(f, r, base, offset+laboffset,
			Null, f.pre, Null, 0, m) $)

   ELSE $(
      LET max = f2.max.offset;
      IF (op&#xf00)~=0 THEN max := #xff;
      IF ~(-max<=offset<=max) THEN $(
	 LET o = [offset/(max+1)]*(max+1);
	 SetRtoRplusKM(r.0, base, o, m);
	 offset := offset-o;
	 r0Offset := Null;
	 base := r.0 $);
      F2Inst(f, r, base, offset, Null, f.pre, Null, 0, m) $)

AND CallSub(sr) BE
$( DiscardReg(r.14, k.reg);
   GenRR(f.mov, r.14, 0, r.pc);
   SetRtoRplusK(r.pc, r.gb, sr)
$)

AND SetRtoRplusLplusK(r, s, l, k) BE
   TEST s=r.l THEN $(
      // IF s is rl, I assert that l will always be a label
      // whose value (relative to rl) is known.
      LET n = Assoc(l, 1, staticLabels);
      TEST n=Null THEN
	 CGError(FALSE, "SetRtoRplusLplusK: unset label %n*n", l)
      ELSE
	 SetRtoRplusK(r, s, k+(3!n)) $)

   ELSE $(
      IF pendingLab~=Null THEN
	 TEST pendingCount<PendingBufferSize THEN $(
	    AddPendingInst(pi.SetRToRplusLplusK, r, s, l, k);
	    RETURN $)
	 ELSE
	    FlushPendingInsts(Null, FALSE);
      SetRToRplusLplusKM(r, s, l, k, m.always) $)

AND SetRToRPlusLplusKM(r, s, l, k, m) BE
$( AddRef(locCtr, 1, l);
   SetRToRplusKM(r, s, k, m)
$)

AND SetRtoRplusKM(r, s, k, m) BE
   TEST EightBitsOrFewer(k) THEN
      F1Inst(f.add, r, s, Null, k, Null, 0, m)
   ELSE TEST EightBitsOrFewer(-k) THEN
      F1Inst(f.sub, r, s, Null, -k, Null, 0, m)
   ELSE $(
      BackTrace();
      CGError(FALSE, "SetRtoRplusKM: offset %n out of range", k) $)

AND SetRtoRplusK(r, s, k) BE
$( LET m, mn = ?, ?;
   eightBitMask := 255;
   IF EightBitsOrFewer(k) THEN $(
      GenF1K(f.add, r, s, k); RETURN $);
   m := eightBitMask;

   IF EightBitsOrFewer(-k) THEN $(
      GenF1K(f.sub, r, s, -k); RETURN $);
   mn := eightBitMask;

   TEST EightBitsOrFewer(k&~m) THEN
      GenF1K(f.add, r, s, k)
   ELSE TEST EightBitsOrFewer((-k)&~mn) THEN
      GenF1K(f.sub, r, s, -k)
   ELSE TEST r~=s THEN $(
      SetRtoK(r, k);
      GenRR(f.add, r, r, s) $)
   ELSE $(
      SetRtoK(r.0, k);
      r0Offset := Null;
      GenRR(f.add, r, r, r.0) $)
$)

AND SetRtoK(r, k) BE
$( LET m = ?;
   eightBitMask := 255;
   IF EightBitsOrFewer(k) THEN $(
      GenF1K(f.mov, r, 0, k); RETURN $);
   m := eightBitMask;

   TEST EightBitsOrFewer(~k) THEN
      GenF1K(f.mvn, r, 0, ~k)
   ELSE TEST EightBitsOrFewer(k&~m) THEN $(
      GenF1K(f.mov, r, 0, k&m)
      GenF1K(f.add, r, r, k&~m) $)
   ELSE TEST GlobalConstant(k)~=0 THEN
      GenF2(f.ldr, r, r.g, 0, GlobalConstant(k))
   ELSE TEST usesRL THEN $(
      CheckRLLoaded();
      GenF2(f.ldr, r, r.l, 0, staticDataSize+Fdata(k)) $)
   ELSE
      GenF2(f.ldr, r, r.pc, LocalConstLab, Fdata(k))
$)

AND GenF(f, r, x) BE
   GenFDS(f, r, r, x)

AND GenFDS(f, r, s, x) BE
$( LET n, k = h3!x, h4!x;
   IF f~=f.cmps & f~=f.cmns THEN
      FlushPendingUsesOfReg(r);
   Lock(r, k.reg); Lock(s, k.reg);
   SWITCHON Class(x, TRUE) INTO
   $( CASE shiftedrtype:
	 F1Inst(f, r, s, n, Null, k/32, k REM 32, m.always);
	 ENDCASE

      CASE lockedrtype:
	 IF k=0 & h2!x<0 THEN $(
	    GenRR(f, r, s, n);
	    ENDCASE $)

      CASE rtype:
	 $( LET r2 = k=0 -> MoveToAnyCR(x),
			    MoveToAnyR(x);
	    GenRR(f, r, s, r2) $);
	 ENDCASE

      CASE ktype:
	 GenF1K(f, r, s, n+k);
	 ENDCASE

      DEFAULT:
	 CompileDS(f, r, s, x) $);

   UnLock(r, k.reg); UnLock(s, k.reg)
$)

AND InsertCount(sr) BE
$( countFlag := FALSE;
   TEST sr=sr.entrycount
      THEN SetRtoRplusK(r.pc, r.gb, sr)
      ELSE F5InstL(m.always, countLabel, f.bl);

   PutWord(0)
$)

AND EightBitsOrFewer(n) = VALOF
$( LET bits = 0;
   eightBitMask := 255;
   TEST n=0
      THEN RESULTIS TRUE
   ELSE TEST (n&3)=0 THEN $(
      WHILE (n&3)=0 DO $(
	 n := n>>2;
	 eightBitMask := eightBitMask<<2 $);
      RESULTIS 0<n<256 $)
   ELSE $(
      WHILE (n&#xc0000000)~=0 DO $(
	 IF bits=8 THEN RESULTIS FALSE;
	 n := n<<2;
	 eightBitMask := (eightBitMask>>2)|#xc0000000;
	 bits := bits+2 $);
      RESULTIS 0<n<256 $)
$)

AND ShiftRegisterDS(r, s, sh, n) BE
   F1Inst(f.mov, r, 0, s, 0, sh, n, m.always)

AND ShiftRegister(r, sh, n) BE
   F1Inst(f.mov, r, 0, r, 0, sh, n, m.always)

AND MaskOutTagBits(r) BE
   F1Inst(f.bic, r, r, Null, #xff000000, sh.asl, 0, m.always)

AND TransferredLabel(l) = l=0 -> 0, VALOF
$( LET p = Assoc(l, 1, transferLabs);
   IF p=Null THEN RESULTIS l;
   l := 2!p
$) REPEAT

AND Jump(l) BE
   IF deadCode~=Dead THEN $(
      IF l~=0 THEN l := TransferredLabel(l);
      TEST l=0 THEN
	 TEST usesFrame & ~linkageNotStored THEN
	    TEST compactCode THEN
	       CondJump(m.always, exitLab)
	    ELSE $(
	       GenRR(f.mov, r.ts, 0, r.p);
	       F4Inst(f.ldm, r.p, f4.pblpc, f.postup+f.pc) $)
	 ELSE GenRR(f.movs, r.pc, 0, r.14)

      ELSE $(
	 SaveStateForLab(l);
	 pendingJump := l $) $)

AND CondJump(m, l) BE CondJump2(m, l, TRUE)

AND CondJump2(m, l, updateSavedState) BE
$( IF l~=0 THEN l := TransferredLabel(l);
   TEST l=0 THEN
      TEST usesFrame & ~linkageNotStored THEN
	 F5InstL(m, exitLab, f.b)
      ELSE TEST pendingLab~=Null &
		m=ComplementCondition(pendingMask) &
		pendingCount<PendingBufferSize THEN
	 F1Inst(f.movs, r.pc, 0, r.14, 0, Null, 0, m.always)
      ELSE
	 F1Inst(f.movs, r.pc, 0, r.14, 0, Null, 0, m)
   ELSE $(
      IF updateSavedState THEN SaveStateForLab(l);
      F5InstL(m, l, f.b) $)
$)

AND F5InstL(m, l, f) BE
$( LET n = ValueOfLabel(l);
   TEST m~=m.always THEN $(
      TEST pendingMask=m & l=pendingLab THEN
	 FlushPendingInsts(m, FALSE)
      ELSE TEST pendingLab~=Null &
		m=ComplementCondition(pendingMask) &
		pendingCount<PendingBufferSize &
		PeekN() = s.lab THEN $(
	 AddPendingInst(pi.F5InstLM, l, f, m);
	 RETURN $)
      ELSE
	 FlushPendingInsts(Null, FALSE);

      IF n<0 THEN $(
	 pendingLab, pendingMask := l, m;
	 pendingCount := 0;
	 RETURN $) $)

   ELSE IF pendingLab~=Null THEN
      TEST pendingCount<PendingBufferSize THEN $(
	 AddPendingInst(pi.F5InstL, l, f);
	 RETURN $)
      ELSE
	 FlushPendingInsts(Null, FALSE);

   F5InstL2(l, f, m)
$)

AND F5InstL2(l, f, m) BE
$( LET n = ValueOfLabel(l);
   FlagLabel(l, lab.jumpedto);
   TEST n<0 THEN $(
      AddRef(locCtr, 5, l);
      F5Inst(f, 0, m) $)
   ELSE
      F5Inst(f, n, m)
$)

AND MultiplyInst(fn, rd, rm, rs, rn) BE
   F4Inst(fn, rd, rm+#x90+(rs<<8)+(fn=f.mla->rn, 0), 0)

AND CheckDelayedJump() BE
   IF pendingJump~=0 THEN $(
      LET d = deadCode;
      deadCode := Alive;
      CondJump2(m.always, pendingJump, FALSE);
      pendingJump := 0;
      deadCode := d $)

AND GlobalConstant(n) = VALOF
$( // See whether n is a constant addressible through
   // (negative offsets from) rg, returning the offset
   // if so.  Currently, there are none such
   RESULTIS 0
$)
00000000  53 45 43 54 49 4f 4e 20  22 43 47 45 22 0a 0a 47  |SECTION "CGE"..G|
00000010  45 54 20 22 62 2e 43 47  68 65 61 64 65 72 22 0a  |ET "b.CGheader".|
00000020  0a 53 54 41 54 49 43 0a  24 28 20 2f 2a 20 56 65  |.STATIC.$( /* Ve|
00000030  72 73 69 6f 6e 20 6f 66  20 31 31 20 53 65 70 20  |rsion of 11 Sep |
00000040  38 37 20 31 33 3a 34 32  3a 30 38 0a 20 20 20 2a  |87 13:42:08.   *|
00000050  2f 0a 20 20 20 64 75 6d  6d 79 20 3d 20 56 65 72  |/.   dummy = Ver|
00000060  73 69 6f 6e 4d 61 72 6b  0a 20 20 20 76 65 72 73  |sionMark.   vers|
00000070  69 6f 6e 20 3d 20 31 2a  32 35 36 2b 39 20 24 29  |ion = 1*256+9 $)|
00000080  3b 0a 0a 4d 41 4e 49 46  45 53 54 0a 24 28 20 50  |;..MANIFEST.$( P|
00000090  65 6e 64 69 6e 67 42 75  66 66 65 72 53 69 7a 65  |endingBufferSize|
000000a0  20 3d 20 31 30 3b 0a 20  20 20 4d 61 78 50 65 6e  | = 10;.   MaxPen|
000000b0  64 69 6e 67 49 6e 73 74  20 3d 20 34 3b 0a 20 20  |dingInst = 4;.  |
000000c0  20 70 69 2e 73 69 7a 65  20 3d 20 31 30 3b 0a 0a  | pi.size = 10;..|
000000d0  20 20 20 70 69 2e 46 31  49 6e 73 74 3d 31 3b 20  |   pi.F1Inst=1; |
000000e0  70 69 2e 46 32 49 6e 73  74 3d 32 3b 20 70 69 2e  |pi.F2Inst=2; pi.|
000000f0  46 34 49 6e 73 74 3d 34  3b 20 70 69 2e 46 35 49  |F4Inst=4; pi.F5I|
00000100  6e 73 74 3d 35 3b 0a 20  20 20 70 69 2e 47 65 6e  |nst=5;.   pi.Gen|
00000110  46 32 3d 36 3b 20 70 69  2e 46 35 49 6e 73 74 4c  |F2=6; pi.F5InstL|
00000120  3d 37 3b 20 70 69 2e 46  35 49 6e 73 74 4c 4d 3d  |=7; pi.F5InstLM=|
00000130  38 3b 0a 20 20 20 70 69  2e 53 65 74 52 74 6f 52  |8;.   pi.SetRtoR|
00000140  70 6c 75 73 4c 70 6c 75  73 4b 3d 39 3b 0a 20 20  |plusLplusK=9;.  |
00000150  20 70 69 2e 53 65 74 4c  61 62 65 6c 3d 31 30 3b  | pi.SetLabel=10;|
00000160  0a 20 20 20 70 69 2e 66  35 49 6e 73 74 58 3d 31  |.   pi.f5InstX=1|
00000170  31 20 24 29 3b 0a 0a 4d  41 4e 49 46 45 53 54 0a  |1 $);..MANIFEST.|
00000180  24 28 20 73 6c 6c 2e 6c  6f 63 20 3d 20 31 3b 20  |$( sll.loc = 1; |
00000190  73 6c 6c 2e 72 65 67 20  3d 20 32 3b 20 73 6c 6c  |sll.reg = 2; sll|
000001a0  2e 6f 66 66 73 65 74 20  3d 20 33 3b 0a 20 20 20  |.offset = 3;.   |
000001b0  73 6c 6c 2e 73 69 7a 65  20 3d 20 34 20 24 29 3b  |sll.size = 4 $);|
000001c0  0a 0a 53 54 41 54 49 43  0a 24 28 20 70 65 6e 64  |..STATIC.$( pend|
000001d0  69 6e 67 43 6f 75 6e 74  20 3d 20 30 3b 0a 20 20  |ingCount = 0;.  |
000001e0  20 70 65 6e 64 69 6e 67  49 6e 73 74 73 20 3d 20  | pendingInsts = |
000001f0  30 3b 20 6f 74 68 65 72  42 72 61 6e 63 68 20 3d  |0; otherBranch =|
00000200  20 30 3b 0a 20 20 20 65  69 67 68 74 42 69 74 4d  | 0;.   eightBitM|
00000210  61 73 6b 20 3d 20 30 20  24 29 3b 0a 0a 4c 45 54  |ask = 0 $);..LET|
00000220  20 49 6e 69 74 50 65 6e  64 69 6e 67 49 6e 73 74  | InitPendingInst|
00000230  73 28 29 20 42 45 0a 24  28 20 70 65 6e 64 69 6e  |s() BE.$( pendin|
00000240  67 49 6e 73 74 73 2c 20  6f 74 68 65 72 42 72 61  |gInsts, otherBra|
00000250  6e 63 68 20 3a 3d 20 30  2c 20 30 3b 0a 20 20 20  |nch := 0, 0;.   |
00000260  70 65 6e 64 69 6e 67 4c  61 62 2c 20 70 65 6e 64  |pendingLab, pend|
00000270  69 6e 67 43 6f 75 6e 74  20 3a 3d 20 4e 75 6c 6c  |ingCount := Null|
00000280  2c 20 30 0a 24 29 0a 0a  41 4e 44 20 41 64 64 50  |, 0.$)..AND AddP|
00000290  65 6e 64 69 6e 67 49 6e  73 74 28 61 2c 20 62 2c  |endingInst(a, b,|
000002a0  20 63 2c 20 64 2c 20 65  2c 20 66 2c 20 67 2c 20  | c, d, e, f, g, |
000002b0  68 2c 20 69 29 20 42 45  0a 24 28 20 70 65 6e 64  |h, i) BE.$( pend|
000002c0  69 6e 67 49 6e 73 74 73  20 3a 3d 20 46 69 6c 6c  |ingInsts := Fill|
000002d0  42 6c 6b 28 70 69 2e 73  69 7a 65 2c 20 70 65 6e  |Blk(pi.size, pen|
000002e0  64 69 6e 67 49 6e 73 74  73 2c 0a 09 09 09 20 20  |dingInsts,....  |
000002f0  20 20 20 20 20 61 2c 20  62 2c 20 63 2c 20 64 2c  |     a, b, c, d,|
00000300  20 65 2c 20 66 2c 20 67  2c 20 68 2c 20 69 29 3b  | e, f, g, h, i);|
00000310  0a 20 20 20 70 65 6e 64  69 6e 67 43 6f 75 6e 74  |.   pendingCount|
00000320  20 3a 3d 20 70 65 6e 64  69 6e 67 43 6f 75 6e 74  | := pendingCount|
00000330  2b 31 0a 24 29 0a 0a 41  4e 44 20 50 6c 61 6e 74  |+1.$)..AND Plant|
00000340  49 6e 73 74 72 75 63 74  69 6f 6e 43 68 61 69 6e  |InstructionChain|
00000350  28 70 2c 20 6d 29 20 42  45 0a 24 28 20 70 20 3a  |(p, m) BE.$( p :|
00000360  3d 20 52 65 76 65 72 73  65 49 6e 50 6c 61 63 65  |= ReverseInPlace|
00000370  28 70 29 3b 0a 20 20 20  57 48 49 4c 45 20 70 7e  |(p);.   WHILE p~|
00000380  3d 30 20 44 4f 20 24 28  0a 20 20 20 20 20 20 53  |=0 DO $(.      S|
00000390  57 49 54 43 48 4f 4e 20  31 21 70 20 49 4e 54 4f  |WITCHON 1!p INTO|
000003a0  0a 20 20 20 20 20 20 24  28 20 43 41 53 45 20 70  |.      $( CASE p|
000003b0  69 2e 53 65 74 4c 61 62  65 6c 3a 0a 09 20 20 20  |i.SetLabel:..   |
000003c0  20 52 65 61 6c 53 65 74  4c 61 62 65 6c 28 32 21  | RealSetLabel(2!|
000003d0  70 29 3b 0a 09 20 20 20  20 45 4e 44 43 41 53 45  |p);..    ENDCASE|
000003e0  0a 09 20 43 41 53 45 20  70 69 2e 46 35 49 6e 73  |.. CASE pi.F5Ins|
000003f0  74 3a 0a 09 20 20 20 20  46 35 49 6e 73 74 28 32  |t:..    F5Inst(2|
00000400  21 70 2c 20 33 21 70 2c  20 6d 29 3b 0a 09 20 20  |!p, 3!p, m);..  |
00000410  20 20 45 4e 44 43 41 53  45 0a 09 20 43 41 53 45  |  ENDCASE.. CASE|
00000420  20 70 69 2e 46 35 49 6e  73 74 58 3a 0a 09 20 20  | pi.F5InstX:..  |
00000430  20 20 46 35 49 6e 73 74  58 28 32 21 70 2c 20 33  |  F5InstX(2!p, 3|
00000440  21 70 2c 20 6d 29 3b 0a  09 20 20 20 20 45 4e 44  |!p, m);..    END|
00000450  43 41 53 45 0a 09 20 43  41 53 45 20 70 69 2e 46  |CASE.. CASE pi.F|
00000460  34 49 6e 73 74 3a 0a 09  20 20 20 20 46 34 49 6e  |4Inst:..    F4In|
00000470  73 74 4d 28 32 21 70 2c  20 33 21 70 2c 20 34 21  |stM(2!p, 3!p, 4!|
00000480  70 2c 20 35 21 70 2c 20  6d 29 3b 0a 09 20 20 20  |p, 5!p, m);..   |
00000490  20 45 4e 44 43 41 53 45  0a 09 20 43 41 53 45 20  | ENDCASE.. CASE |
000004a0  70 69 2e 46 32 49 6e 73  74 3a 0a 09 20 20 20 20  |pi.F2Inst:..    |
000004b0  46 32 49 6e 73 74 28 32  21 70 2c 20 33 21 70 2c  |F2Inst(2!p, 3!p,|
000004c0  20 34 21 70 2c 20 35 21  70 2c 20 36 21 70 2c 20  | 4!p, 5!p, 6!p, |
000004d0  37 21 70 2c 20 38 21 70  2c 20 39 21 70 2c 20 6d  |7!p, 8!p, 9!p, m|
000004e0  29 3b 0a 09 20 20 20 20  45 4e 44 43 41 53 45 0a  |);..    ENDCASE.|
000004f0  09 20 43 41 53 45 20 70  69 2e 46 31 49 6e 73 74  |. CASE pi.F1Inst|
00000500  3a 0a 09 20 20 20 20 46  31 49 6e 73 74 28 32 21  |:..    F1Inst(2!|
00000510  70 2c 20 33 21 70 2c 20  34 21 70 2c 20 35 21 70  |p, 3!p, 4!p, 5!p|
00000520  2c 20 36 21 70 2c 20 37  21 70 2c 20 38 21 70 2c  |, 6!p, 7!p, 8!p,|
00000530  20 6d 29 3b 0a 09 20 20  20 20 45 4e 44 43 41 53  | m);..    ENDCAS|
00000540  45 0a 09 20 43 41 53 45  20 70 69 2e 47 65 6e 46  |E.. CASE pi.GenF|
00000550  32 3a 0a 09 20 20 20 20  47 65 6e 46 32 4d 28 32  |2:..    GenF2M(2|
00000560  21 70 2c 20 33 21 70 2c  20 34 21 70 2c 20 35 21  |!p, 3!p, 4!p, 5!|
00000570  70 2c 20 36 21 70 2c 20  6d 29 3b 0a 09 20 20 20  |p, 6!p, m);..   |
00000580  20 45 4e 44 43 41 53 45  0a 09 20 43 41 53 45 20  | ENDCASE.. CASE |
00000590  70 69 2e 46 35 49 6e 73  74 4c 3a 0a 09 20 20 20  |pi.F5InstL:..   |
000005a0  20 46 35 49 6e 73 74 4c  32 28 32 21 70 2c 20 33  | F5InstL2(2!p, 3|
000005b0  21 70 2c 20 6d 29 3b 0a  09 20 20 20 20 45 4e 44  |!p, m);..    END|
000005c0  43 41 53 45 0a 09 20 43  41 53 45 20 70 69 2e 46  |CASE.. CASE pi.F|
000005d0  35 49 6e 73 74 4c 4d 3a  0a 09 20 20 20 20 46 35  |5InstLM:..    F5|
000005e0  49 6e 73 74 4c 32 28 32  21 70 2c 20 33 21 70 2c  |InstL2(2!p, 3!p,|
000005f0  20 34 21 70 29 3b 0a 09  20 20 20 20 45 4e 44 43  | 4!p);..    ENDC|
00000600  41 53 45 0a 09 20 43 41  53 45 20 70 69 2e 53 65  |ASE.. CASE pi.Se|
00000610  74 52 74 6f 52 70 6c 75  73 4c 70 6c 75 73 4b 3a  |tRtoRplusLplusK:|
00000620  0a 09 20 20 20 20 53 65  74 52 74 6f 52 70 6c 75  |..    SetRtoRplu|
00000630  73 4c 70 6c 75 73 4b 4d  28 32 21 70 2c 20 33 21  |sLplusKM(2!p, 3!|
00000640  70 2c 20 34 21 70 2c 20  35 21 70 2c 20 6d 29 3b  |p, 4!p, 5!p, m);|
00000650  0a 09 20 20 20 20 45 4e  44 43 41 53 45 0a 20 20  |..    ENDCASE.  |
00000660  20 20 20 20 24 29 3b 0a  20 20 20 20 20 20 70 20  |    $);.      p |
00000670  3a 3d 20 46 72 65 65 42  6c 6b 28 70 2c 20 70 69  |:= FreeBlk(p, pi|
00000680  2e 73 69 7a 65 29 20 24  29 0a 24 29 0a 0a 41 4e  |.size) $).$)..AN|
00000690  44 20 50 6c 61 6e 74 43  6f 70 79 28 6c 2c 20 6d  |D PlantCopy(l, m|
000006a0  29 20 42 45 0a 20 20 20  50 6c 61 6e 74 49 6e 73  |) BE.   PlantIns|
000006b0  74 72 75 63 74 69 6f 6e  43 68 61 69 6e 28 43 6f  |tructionChain(Co|
000006c0  70 79 4f 66 4c 69 73 74  28 6c 2c 20 70 69 2e 73  |pyOfList(l, pi.s|
000006d0  69 7a 65 29 2c 20 6d 29  0a 0a 41 4e 44 20 53 61  |ize), m)..AND Sa|
000006e0  6d 65 49 6e 73 74 72 75  63 74 69 6f 6e 28 70 2c  |meInstruction(p,|
000006f0  20 71 29 20 3d 20 56 41  4c 4f 46 0a 24 28 20 49  | q) = VALOF.$( I|
00000700  46 20 31 21 70 7e 3d 31  21 71 20 7c 20 32 21 70  |F 1!p~=1!q | 2!p|
00000710  7e 3d 32 21 71 20 7c 20  33 21 70 7e 3d 33 21 71  |~=2!q | 3!p~=3!q|
00000720  20 54 48 45 4e 20 52 45  53 55 4c 54 49 53 20 46  | THEN RESULTIS F|
00000730  41 4c 53 45 3b 0a 20 20  20 53 57 49 54 43 48 4f  |ALSE;.   SWITCHO|
00000740  4e 20 31 21 70 20 49 4e  54 4f 0a 20 20 20 24 28  |N 1!p INTO.   $(|
00000750  20 43 41 53 45 20 70 69  2e 46 35 49 6e 73 74 3a  | CASE pi.F5Inst:|
00000760  0a 20 20 20 20 20 20 43  41 53 45 20 70 69 2e 46  |.      CASE pi.F|
00000770  35 49 6e 73 74 58 3a 0a  20 20 20 20 20 20 43 41  |5InstX:.      CA|
00000780  53 45 20 70 69 2e 46 35  49 6e 73 74 4c 3a 0a 09  |SE pi.F5InstL:..|
00000790  20 52 45 53 55 4c 54 49  53 20 54 52 55 45 0a 20  | RESULTIS TRUE. |
000007a0  20 20 20 20 20 43 41 53  45 20 70 69 2e 46 32 49  |     CASE pi.F2I|
000007b0  6e 73 74 3a 0a 09 20 49  46 20 39 21 70 7e 3d 39  |nst:.. IF 9!p~=9|
000007c0  21 71 20 54 48 45 4e 20  52 45 53 55 4c 54 49 53  |!q THEN RESULTIS|
000007d0  20 46 41 4c 53 45 0a 20  20 20 20 20 20 43 41 53  | FALSE.      CAS|
000007e0  45 20 70 69 2e 46 31 49  6e 73 74 3a 0a 09 20 49  |E pi.F1Inst:.. I|
000007f0  46 20 37 21 70 7e 3d 37  21 71 20 7c 20 38 21 70  |F 7!p~=7!q | 8!p|
00000800  7e 3d 38 21 71 20 54 48  45 4e 20 52 45 53 55 4c  |~=8!q THEN RESUL|
00000810  54 49 53 20 46 41 4c 53  45 0a 20 20 20 20 20 20  |TIS FALSE.      |
00000820  43 41 53 45 20 70 69 2e  47 65 6e 46 32 3a 0a 09  |CASE pi.GenF2:..|
00000830  20 49 46 20 36 21 70 7e  3d 36 21 71 20 54 48 45  | IF 6!p~=6!q THE|
00000840  4e 20 52 45 53 55 4c 54  49 53 20 46 41 4c 53 45  |N RESULTIS FALSE|
00000850  0a 20 20 20 20 20 20 43  41 53 45 20 70 69 2e 46  |.      CASE pi.F|
00000860  34 49 6e 73 74 3a 0a 20  20 20 20 20 20 43 41 53  |4Inst:.      CAS|
00000870  45 20 70 69 2e 53 65 74  52 74 6f 52 70 6c 75 73  |E pi.SetRtoRplus|
00000880  4c 70 6c 75 73 4b 3a 0a  09 20 49 46 20 35 21 70  |LplusK:.. IF 5!p|
00000890  7e 3d 35 21 71 20 54 48  45 4e 20 52 45 53 55 4c  |~=5!q THEN RESUL|
000008a0  54 49 53 20 46 41 4c 53  45 0a 20 20 20 20 20 20  |TIS FALSE.      |
000008b0  43 41 53 45 20 70 69 2e  46 35 49 6e 73 74 4c 4d  |CASE pi.F5InstLM|
000008c0  3a 0a 09 20 52 45 53 55  4c 54 49 53 20 34 21 70  |:.. RESULTIS 4!p|
000008d0  3d 34 21 71 0a 20 20 20  24 29 0a 24 29 0a 0a 41  |=4!q.   $).$)..A|
000008e0  4e 44 20 43 6f 6d 6d 6f  6e 53 65 71 75 65 6e 63  |ND CommonSequenc|
000008f0  65 28 70 29 20 3d 20 56  41 4c 4f 46 0a 24 28 20  |e(p) = VALOF.$( |
00000900  57 48 49 4c 45 20 53 61  6d 65 49 6e 73 74 72 75  |WHILE SameInstru|
00000910  63 74 69 6f 6e 28 70 65  6e 64 69 6e 67 49 6e 73  |ction(pendingIns|
00000920  74 73 2c 20 6f 74 68 65  72 42 72 61 6e 63 68 29  |ts, otherBranch)|
00000930  20 44 4f 20 24 28 0a 20  20 20 20 20 20 4c 45 54  | DO $(.      LET|
00000940  20 71 20 3d 20 70 65 6e  64 69 6e 67 49 6e 73 74  | q = pendingInst|
00000950  73 3b 0a 20 20 20 20 20  20 70 65 6e 64 69 6e 67  |s;.      pending|
00000960  49 6e 73 74 73 20 3a 3d  20 21 70 65 6e 64 69 6e  |Insts := !pendin|
00000970  67 49 6e 73 74 73 3b 0a  20 20 20 20 20 20 21 71  |gInsts;.      !q|
00000980  20 3a 3d 20 70 3b 20 70  20 3a 3d 20 71 3b 0a 20  | := p; p := q;. |
00000990  20 20 20 20 20 6f 74 68  65 72 42 72 61 6e 63 68  |     otherBranch|
000009a0  20 3a 3d 20 46 72 65 65  42 6c 6b 28 6f 74 68 65  | := FreeBlk(othe|
000009b0  72 42 72 61 6e 63 68 2c  20 70 69 2e 73 69 7a 65  |rBranch, pi.size|
000009c0  29 20 24 29 3b 0a 20 20  20 49 46 20 28 43 47 44  |) $);.   IF (CGD|
000009d0  65 62 75 67 4d 6f 64 65  26 64 62 2e 63 73 29 7e  |ebugMode&db.cs)~|
000009e0  3d 30 20 54 48 45 4e 0a  20 20 20 20 20 20 50 72  |=0 THEN.      Pr|
000009f0  69 6e 74 4c 69 73 74 28  70 2c 20 70 69 2e 73 69  |intList(p, pi.si|
00000a00  7a 65 2c 20 22 63 6f 6d  6d 6f 6e 22 2c 20 22 3a  |ze, "common", ":|
00000a10  22 2c 20 22 2a 6e 22 29  0a 20 20 20 52 45 53 55  |", "*n").   RESU|
00000a20  4c 54 49 53 20 70 0a 24  29 0a 0a 41 4e 44 20 4c  |LTIS p.$)..AND L|
00000a30  61 62 65 6c 49 6e 50 65  6e 64 69 6e 67 49 6e 73  |abelInPendingIns|
00000a40  74 73 28 70 29 20 3d 20  56 41 4c 4f 46 0a 24 28  |ts(p) = VALOF.$(|
00000a50  20 49 46 20 41 73 73 6f  63 28 70 69 2e 53 65 74  | IF Assoc(pi.Set|
00000a60  4c 61 62 65 6c 2c 20 31  2c 20 70 29 3d 4e 75 6c  |Label, 1, p)=Nul|
00000a70  6c 20 54 48 45 4e 20 52  45 53 55 4c 54 49 53 20  |l THEN RESULTIS |
00000a80  46 41 4c 53 45 3b 0a 0a  20 20 20 57 48 49 4c 45  |FALSE;..   WHILE|
00000a90  20 70 7e 3d 30 20 44 4f  20 24 28 0a 20 20 20 20  | p~=0 DO $(.    |
00000aa0  20 20 49 46 20 31 21 70  7e 3d 70 69 2e 53 65 74  |  IF 1!p~=pi.Set|
00000ab0  4c 61 62 65 6c 20 54 48  45 4e 20 52 45 53 55 4c  |Label THEN RESUL|
00000ac0  54 49 53 20 54 52 55 45  3b 0a 20 20 20 20 20 20  |TIS TRUE;.      |
00000ad0  70 20 3a 3d 20 21 70 20  24 29 3b 0a 20 20 20 52  |p := !p $);.   R|
00000ae0  45 53 55 4c 54 49 53 20  46 41 4c 53 45 0a 24 29  |ESULTIS FALSE.$)|
00000af0  0a 0a 41 4e 44 20 46 69  72 73 74 50 65 6e 64 69  |..AND FirstPendi|
00000b00  6e 67 49 6e 73 74 28 61  2c 20 62 2c 20 63 2c 20  |ngInst(a, b, c, |
00000b10  64 2c 20 65 29 20 3d 0a  09 20 31 21 70 65 6e 64  |d, e) =.. 1!pend|
00000b20  69 6e 67 49 6e 73 74 73  3d 61 20 26 0a 09 20 28  |ingInsts=a &.. (|
00000b30  62 3d 4e 75 6c 6c 20 7c  20 32 21 70 65 6e 64 69  |b=Null | 2!pendi|
00000b40  6e 67 49 6e 73 74 73 3d  62 29 20 26 0a 09 20 28  |ngInsts=b) &.. (|
00000b50  63 3d 4e 75 6c 6c 20 7c  20 33 21 70 65 6e 64 69  |c=Null | 3!pendi|
00000b60  6e 67 49 6e 73 74 73 3d  63 29 20 26 0a 09 20 28  |ngInsts=c) &.. (|
00000b70  64 3d 4e 75 6c 6c 20 7c  20 34 21 70 65 6e 64 69  |d=Null | 4!pendi|
00000b80  6e 67 49 6e 73 74 73 3d  64 29 20 26 0a 09 20 28  |ngInsts=d) &.. (|
00000b90  65 3d 4e 75 6c 6c 20 7c  20 35 21 70 65 6e 64 69  |e=Null | 5!pendi|
00000ba0  6e 67 49 6e 73 74 73 3d  65 29 0a 0a 41 4e 44 20  |ngInsts=e)..AND |
00000bb0  46 6c 75 73 68 50 65 6e  64 69 6e 67 49 6e 73 74  |FlushPendingInst|
00000bc0  73 28 6d 2c 20 61 74 4c  61 62 29 20 42 45 0a 24  |s(m, atLab) BE.$|
00000bd0  28 20 4c 45 54 20 70 6c  20 3d 20 70 65 6e 64 69  |( LET pl = pendi|
00000be0  6e 67 4c 61 62 3b 0a 20  20 20 4c 45 54 20 64 63  |ngLab;.   LET dc|
00000bf0  20 3d 20 64 65 61 64 43  6f 64 65 3b 0a 20 20 20  | = deadCode;.   |
00000c00  4c 45 54 20 6d 63 6f 70  79 20 3d 20 6d 3b 0a 20  |LET mcopy = m;. |
00000c10  20 20 4c 45 54 20 70 6c  61 6e 74 41 74 45 6e 64  |  LET plantAtEnd|
00000c20  20 3d 20 30 3b 0a 20 20  20 4c 45 54 20 6c 61 62  | = 0;.   LET lab|
00000c30  41 74 45 6e 64 2c 20 6f  74 68 65 72 43 61 73 65  |AtEnd, otherCase|
00000c40  4c 61 62 20 3d 20 4e 75  6c 6c 2c 20 4e 75 6c 6c  |Lab = Null, Null|
00000c50  3b 0a 0a 20 20 20 49 46  20 70 65 6e 64 69 6e 67  |;..   IF pending|
00000c60  4c 61 62 3d 4e 75 6c 6c  20 54 48 45 4e 20 52 45  |Lab=Null THEN RE|
00000c70  54 55 52 4e 3b 0a 20 20  20 49 46 20 28 43 47 44  |TURN;.   IF (CGD|
00000c80  65 62 75 67 4d 6f 64 65  26 64 62 2e 63 73 29 7e  |ebugMode&db.cs)~|
00000c90  3d 30 20 54 48 45 4e 20  24 28 0a 20 20 20 20 20  |=0 THEN $(.     |
00000ca0  20 57 72 69 74 65 46 28  22 46 6c 75 73 68 50 49  | WriteF("FlushPI|
00000cb0  20 25 78 38 20 25 6e 20  6f 70 20 25 6e 20 6c 61  | %x8 %n op %n la|
00000cc0  62 20 25 6e 2a 6e 22 2c  20 6d 2c 20 61 74 4c 61  |b %n*n", m, atLa|
00000cd0  62 2c 20 6f 70 2c 20 70  65 6e 64 69 6e 67 4c 61  |b, op, pendingLa|
00000ce0  62 29 3b 0a 20 20 20 20  20 20 50 72 69 6e 74 4c  |b);.      PrintL|
00000cf0  69 73 74 28 70 65 6e 64  69 6e 67 49 6e 73 74 73  |ist(pendingInsts|
00000d00  2c 20 70 69 2e 73 69 7a  65 2c 20 22 70 65 6e 64  |, pi.size, "pend|
00000d10  69 6e 67 22 2c 20 22 3a  22 2c 20 22 2a 6e 22 29  |ing", ":", "*n")|
00000d20  3b 0a 20 20 20 20 20 20  50 72 69 6e 74 4c 69 73  |;.      PrintLis|
00000d30  74 28 6f 74 68 65 72 42  72 61 6e 63 68 2c 20 70  |t(otherBranch, p|
00000d40  69 2e 73 69 7a 65 2c 20  22 6f 74 68 65 72 22 2c  |i.size, "other",|
00000d50  20 22 3a 22 2c 20 22 2a  6e 22 29 20 24 29 3b 0a  | ":", "*n") $);.|
00000d60  0a 20 20 20 49 46 20 61  74 4c 61 62 20 26 20 6d  |.   IF atLab & m|
00000d70  3d 4e 75 6c 6c 20 26 0a  20 20 20 20 20 20 46 69  |=Null &.      Fi|
00000d80  72 73 74 50 65 6e 64 69  6e 67 49 6e 73 74 28 70  |rstPendingInst(p|
00000d90  69 2e 46 35 49 6e 73 74  4c 2c 20 70 65 6e 64 69  |i.F5InstL, pendi|
00000da0  6e 67 4c 61 62 2c 20 66  2e 62 2c 20 4e 75 6c 6c  |ngLab, f.b, Null|
00000db0  2c 20 4e 75 6c 6c 29 20  54 48 45 4e 20 24 28 0a  |, Null) THEN $(.|
00000dc0  20 20 20 20 20 20 4c 45  54 20 71 20 3d 20 70 65  |      LET q = pe|
00000dd0  6e 64 69 6e 67 49 6e 73  74 73 3b 0a 20 20 20 20  |ndingInsts;.    |
00000de0  20 20 70 65 6e 64 69 6e  67 49 6e 73 74 73 20 3a  |  pendingInsts :|
00000df0  3d 20 21 70 65 6e 64 69  6e 67 49 6e 73 74 73 3b  |= !pendingInsts;|
00000e00  0a 20 20 20 20 20 20 70  6c 61 6e 74 41 74 45 6e  |.      plantAtEn|
00000e10  64 20 3a 3d 20 71 3b 20  21 71 20 3a 3d 20 30 3b  |d := q; !q := 0;|
00000e20  0a 20 20 20 20 20 20 6d  20 3a 3d 20 70 65 6e 64  |.      m := pend|
00000e30  69 6e 67 4d 61 73 6b 20  24 29 3b 0a 0a 20 20 20  |ingMask $);..   |
00000e40  64 65 61 64 43 6f 64 65  20 3a 3d 20 41 6c 69 76  |deadCode := Aliv|
00000e50  65 3b 0a 20 20 20 70 65  6e 64 69 6e 67 4c 61 62  |e;.   pendingLab|
00000e60  20 3a 3d 20 4e 75 6c 6c  3b 0a 20 20 20 6d 20 3a  | := Null;.   m :|
00000e70  3d 20 43 6f 6d 70 6c 65  6d 65 6e 74 43 6f 6e 64  |= ComplementCond|
00000e80  69 74 69 6f 6e 28 6d 29  3b 0a 0a 20 20 20 49 46  |ition(m);..   IF|
00000e90  20 70 6c 61 6e 74 41 74  45 6e 64 3d 30 20 26 20  | plantAtEnd=0 & |
00000ea0  6d 7e 3d 6d 2e 61 6c 77  61 79 73 20 26 0a 20 20  |m~=m.always &.  |
00000eb0  20 20 20 20 28 5b 46 69  72 73 74 50 65 6e 64 69  |    ([FirstPendi|
00000ec0  6e 67 49 6e 73 74 28 70  69 2e 46 35 49 6e 73 74  |ngInst(pi.F5Inst|
00000ed0  4c 2c 20 4e 75 6c 6c 2c  20 66 2e 62 2c 20 4e 75  |L, Null, f.b, Nu|
00000ee0  6c 6c 2c 20 4e 75 6c 6c  29 20 26 0a 09 4c 61 62  |ll, Null) &..Lab|
00000ef0  65 6c 46 6c 61 67 67 65  64 28 70 6c 2c 20 6c 61  |elFlagged(pl, la|
00000f00  62 2e 6f 6e 6c 79 6f 6e  65 6a 75 6d 70 29 5d 20  |b.onlyonejump)] |
00000f10  7c 0a 0a 20 20 20 20 20  20 20 46 69 72 73 74 50  ||..       FirstP|
00000f20  65 6e 64 69 6e 67 49 6e  73 74 28 70 69 2e 46 31  |endingInst(pi.F1|
00000f30  49 6e 73 74 2c 20 66 2e  6d 6f 76 2c 20 72 2e 70  |Inst, f.mov, r.p|
00000f40  63 2c 20 72 2e 70 63 2c  20 72 2e 62 29 20 7c 0a  |c, r.pc, r.b) |.|
00000f50  0a 20 20 20 20 20 20 20  46 69 72 73 74 50 65 6e  |.       FirstPen|
00000f60  64 69 6e 67 49 6e 73 74  28 70 69 2e 46 31 49 6e  |dingInst(pi.F1In|
00000f70  73 74 2c 20 66 2e 6d 6f  76 73 2c 20 72 2e 70 63  |st, f.movs, r.pc|
00000f80  2c 20 30 2c 20 72 2e 31  34 29 20 7c 0a 0a 20 20  |, 0, r.14) |..  |
00000f90  20 20 20 20 20 46 69 72  73 74 50 65 6e 64 69 6e  |     FirstPendin|
00000fa0  67 49 6e 73 74 28 70 69  2e 46 32 49 6e 73 74 2c  |gInst(pi.F2Inst,|
00000fb0  20 66 2e 6c 64 72 2c 20  72 2e 70 63 2c 20 72 2e  | f.ldr, r.pc, r.|
00000fc0  70 63 2c 20 4e 75 6c 6c  29 20 7c 0a 0a 20 20 20  |pc, Null) |..   |
00000fd0  20 20 20 20 46 69 72 73  74 50 65 6e 64 69 6e 67  |    FirstPending|
00000fe0  49 6e 73 74 28 70 69 2e  47 65 6e 46 32 2c 20 66  |Inst(pi.GenF2, f|
00000ff0  2e 6c 64 72 2c 20 72 2e  70 63 2c 20 4e 75 6c 6c  |.ldr, r.pc, Null|
00001000  2c 20 4e 75 6c 6c 29 20  7c 0a 0a 20 20 20 20 20  |, Null) |..     |
00001010  20 20 46 69 72 73 74 50  65 6e 64 69 6e 67 49 6e  |  FirstPendingIn|
00001020  73 74 28 70 69 2e 46 34  49 6e 73 74 2c 20 66 2e  |st(pi.F4Inst, f.|
00001030  6c 64 6d 2c 20 72 2e 70  2c 20 66 34 2e 70 6c 70  |ldm, r.p, f4.plp|
00001040  63 2c 20 4e 75 6c 6c 29  29 20 54 48 45 4e 20 24  |c, Null)) THEN $|
00001050  28 0a 20 20 20 20 20 20  4c 45 54 20 6c 20 3d 20  |(.      LET l = |
00001060  32 21 70 65 6e 64 69 6e  67 49 6e 73 74 73 3b 0a  |2!pendingInsts;.|
00001070  20 20 20 20 20 20 4c 45  54 20 6f 20 3d 20 6f 74  |      LET o = ot|
00001080  68 65 72 42 72 61 6e 63  68 3b 0a 20 20 20 20 20  |herBranch;.     |
00001090  20 49 46 20 31 21 70 65  6e 64 69 6e 67 49 6e 73  | IF 1!pendingIns|
000010a0  74 73 7e 3d 70 69 2e 46  35 49 6e 73 74 4c 20 54  |ts~=pi.F5InstL T|
000010b0  48 45 4e 20 6c 20 3a 3d  20 2d 32 3b 0a 20 20 20  |HEN l := -2;.   |
000010c0  20 20 20 49 46 20 6c 3c  30 20 7c 20 56 61 6c 75  |   IF l<0 | Valu|
000010d0  65 4f 66 4c 61 62 65 6c  28 6c 29 3d 4e 75 6c 6c  |eOfLabel(l)=Null|
000010e0  20 54 48 45 4e 20 24 28  0a 09 20 6f 74 68 65 72  | THEN $(.. other|
000010f0  42 72 61 6e 63 68 3a 3d  20 6c 3c 30 20 2d 3e 20  |Branch:= l<0 -> |
00001100  70 65 6e 64 69 6e 67 49  6e 73 74 73 2c 0a 09 09  |pendingInsts,...|
00001110  09 20 20 20 20 20 20 46  72 65 65 42 6c 6b 28 70  |.      FreeBlk(p|
00001120  65 6e 64 69 6e 67 49 6e  73 74 73 2c 20 70 69 2e  |endingInsts, pi.|
00001130  73 69 7a 65 29 3b 0a 09  20 70 65 6e 64 69 6e 67  |size);.. pending|
00001140  49 6e 73 74 73 20 3a 3d  20 6f 3b 0a 09 20 70 65  |Insts := o;.. pe|
00001150  6e 64 69 6e 67 43 6f 75  6e 74 20 3a 3d 20 4c 65  |ndingCount := Le|
00001160  6e 67 74 68 4f 66 4c 69  73 74 28 6f 29 3b 0a 09  |ngthOfList(o);..|
00001170  20 70 65 6e 64 69 6e 67  4c 61 62 2c 20 70 65 6e  | pendingLab, pen|
00001180  64 69 6e 67 4d 61 73 6b  20 3a 3d 20 6c 2c 20 6d  |dingMask := l, m|
00001190  3b 0a 09 20 52 45 54 55  52 4e 20 24 29 20 24 29  |;.. RETURN $) $)|
000011a0  3b 0a 0a 20 20 20 49 46  20 6f 74 68 65 72 42 72  |;..   IF otherBr|
000011b0  61 6e 63 68 7e 3d 30 20  54 48 45 4e 20 24 28 0a  |anch~=0 THEN $(.|
000011c0  20 20 20 20 20 20 2f 2f  20 73 65 65 20 77 68 65  |      // see whe|
000011d0  74 68 65 72 20 74 68 65  72 65 20 61 72 65 20 63  |ther there are c|
000011e0  6f 6d 6d 6f 6e 20 73 65  74 73 20 6f 66 20 69 6e  |ommon sets of in|
000011f0  73 74 72 75 63 74 69 6f  6e 73 0a 20 20 20 20 20  |structions.     |
00001200  20 2f 2f 20 62 65 74 77  65 65 6e 20 74 68 65 20  | // between the |
00001210  74 77 6f 20 73 65 71 75  65 6e 63 65 73 2e 0a 20  |two sequences.. |
00001220  20 20 20 20 20 4c 45 54  20 70 6c 61 6e 74 41 74  |     LET plantAt|
00001230  53 74 61 72 74 20 3d 20  30 3b 0a 20 20 20 20 20  |Start = 0;.     |
00001240  20 4c 45 54 20 70 20 3d  20 70 6c 61 6e 74 41 74  | LET p = plantAt|
00001250  45 6e 64 3b 0a 0a 20 20  20 20 20 20 49 46 20 61  |End;..      IF a|
00001260  74 4c 61 62 20 54 48 45  4e 20 70 6c 61 6e 74 41  |tLab THEN plantA|
00001270  74 45 6e 64 20 3a 3d 20  43 6f 6d 6d 6f 6e 53 65  |tEnd := CommonSe|
00001280  71 75 65 6e 63 65 28 70  6c 61 6e 74 41 74 45 6e  |quence(plantAtEn|
00001290  64 29 3b 0a 0a 20 20 20  20 20 20 70 65 6e 64 69  |d);..      pendi|
000012a0  6e 67 49 6e 73 74 73 20  3a 3d 20 52 65 76 65 72  |ngInsts := Rever|
000012b0  73 65 49 6e 50 6c 61 63  65 28 70 65 6e 64 69 6e  |seInPlace(pendin|
000012c0  67 49 6e 73 74 73 29 3b  0a 20 20 20 20 20 20 6f  |gInsts);.      o|
000012d0  74 68 65 72 42 72 61 6e  63 68 20 3a 3d 20 52 65  |therBranch := Re|
000012e0  76 65 72 73 65 49 6e 50  6c 61 63 65 28 6f 74 68  |verseInPlace(oth|
000012f0  65 72 42 72 61 6e 63 68  29 3b 0a 20 20 20 20 20  |erBranch);.     |
00001300  20 70 6c 61 6e 74 41 74  53 74 61 72 74 20 3a 3d  | plantAtStart :=|
00001310  20 43 6f 6d 6d 6f 6e 53  65 71 75 65 6e 63 65 28  | CommonSequence(|
00001320  30 29 3b 0a 0a 20 20 20  20 20 20 70 65 6e 64 69  |0);..      pendi|
00001330  6e 67 49 6e 73 74 73 20  3a 3d 20 52 65 76 65 72  |ngInsts := Rever|
00001340  73 65 49 6e 50 6c 61 63  65 28 70 65 6e 64 69 6e  |seInPlace(pendin|
00001350  67 49 6e 73 74 73 29 3b  0a 20 20 20 20 20 20 6f  |gInsts);.      o|
00001360  74 68 65 72 42 72 61 6e  63 68 20 3a 3d 20 52 65  |therBranch := Re|
00001370  76 65 72 73 65 49 6e 50  6c 61 63 65 28 6f 74 68  |verseInPlace(oth|
00001380  65 72 42 72 61 6e 63 68  29 3b 0a 0a 20 20 20 20  |erBranch);..    |
00001390  20 20 50 6c 61 6e 74 49  6e 73 74 72 75 63 74 69  |  PlantInstructi|
000013a0  6f 6e 43 68 61 69 6e 28  70 6c 61 6e 74 41 74 53  |onChain(plantAtS|
000013b0  74 61 72 74 2c 20 6d 2e  61 6c 77 61 79 73 29 3b  |tart, m.always);|
000013c0  0a 0a 20 20 20 20 20 20  54 45 53 54 20 4c 65 6e  |..      TEST Len|
000013d0  67 74 68 4f 66 4c 69 73  74 28 6f 74 68 65 72 42  |gthOfList(otherB|
000013e0  72 61 6e 63 68 29 3c 3d  4d 61 78 50 65 6e 64 69  |ranch)<=MaxPendi|
000013f0  6e 67 49 6e 73 74 20 26  0a 09 20 20 20 7e 4c 61  |ngInst &..   ~La|
00001400  62 65 6c 49 6e 50 65 6e  64 69 6e 67 49 6e 73 74  |belInPendingInst|
00001410  73 28 6f 74 68 65 72 42  72 61 6e 63 68 29 20 54  |s(otherBranch) T|
00001420  48 45 4e 20 24 28 0a 09  20 50 6c 61 6e 74 49 6e  |HEN $(.. PlantIn|
00001430  73 74 72 75 63 74 69 6f  6e 43 68 61 69 6e 28 6f  |structionChain(o|
00001440  74 68 65 72 42 72 61 6e  63 68 2c 20 70 65 6e 64  |therBranch, pend|
00001450  69 6e 67 4d 61 73 6b 29  3b 0a 09 20 49 46 20 70  |ingMask);.. IF p|
00001460  6c 61 6e 74 41 74 45 6e  64 7e 3d 70 20 54 48 45  |lantAtEnd~=p THE|
00001470  4e 0a 09 20 20 20 20 54  45 53 54 20 70 6c 3c 30  |N..    TEST pl<0|
00001480  20 26 20 4c 65 6e 67 74  68 4f 66 4c 69 73 74 28  | & LengthOfList(|
00001490  70 6c 61 6e 74 41 74 45  6e 64 29 3d 31 20 26 0a  |plantAtEnd)=1 &.|
000014a0  09 09 20 31 21 70 6c 61  6e 74 41 74 45 6e 64 3d  |.. 1!plantAtEnd=|
000014b0  70 69 2e 46 35 49 6e 73  74 4c 20 54 48 45 4e 20  |pi.F5InstL THEN |
000014c0  24 28 0a 09 20 20 20 20  20 20 20 50 6c 61 6e 74  |$(..       Plant|
000014d0  43 6f 70 79 28 70 6c 61  6e 74 41 74 45 6e 64 2c  |Copy(plantAtEnd,|
000014e0  20 70 65 6e 64 69 6e 67  4d 61 73 6b 29 3b 0a 09  | pendingMask);..|
000014f0  20 20 20 20 20 20 20 6d  20 3a 3d 20 6d 2e 61 6c  |       m := m.al|
00001500  77 61 79 73 20 24 29 0a  09 20 20 20 20 45 4c 53  |ways $)..    ELS|
00001510  45 20 24 28 0a 09 20 20  20 20 20 20 20 6d 20 3a  |E $(..       m :|
00001520  3d 20 43 6f 6d 70 6c 65  6d 65 6e 74 43 6f 6e 64  |= ComplementCond|
00001530  69 74 69 6f 6e 28 70 65  6e 64 69 6e 67 4d 61 73  |ition(pendingMas|
00001540  6b 29 3b 0a 09 20 20 20  20 20 20 20 6c 61 62 41  |k);..       labA|
00001550  74 45 6e 64 20 3a 3d 20  4e 65 78 74 4c 61 62 65  |tEnd := NextLabe|
00001560  6c 28 29 20 24 29 20 24  29 0a 0a 20 20 20 20 20  |l() $) $)..     |
00001570  20 45 4c 53 45 20 24 28  0a 09 20 6f 74 68 65 72  | ELSE $(.. other|
00001580  43 61 73 65 4c 61 62 20  3a 3d 20 4e 65 78 74 4c  |CaseLab := NextL|
00001590  61 62 65 6c 28 29 3b 0a  09 20 46 35 49 6e 73 74  |abel();.. F5Inst|
000015a0  4c 32 28 6f 74 68 65 72  43 61 73 65 4c 61 62 2c  |L2(otherCaseLab,|
000015b0  20 66 2e 62 2c 20 43 6f  6d 70 6c 65 6d 65 6e 74  | f.b, Complement|
000015c0  43 6f 6e 64 69 74 69 6f  6e 28 70 65 6e 64 69 6e  |Condition(pendin|
000015d0  67 4d 61 73 6b 29 29 3b  0a 09 20 50 6c 61 6e 74  |gMask));.. Plant|
000015e0  49 6e 73 74 72 75 63 74  69 6f 6e 43 68 61 69 6e  |InstructionChain|
000015f0  28 6f 74 68 65 72 42 72  61 6e 63 68 2c 20 6d 2e  |(otherBranch, m.|
00001600  61 6c 77 61 79 73 29 3b  0a 09 20 49 46 20 70 6c  |always);.. IF pl|
00001610  61 6e 74 41 74 45 6e 64  7e 3d 70 20 54 48 45 4e  |antAtEnd~=p THEN|
00001620  20 24 28 0a 09 20 20 20  20 50 6c 61 6e 74 43 6f  | $(..    PlantCo|
00001630  70 79 28 70 6c 61 6e 74  41 74 45 6e 64 2c 20 6d  |py(plantAtEnd, m|
00001640  2e 61 6c 77 61 79 73 29  3b 0a 09 20 20 20 20 6d  |.always);..    m|
00001650  20 3a 3d 20 6d 2e 61 6c  77 61 79 73 20 24 29 20  | := m.always $) |
00001660  24 29 0a 20 20 20 24 29  3b 0a 0a 20 20 20 54 45  |$).   $);..   TE|
00001670  53 54 20 70 6c 3e 3d 30  20 26 20 6d 3d 6d 2e 61  |ST pl>=0 & m=m.a|
00001680  6c 77 61 79 73 20 54 48  45 4e 0a 20 20 20 20 20  |lways THEN.     |
00001690  20 46 35 49 6e 73 74 4c  32 28 70 6c 2c 20 66 2e  | F5InstL2(pl, f.|
000016a0  62 2c 20 70 65 6e 64 69  6e 67 4d 61 73 6b 29 0a  |b, pendingMask).|
000016b0  0a 20 20 20 45 4c 53 45  20 49 46 20 4c 65 6e 67  |.   ELSE IF Leng|
000016c0  74 68 4f 66 4c 69 73 74  28 70 65 6e 64 69 6e 67  |thOfList(pending|
000016d0  49 6e 73 74 73 29 3e 4d  61 78 50 65 6e 64 69 6e  |Insts)>MaxPendin|
000016e0  67 49 6e 73 74 20 7c 0a  09 20 20 20 4c 61 62 65  |gInst |..   Labe|
000016f0  6c 49 6e 50 65 6e 64 69  6e 67 49 6e 73 74 73 28  |lInPendingInsts(|
00001700  70 65 6e 64 69 6e 67 49  6e 73 74 73 29 20 54 48  |pendingInsts) TH|
00001710  45 4e 20 24 28 0a 20 20  20 20 20 20 54 45 53 54  |EN $(.      TEST|
00001720  20 6c 61 62 41 74 45 6e  64 7e 3d 4e 75 6c 6c 20  | labAtEnd~=Null |
00001730  54 48 45 4e 0a 09 20 46  35 49 6e 73 74 4c 32 28  |THEN.. F5InstL2(|
00001740  6c 61 62 41 74 45 6e 64  2c 20 66 2e 62 2c 20 50  |labAtEnd, f.b, P|
00001750  65 6e 64 69 6e 67 4d 61  73 6b 29 0a 20 20 20 20  |endingMask).    |
00001760  20 20 45 4c 53 45 20 49  46 20 70 6c 3e 3d 30 20  |  ELSE IF pl>=0 |
00001770  54 48 45 4e 0a 09 20 46  35 49 6e 73 74 4c 32 28  |THEN.. F5InstL2(|
00001780  70 6c 2c 20 66 2e 62 2c  20 50 65 6e 64 69 6e 67  |pl, f.b, Pending|
00001790  4d 61 73 6b 29 3b 0a 20  20 20 20 20 20 6d 20 3a  |Mask);.      m :|
000017a0  3d 20 6d 2e 61 6c 77 61  79 73 20 24 29 3b 0a 0a  |= m.always $);..|
000017b0  20 20 20 49 46 20 6f 74  68 65 72 43 61 73 65 4c  |   IF otherCaseL|
000017c0  61 62 7e 3d 4e 75 6c 6c  20 54 48 45 4e 20 52 65  |ab~=Null THEN Re|
000017d0  61 6c 53 65 74 4c 61 62  65 6c 28 6f 74 68 65 72  |alSetLabel(other|
000017e0  43 61 73 65 4c 61 62 29  3b 0a 20 20 20 50 6c 61  |CaseLab);.   Pla|
000017f0  6e 74 49 6e 73 74 72 75  63 74 69 6f 6e 43 68 61  |ntInstructionCha|
00001800  69 6e 28 70 65 6e 64 69  6e 67 49 6e 73 74 73 2c  |in(pendingInsts,|
00001810  20 6d 29 3b 0a 0a 20 20  20 70 6c 61 6e 74 41 74  | m);..   plantAt|
00001820  45 6e 64 20 3a 3d 20 52  65 76 65 72 73 65 49 6e  |End := ReverseIn|
00001830  50 6c 61 63 65 28 70 6c  61 6e 74 41 74 45 6e 64  |Place(plantAtEnd|
00001840  29 3b 0a 20 20 20 49 46  20 6c 61 62 41 74 45 6e  |);.   IF labAtEn|
00001850  64 7e 3d 4e 75 6c 6c 20  54 48 45 4e 20 53 65 74  |d~=Null THEN Set|
00001860  4c 61 62 65 6c 28 6c 61  62 41 74 45 6e 64 29 3b  |Label(labAtEnd);|
00001870  0a 20 20 20 50 6c 61 6e  74 49 6e 73 74 72 75 63  |.   PlantInstruc|
00001880  74 69 6f 6e 43 68 61 69  6e 28 70 6c 61 6e 74 41  |tionChain(plantA|
00001890  74 45 6e 64 2c 20 6d 2e  61 6c 77 61 79 73 29 3b  |tEnd, m.always);|
000018a0  0a 20 20 20 49 46 20 6d  63 6f 70 79 3d 4e 75 6c  |.   IF mcopy=Nul|
000018b0  6c 20 26 20 6c 61 62 41  74 45 6e 64 7e 3d 4e 75  |l & labAtEnd~=Nu|
000018c0  6c 6c 20 26 20 70 6c 3e  3d 30 20 54 48 45 4e 0a  |ll & pl>=0 THEN.|
000018d0  20 20 20 20 20 20 66 35  49 6e 73 74 4c 32 28 70  |      f5InstL2(p|
000018e0  6c 2c 20 66 2e 62 2c 20  70 65 6e 64 69 6e 67 4d  |l, f.b, pendingM|
000018f0  61 73 6b 29 3b 0a 0a 20  20 20 70 65 6e 64 69 6e  |ask);..   pendin|
00001900  67 43 6f 75 6e 74 20 3a  3d 20 30 3b 0a 20 20 20  |gCount := 0;.   |
00001910  6f 74 68 65 72 42 72 61  6e 63 68 2c 20 70 65 6e  |otherBranch, pen|
00001920  64 69 6e 67 49 6e 73 74  73 20 3a 3d 20 30 2c 20  |dingInsts := 0, |
00001930  30 3b 0a 20 20 20 64 65  61 64 43 6f 64 65 20 3a  |0;.   deadCode :|
00001940  3d 20 64 63 0a 24 29 0a  0a 41 4e 44 20 53 65 74  |= dc.$)..AND Set|
00001950  4c 61 62 65 6c 28 6c 29  20 42 45 0a 20 20 20 54  |Label(l) BE.   T|
00001960  45 53 54 20 50 65 6e 64  69 6e 67 4c 61 62 7e 3d  |EST PendingLab~=|
00001970  4e 75 6c 6c 0a 20 20 20  20 20 20 54 48 45 4e 20  |Null.      THEN |
00001980  41 64 64 50 65 6e 64 69  6e 67 49 6e 73 74 28 70  |AddPendingInst(p|
00001990  69 2e 53 65 74 4c 61 62  65 6c 2c 20 6c 29 0a 20  |i.SetLabel, l). |
000019a0  20 20 20 20 20 45 4c 53  45 20 52 65 61 6c 53 65  |     ELSE RealSe|
000019b0  74 4c 61 62 65 6c 28 6c  29 0a 0a 41 4e 44 20 53  |tLabel(l)..AND S|
000019c0  68 69 66 74 56 61 6c 75  65 28 73 68 69 66 74 54  |hiftValue(shiftT|
000019d0  79 70 65 2c 20 73 68 69  66 74 42 79 2c 20 72 32  |ype, shiftBy, r2|
000019e0  29 20 3d 0a 20 20 2f 2f  20 73 68 69 66 74 42 79  |) =.  // shiftBy|
000019f0  20 69 73 20 70 6f 73 69  74 69 76 65 20 69 66 20  | is positive if |
00001a00  74 68 65 20 73 68 69 66  74 20 69 73 20 62 79 20  |the shift is by |
00001a10  61 20 63 6f 6e 73 74 61  6e 74 2c 0a 20 20 2f 2f  |a constant,.  //|
00001a20  20 6e 65 67 61 74 69 76  65 20 69 66 20 62 79 20  | negative if by |
00001a30  74 68 65 20 76 61 6c 75  65 20 6f 66 20 61 20 72  |the value of a r|
00001a40  65 67 69 73 74 65 72 20  28 3d 20 2d 72 65 67 6e  |egister (= -regn|
00001a50  6f 29 0a 20 20 20 73 68  69 66 74 54 79 70 65 3d  |o).   shiftType=|
00001a60  4e 75 6c 6c 20 2d 3e 20  72 32 2c 0a 20 20 20 73  |Null -> r2,.   s|
00001a70  68 69 66 74 42 79 3e 3d  30 20 2d 3e 20 72 32 2b  |hiftBy>=0 -> r2+|
00001a80  73 68 69 66 74 54 79 70  65 2b 28 73 68 69 66 74  |shiftType+(shift|
00001a90  42 79 3c 3c 37 29 2c 0a  09 09 20 72 32 2b 73 68  |By<<7),... r2+sh|
00001aa0  69 66 74 54 79 70 65 2b  23 78 31 30 2b 28 28 2d  |iftType+#x10+((-|
00001ab0  73 68 69 66 74 42 79 29  3c 3c 38 29 0a 0a 41 4e  |shiftBy)<<8)..AN|
00001ac0  44 20 4c 6f 67 42 61 73  65 32 28 6e 29 20 3d 20  |D LogBase2(n) = |
00001ad0  56 41 4c 4f 46 0a 24 28  20 4c 45 54 20 69 20 3d  |VALOF.$( LET i =|
00001ae0  20 30 3b 0a 20 20 20 57  48 49 4c 45 20 28 6e 26  | 0;.   WHILE (n&|
00001af0  31 29 3d 30 20 44 4f 20  6e 2c 20 69 20 3a 3d 20  |1)=0 DO n, i := |
00001b00  6e 3e 3e 31 2c 20 69 2b  31 3b 0a 20 20 20 52 45  |n>>1, i+1;.   RE|
00001b10  53 55 4c 54 49 53 20 69  0a 24 29 0a 0a 41 4e 44  |SULTIS i.$)..AND|
00001b20  20 46 35 49 6e 73 74 28  6f 70 63 6f 64 65 2c 20  | F5Inst(opcode, |
00001b30  6f 66 66 73 65 74 2c 20  6d 61 73 6b 29 20 42 45  |offset, mask) BE|
00001b40  0a 20 20 20 49 46 20 64  65 61 64 43 6f 64 65 7e  |.   IF deadCode~|
00001b50  3d 44 65 61 64 20 54 48  45 4e 20 24 28 0a 20 20  |=Dead THEN $(.  |
00001b60  20 20 20 20 49 46 20 70  65 6e 64 69 6e 67 4c 61  |    IF pendingLa|
00001b70  62 7e 3d 4e 75 6c 6c 20  54 48 45 4e 0a 09 20 54  |b~=Null THEN.. T|
00001b80  45 53 54 20 70 65 6e 64  69 6e 67 43 6f 75 6e 74  |EST pendingCount|
00001b90  3c 50 65 6e 64 69 6e 67  42 75 66 66 65 72 53 69  |<PendingBufferSi|
00001ba0  7a 65 20 54 48 45 4e 20  24 28 0a 09 20 20 20 20  |ze THEN $(..    |
00001bb0  41 64 64 50 65 6e 64 69  6e 67 49 6e 73 74 28 70  |AddPendingInst(p|
00001bc0  69 2e 46 35 49 6e 73 74  2c 20 6f 70 63 6f 64 65  |i.F5Inst, opcode|
00001bd0  2c 20 6f 66 66 73 65 74  29 3b 0a 09 20 20 20 20  |, offset);..    |
00001be0  52 45 54 55 52 4e 20 24  29 0a 09 20 45 4c 53 45  |RETURN $).. ELSE|
00001bf0  0a 09 20 20 20 20 46 6c  75 73 68 50 65 6e 64 69  |..    FlushPendi|
00001c00  6e 67 49 6e 73 74 73 28  4e 75 6c 6c 2c 20 46 41  |ngInsts(Null, FA|
00001c10  4c 53 45 29 3b 0a 0a 20  20 20 20 20 20 50 75 74  |LSE);..      Put|
00001c20  57 6f 72 64 28 6f 70 63  6f 64 65 2b 6d 61 73 6b  |Word(opcode+mask|
00001c30  2b 28 28 5b 6f 66 66 73  65 74 2d 4c 6f 63 43 74  |+(([offset-LocCt|
00001c40  72 2d 38 5d 3e 3e 32 29  26 23 78 30 30 66 66 66  |r-8]>>2)&#x00fff|
00001c50  66 66 66 29 29 0a 24 29  0a 0a 0a 41 4e 44 20 46  |fff)).$)...AND F|
00001c60  35 49 6e 73 74 58 28 6f  70 63 6f 64 65 2c 20 73  |5InstX(opcode, s|
00001c70  79 6d 2c 20 6d 61 73 6b  29 20 42 45 0a 20 20 20  |ym, mask) BE.   |
00001c80  49 46 20 64 65 61 64 43  6f 64 65 7e 3d 44 65 61  |IF deadCode~=Dea|
00001c90  64 20 54 48 45 4e 20 24  28 0a 20 20 20 20 20 20  |d THEN $(.      |
00001ca0  49 46 20 70 65 6e 64 69  6e 67 4c 61 62 7e 3d 4e  |IF pendingLab~=N|
00001cb0  75 6c 6c 20 54 48 45 4e  0a 09 20 54 45 53 54 20  |ull THEN.. TEST |
00001cc0  70 65 6e 64 69 6e 67 43  6f 75 6e 74 3c 50 65 6e  |pendingCount<Pen|
00001cd0  64 69 6e 67 42 75 66 66  65 72 53 69 7a 65 20 54  |dingBufferSize T|
00001ce0  48 45 4e 20 24 28 0a 09  20 20 20 20 41 64 64 50  |HEN $(..    AddP|
00001cf0  65 6e 64 69 6e 67 49 6e  73 74 28 70 69 2e 46 35  |endingInst(pi.F5|
00001d00  49 6e 73 74 58 2c 20 6f  70 63 6f 64 65 2c 20 73  |InstX, opcode, s|
00001d10  79 6d 29 3b 0a 09 20 20  20 20 52 45 54 55 52 4e  |ym);..    RETURN|
00001d20  20 24 29 0a 09 20 45 4c  53 45 0a 09 20 20 20 20  | $).. ELSE..    |
00001d30  46 6c 75 73 68 50 65 6e  64 69 6e 67 49 6e 73 74  |FlushPendingInst|
00001d40  73 28 4e 75 6c 6c 2c 20  46 41 4c 53 45 29 3b 0a  |s(Null, FALSE);.|
00001d50  0a 20 20 20 20 20 20 41  64 64 58 52 65 6c 6f 63  |.      AddXReloc|
00001d60  61 74 65 64 4c 6f 63 28  6c 6f 63 43 74 72 2c 20  |atedLoc(locCtr, |
00001d70  73 79 6d 2c 20 52 65 6c  57 6f 72 64 2b 52 65 6c  |sym, RelWord+Rel|
00001d80  50 43 52 65 6c 2b 52 65  6c 53 79 6d 62 6f 6c 29  |PCRel+RelSymbol)|
00001d90  3b 0a 20 20 20 20 20 20  50 75 74 57 6f 72 64 28  |;.      PutWord(|
00001da0  6f 70 63 6f 64 65 2b 6d  61 73 6b 29 0a 24 29 0a  |opcode+mask).$).|
00001db0  0a 41 4e 44 20 46 34 49  6e 73 74 28 6f 70 63 6f  |.AND F4Inst(opco|
00001dc0  64 65 2c 20 62 61 73 65  2c 20 52 65 67 4c 69 73  |de, base, RegLis|
00001dd0  74 2c 20 77 62 2e 64 69  72 2e 70 72 65 70 6f 73  |t, wb.dir.prepos|
00001de0  74 2e 70 63 29 20 42 45  0a 20 20 20 46 34 49 6e  |t.pc) BE.   F4In|
00001df0  73 74 4d 28 6f 70 63 6f  64 65 2c 20 62 61 73 65  |stM(opcode, base|
00001e00  2c 20 52 65 67 4c 69 73  74 2c 20 77 62 2e 64 69  |, RegList, wb.di|
00001e10  72 2e 70 72 65 70 6f 73  74 2e 70 63 2c 20 6d 2e  |r.prepost.pc, m.|
00001e20  61 6c 77 61 79 73 29 0a  0a 41 4e 44 20 46 34 49  |always)..AND F4I|
00001e30  6e 73 74 4d 28 6f 70 63  6f 64 65 2c 20 62 61 73  |nstM(opcode, bas|
00001e40  65 2c 20 72 65 67 4c 69  73 74 2c 20 77 62 2e 64  |e, regList, wb.d|
00001e50  69 72 2e 70 72 65 70 6f  73 74 2e 70 63 2c 20 6d  |ir.prepost.pc, m|
00001e60  61 73 6b 29 20 42 45 0a  20 20 20 49 46 20 64 65  |ask) BE.   IF de|
00001e70  61 64 43 6f 64 65 7e 3d  44 65 61 64 20 54 48 45  |adCode~=Dead THE|
00001e80  4e 20 24 28 0a 20 20 20  20 20 20 49 46 20 70 65  |N $(.      IF pe|
00001e90  6e 64 69 6e 67 4c 61 62  7e 3d 4e 75 6c 6c 20 54  |ndingLab~=Null T|
00001ea0  48 45 4e 0a 09 20 54 45  53 54 20 70 65 6e 64 69  |HEN.. TEST pendi|
00001eb0  6e 67 43 6f 75 6e 74 3c  50 65 6e 64 69 6e 67 42  |ngCount<PendingB|
00001ec0  75 66 66 65 72 53 69 7a  65 20 54 48 45 4e 20 24  |ufferSize THEN $|
00001ed0  28 0a 09 20 20 20 20 41  64 64 50 65 6e 64 69 6e  |(..    AddPendin|
00001ee0  67 49 6e 73 74 28 70 69  2e 46 34 49 6e 73 74 2c  |gInst(pi.F4Inst,|
00001ef0  20 6f 70 63 6f 64 65 2c  20 62 61 73 65 2c 20 72  | opcode, base, r|
00001f00  65 67 4c 69 73 74 2c 0a  09 09 09 09 20 20 20 20  |egList,.....    |
00001f10  20 20 77 62 2e 64 69 72  2e 70 72 65 70 6f 73 74  |  wb.dir.prepost|
00001f20  2e 70 63 29 3b 0a 09 20  20 20 20 52 45 54 55 52  |.pc);..    RETUR|
00001f30  4e 20 24 29 0a 09 20 45  4c 53 45 0a 09 20 20 20  |N $).. ELSE..   |
00001f40  20 46 6c 75 73 68 50 65  6e 64 69 6e 67 49 6e 73  | FlushPendingIns|
00001f50  74 73 28 4e 75 6c 6c 2c  20 46 41 4c 53 45 29 3b  |ts(Null, FALSE);|
00001f60  0a 0a 20 20 20 50 75 74  57 6f 72 64 28 6f 70 63  |..   PutWord(opc|
00001f70  6f 64 65 2b 6d 61 73 6b  2b 77 62 2e 64 69 72 2e  |ode+mask+wb.dir.|
00001f80  70 72 65 70 6f 73 74 2e  70 63 2b 28 62 61 73 65  |prepost.pc+(base|
00001f90  3c 3c 31 36 29 2b 72 65  67 4c 69 73 74 29 0a 24  |<<16)+regList).$|
00001fa0  29 0a 0a 41 4e 44 20 46  32 49 6e 73 74 28 6f 70  |)..AND F2Inst(op|
00001fb0  63 6f 64 65 2c 20 72 65  67 2c 20 62 61 73 65 2c  |code, reg, base,|
00001fc0  20 6f 66 66 73 65 74 2c  20 72 32 2c 0a 09 20 20  | offset, r2,..  |
00001fd0  20 70 72 65 70 6f 73 74  2c 20 73 68 69 66 74 54  | prepost, shiftT|
00001fe0  79 70 65 2c 20 73 68 69  66 74 42 79 2c 20 6d 61  |ype, shiftBy, ma|
00001ff0  73 6b 29 20 42 45 0a 20  20 20 49 46 20 64 65 61  |sk) BE.   IF dea|
00002000  64 43 6f 64 65 7e 3d 44  65 61 64 20 54 48 45 4e  |dCode~=Dead THEN|
00002010  20 24 28 0a 20 20 20 20  20 20 4c 45 54 20 61 64  | $(.      LET ad|
00002020  64 72 54 79 70 65 20 3d  20 3f 3b 0a 20 20 20 20  |drType = ?;.    |
00002030  20 20 49 46 20 70 65 6e  64 69 6e 67 4c 61 62 7e  |  IF pendingLab~|
00002040  3d 4e 75 6c 6c 20 54 48  45 4e 0a 09 20 54 45 53  |=Null THEN.. TES|
00002050  54 20 70 65 6e 64 69 6e  67 43 6f 75 6e 74 3c 50  |T pendingCount<P|
00002060  65 6e 64 69 6e 67 42 75  66 66 65 72 53 69 7a 65  |endingBufferSize|
00002070  20 54 48 45 4e 20 24 28  0a 09 20 20 20 20 41 64  | THEN $(..    Ad|
00002080  64 50 65 6e 64 69 6e 67  49 6e 73 74 28 70 69 2e  |dPendingInst(pi.|
00002090  46 32 49 6e 73 74 2c 20  6f 70 63 6f 64 65 2c 20  |F2Inst, opcode, |
000020a0  72 65 67 2c 20 62 61 73  65 2c 20 6f 66 66 73 65  |reg, base, offse|
000020b0  74 2c 20 72 32 2c 0a 09  09 09 09 20 20 20 20 20  |t, r2,.....     |
000020c0  20 70 72 65 70 6f 73 74  2c 20 73 68 69 66 74 54  | prepost, shiftT|
000020d0  79 70 65 2c 20 73 68 69  66 74 42 79 29 3b 0a 09  |ype, shiftBy);..|
000020e0  20 20 20 20 52 45 54 55  52 4e 20 24 29 0a 09 20  |    RETURN $).. |
000020f0  45 4c 53 45 0a 09 20 20  20 20 46 6c 75 73 68 50  |ELSE..    FlushP|
00002100  65 6e 64 69 6e 67 49 6e  73 74 73 28 4e 75 6c 6c  |endingInsts(Null|
00002110  2c 20 46 41 4c 53 45 29  3b 0a 0a 20 20 20 20 20  |, FALSE);..     |
00002120  20 54 45 53 54 20 72 32  7e 3d 4e 75 6c 6c 20 54  | TEST r2~=Null T|
00002130  48 45 4e 20 24 28 0a 09  20 61 64 64 72 54 79 70  |HEN $(.. addrTyp|
00002140  65 20 3a 3d 20 23 78 32  30 30 30 30 30 30 0a 09  |e := #x2000000..|
00002150  20 6f 66 66 73 65 74 20  3a 3d 20 53 68 69 66 74  | offset := Shift|
00002160  56 61 6c 75 65 28 73 68  69 66 74 54 79 70 65 2c  |Value(shiftType,|
00002170  20 73 68 69 66 74 42 79  2c 20 72 32 29 20 24 29  | shiftBy, r2) $)|
00002180  0a 0a 20 20 20 20 20 20  45 4c 53 45 20 54 45 53  |..      ELSE TES|
00002190  54 20 6f 66 66 73 65 74  3c 30 20 54 48 45 4e 0a  |T offset<0 THEN.|
000021a0  09 20 61 64 64 72 54 79  70 65 2c 20 6f 66 66 73  |. addrType, offs|
000021b0  65 74 20 3a 3d 20 66 2e  64 6f 77 6e 2c 20 2d 6f  |et := f.down, -o|
000021c0  66 66 73 65 74 0a 20 20  20 20 20 20 45 4c 53 45  |ffset.      ELSE|
000021d0  0a 09 20 61 64 64 72 54  79 70 65 20 3a 3d 20 66  |.. addrType := f|
000021e0  2e 75 70 3b 0a 0a 20 20  20 20 20 20 49 46 20 7e  |.up;..      IF ~|
000021f0  28 30 3c 3d 6f 66 66 73  65 74 3c 3d 66 32 2e 6d  |(0<=offset<=f2.m|
00002200  61 78 2e 6f 66 66 73 65  74 29 20 54 48 45 4e 20  |ax.offset) THEN |
00002210  24 28 0a 09 20 43 47 45  72 72 6f 72 28 46 41 4c  |$(.. CGError(FAL|
00002220  53 45 2c 20 22 46 32 49  6e 73 74 3a 20 6f 66 66  |SE, "F2Inst: off|
00002230  73 65 74 20 25 6e 22 2c  20 6f 66 66 73 65 74 29  |set %n", offset)|
00002240  3b 0a 09 20 6f 66 66 73  65 74 20 3a 3d 20 30 20  |;.. offset := 0 |
00002250  24 29 3b 0a 0a 20 20 20  20 20 20 50 75 74 57 6f  |$);..      PutWo|
00002260  72 64 28 6d 61 73 6b 2b  6f 70 63 6f 64 65 2b 70  |rd(mask+opcode+p|
00002270  72 65 70 6f 73 74 2b 61  64 64 72 54 79 70 65 2b  |repost+addrType+|
00002280  28 62 61 73 65 3c 3c 31  36 29 2b 0a 09 20 20 20  |(base<<16)+..   |
00002290  20 20 20 28 72 65 67 3c  3c 31 32 29 2b 6f 66 66  |   (reg<<12)+off|
000022a0  73 65 74 29 20 24 29 0a  0a 41 4e 44 20 50 61 63  |set) $)..AND Pac|
000022b0  6b 55 70 28 6f 66 66 73  65 74 29 20 3d 0a 20 20  |kUp(offset) =.  |
000022c0  20 6f 66 66 73 65 74 3d  30 20 2d 3e 20 30 2c 20  | offset=0 -> 0, |
000022d0  56 41 4c 4f 46 0a 20 20  20 24 28 20 4c 45 54 20  |VALOF.   $( LET |
000022e0  6c 73 62 69 74 20 3d 20  6f 66 66 73 65 74 26 28  |lsbit = offset&(|
000022f0  2d 6f 66 66 73 65 74 29  3b 0a 20 20 20 20 20 20  |-offset);.      |
00002300  4c 45 54 20 73 68 69 66  74 20 3d 20 30 3b 0a 20  |LET shift = 0;. |
00002310  20 20 20 20 20 54 45 53  54 20 6c 73 62 69 74 3e  |     TEST lsbit>|
00002320  32 20 54 48 45 4e 20 24  28 0a 09 20 73 68 69 66  |2 THEN $(.. shif|
00002330  74 20 3a 3d 20 33 32 2d  5b 4c 6f 67 42 61 73 65  |t := 32-[LogBase|
00002340  32 28 6c 73 62 69 74 29  20 26 20 28 2d 32 29 5d  |2(lsbit) & (-2)]|
00002350  3b 0a 09 20 54 45 53 54  20 73 68 69 66 74 3d 33  |;.. TEST shift=3|
00002360  32 20 54 48 45 4e 0a 09  20 20 20 20 73 68 69 66  |2 THEN..    shif|
00002370  74 20 3a 3d 20 30 0a 09  20 45 4c 53 45 0a 09 20  |t := 0.. ELSE.. |
00002380  20 20 20 6f 66 66 73 65  74 20 3a 3d 20 6f 66 66  |   offset := off|
00002390  73 65 74 3e 3e 28 33 32  2d 73 68 69 66 74 29 20  |set>>(32-shift) |
000023a0  24 29 0a 20 20 20 20 20  20 45 4c 53 45 20 24 28  |$).      ELSE $(|
000023b0  0a 09 20 4c 45 54 20 6e  20 3d 20 6f 66 66 73 65  |.. LET n = offse|
000023c0  74 3b 0a 09 20 57 48 49  4c 45 20 28 6e 26 23 78  |t;.. WHILE (n&#x|
000023d0  63 30 30 30 30 30 30 30  29 7e 3d 30 20 44 4f 20  |c0000000)~=0 DO |
000023e0  24 28 0a 09 20 20 20 20  6e 20 3a 3d 20 6e 3c 3c  |$(..    n := n<<|
000023f0  32 3b 20 73 68 69 66 74  20 3a 3d 20 73 68 69 66  |2; shift := shif|
00002400  74 2b 32 20 24 29 3b 0a  09 20 6f 66 66 73 65 74  |t+2 $);.. offset|
00002410  20 3a 3d 20 52 6f 74 61  74 65 52 69 67 68 74 28  | := RotateRight(|
00002420  6f 66 66 73 65 74 2c 20  33 32 2d 73 68 69 66 74  |offset, 32-shift|
00002430  29 20 24 29 3b 0a 0a 20  20 20 20 20 20 49 46 20  |) $);..      IF |
00002440  6f 66 66 73 65 74 3e 3d  23 78 31 30 30 20 54 48  |offset>=#x100 TH|
00002450  45 4e 20 24 28 0a 09 20  43 47 45 72 72 6f 72 28  |EN $(.. CGError(|
00002460  46 41 4c 53 45 2c 20 22  46 31 49 6e 73 74 3a 20  |FALSE, "F1Inst: |
00002470  4f 66 66 73 65 74 20 25  78 38 20 77 69 6c 6c 20  |Offset %x8 will |
00002480  6e 6f 74 20 66 69 74 20  69 6e 20 38 20 62 69 74  |not fit in 8 bit|
00002490  73 22 2c 0a 09 09 09 52  6f 74 61 74 65 52 69 67  |s",....RotateRig|
000024a0  68 74 28 6f 66 66 73 65  74 2c 20 73 68 69 66 74  |ht(offset, shift|
000024b0  29 29 3b 0a 09 20 6f 66  66 73 65 74 20 3a 3d 20  |));.. offset := |
000024c0  30 20 24 29 3b 0a 0a 20  20 20 20 20 20 52 45 53  |0 $);..      RES|
000024d0  55 4c 54 49 53 20 6f 66  66 73 65 74 20 2b 20 28  |ULTIS offset + (|
000024e0  73 68 69 66 74 3c 3c 37  29 0a 20 20 20 24 29 0a  |shift<<7).   $).|
000024f0  0a 41 4e 44 20 46 31 49  6e 73 74 28 6f 70 63 6f  |.AND F1Inst(opco|
00002500  64 65 2c 20 72 65 67 2c  20 62 61 73 65 2c 20 72  |de, reg, base, r|
00002510  32 2c 20 6f 66 66 73 65  74 2c 20 73 68 69 66 74  |2, offset, shift|
00002520  54 79 70 65 2c 20 73 68  69 66 74 42 79 2c 20 6d  |Type, shiftBy, m|
00002530  29 20 42 45 0a 20 20 20  49 46 20 64 65 61 64 43  |) BE.   IF deadC|
00002540  6f 64 65 7e 3d 44 65 61  64 20 54 48 45 4e 20 24  |ode~=Dead THEN $|
00002550  28 0a 20 20 20 20 20 20  4c 45 54 20 61 64 64 72  |(.      LET addr|
00002560  54 79 70 65 20 3d 20 3f  0a 20 20 20 20 20 20 49  |Type = ?.      I|
00002570  46 20 70 65 6e 64 69 6e  67 4c 61 62 7e 3d 4e 75  |F pendingLab~=Nu|
00002580  6c 6c 20 54 48 45 4e 0a  09 20 54 45 53 54 20 6d  |ll THEN.. TEST m|
00002590  3d 6d 2e 61 6c 77 61 79  73 20 26 20 70 65 6e 64  |=m.always & pend|
000025a0  69 6e 67 43 6f 75 6e 74  3c 50 65 6e 64 69 6e 67  |ingCount<Pending|
000025b0  42 75 66 66 65 72 53 69  7a 65 20 54 48 45 4e 20  |BufferSize THEN |
000025c0  24 28 0a 09 20 20 20 20  41 64 64 50 65 6e 64 69  |$(..    AddPendi|
000025d0  6e 67 49 6e 73 74 28 70  69 2e 46 31 49 6e 73 74  |ngInst(pi.F1Inst|
000025e0  2c 20 6f 70 63 6f 64 65  2c 20 72 65 67 2c 20 62  |, opcode, reg, b|
000025f0  61 73 65 2c 20 72 32 2c  0a 09 09 09 09 20 20 20  |ase, r2,.....   |
00002600  20 20 20 6f 66 66 73 65  74 2c 20 73 68 69 66 74  |   offset, shift|
00002610  54 79 70 65 2c 20 73 68  69 66 74 42 79 29 3b 0a  |Type, shiftBy);.|
00002620  09 20 20 20 20 52 45 54  55 52 4e 20 24 29 0a 09  |.    RETURN $)..|
00002630  20 45 4c 53 45 0a 09 20  20 20 20 46 6c 75 73 68  | ELSE..    Flush|
00002640  50 65 6e 64 69 6e 67 49  6e 73 74 73 28 4e 75 6c  |PendingInsts(Nul|
00002650  6c 2c 20 46 41 4c 53 45  29 3b 0a 0a 20 20 20 20  |l, FALSE);..    |
00002660  20 20 54 45 53 54 20 72  32 3d 4e 75 6c 6c 20 54  |  TEST r2=Null T|
00002670  48 45 4e 20 24 28 0a 09  20 61 64 64 72 54 79 70  |HEN $(.. addrTyp|
00002680  65 20 3a 3d 20 23 78 32  30 30 30 30 30 30 3b 0a  |e := #x2000000;.|
00002690  09 20 6f 66 66 73 65 74  20 3a 3d 20 50 61 63 6b  |. offset := Pack|
000026a0  55 70 28 6f 66 66 73 65  74 29 20 24 29 0a 20 20  |Up(offset) $).  |
000026b0  20 20 20 20 45 4c 53 45  20 24 28 0a 09 20 61 64  |    ELSE $(.. ad|
000026c0  64 72 54 79 70 65 3a 3d  20 30 3b 0a 09 20 6f 66  |drType:= 0;.. of|
000026d0  66 73 65 74 20 3a 3d 20  53 68 69 66 74 56 61 6c  |fset := ShiftVal|
000026e0  75 65 28 73 68 69 66 74  54 79 70 65 2c 20 73 68  |ue(shiftType, sh|
000026f0  69 66 74 42 79 2c 20 72  32 29 20 24 29 3b 0a 0a  |iftBy, r2) $);..|
00002700  20 20 20 20 20 20 50 75  74 57 6f 72 64 28 6d 2b  |      PutWord(m+|
00002710  6f 70 63 6f 64 65 2b 61  64 64 72 54 79 70 65 2b  |opcode+addrType+|
00002720  28 62 61 73 65 3c 3c 31  36 29 2b 6f 66 66 73 65  |(base<<16)+offse|
00002730  74 2b 28 72 65 67 3c 3c  31 32 29 29 20 24 29 0a  |t+(reg<<12)) $).|
00002740  0a 41 4e 44 20 47 65 6e  46 31 4b 28 66 2c 20 72  |.AND GenF1K(f, r|
00002750  2c 20 73 2c 20 6b 29 20  42 45 0a 24 28 20 4c 45  |, s, k) BE.$( LE|
00002760  54 20 65 20 3d 20 45 69  67 68 74 42 69 74 73 4f  |T e = EightBitsO|
00002770  72 46 65 77 65 72 28 6b  29 3b 0a 20 20 20 4c 45  |rFewer(k);.   LE|
00002780  54 20 6d 20 3d 20 65 69  67 68 74 42 69 74 4d 61  |T m = eightBitMa|
00002790  73 6b 3b 0a 20 20 20 54  45 53 54 20 65 20 54 48  |sk;.   TEST e TH|
000027a0  45 4e 0a 20 20 20 20 20  20 46 31 49 6e 73 74 28  |EN.      F1Inst(|
000027b0  66 2c 20 72 2c 20 73 2c  20 4e 75 6c 6c 2c 20 6b  |f, r, s, Null, k|
000027c0  2c 20 4e 75 6c 6c 2c 20  30 2c 20 6d 2e 61 6c 77  |, Null, 0, m.alw|
000027d0  61 79 73 29 0a 20 20 20  45 4c 53 45 20 54 45 53  |ays).   ELSE TES|
000027e0  54 20 28 66 3d 66 2e 61  64 64 20 7c 20 66 3d 66  |T (f=f.add | f=f|
000027f0  2e 73 75 62 20 7c 20 66  3d 66 2e 6f 72 72 20 7c  |.sub | f=f.orr ||
00002800  20 66 3d 66 2e 65 6f 72  20 7c 20 66 3d 66 2e 62  | f=f.eor | f=f.b|
00002810  69 63 29 20 26 0a 09 20  20 20 20 20 45 69 67 68  |ic) &..     Eigh|
00002820  74 42 69 74 73 4f 72 46  65 77 65 72 28 6b 26 7e  |tBitsOrFewer(k&~|
00002830  6d 29 20 54 48 45 4e 20  24 28 0a 20 20 20 20 20  |m) THEN $(.     |
00002840  20 47 65 6e 46 31 4b 28  66 2c 20 72 2c 20 73 2c  | GenF1K(f, r, s,|
00002850  20 6b 26 6d 29 3b 0a 20  20 20 20 20 20 47 65 6e  | k&m);.      Gen|
00002860  46 31 4b 28 66 2c 20 72  2c 20 72 2c 20 6b 26 7e  |F1K(f, r, r, k&~|
00002870  6d 29 20 24 29 0a 20 20  20 45 4c 53 45 20 24 28  |m) $).   ELSE $(|
00002880  0a 20 20 20 20 20 20 53  65 74 52 74 6f 4b 28 72  |.      SetRtoK(r|
00002890  2e 30 2c 20 6b 29 3b 0a  20 20 20 20 20 20 72 30  |.0, k);.      r0|
000028a0  4f 66 66 73 65 74 20 3a  3d 20 4e 75 6c 6c 3b 0a  |Offset := Null;.|
000028b0  20 20 20 20 20 20 47 65  6e 52 52 28 66 2c 20 72  |      GenRR(f, r|
000028c0  2c 20 73 2c 20 72 2e 30  29 20 24 29 0a 24 29 0a  |, s, r.0) $).$).|
000028d0  0a 41 4e 44 20 43 6f 6d  70 61 72 65 41 67 61 69  |.AND CompareAgai|
000028e0  6e 73 74 4b 28 72 2c 20  6b 2c 20 63 6d 29 20 42  |nstK(r, k, cm) B|
000028f0  45 20 7b 0a 20 20 20 4c  45 54 20 65 20 3d 20 45  |E {.   LET e = E|
00002900  69 67 68 74 42 69 74 73  4f 72 46 65 77 65 72 28  |ightBitsOrFewer(|
00002910  6b 29 3b 0a 20 20 20 4c  45 54 20 6d 20 3d 20 65  |k);.   LET m = e|
00002920  69 67 68 74 42 69 74 4d  61 73 6b 3b 0a 20 20 20  |ightBitMask;.   |
00002930  4c 45 54 20 75 6e 73 69  67 6e 65 64 20 3d 20 63  |LET unsigned = c|
00002940  6d 3d 6d 2e 67 74 75 20  7c 20 63 6d 3d 6d 2e 67  |m=m.gtu | cm=m.g|
00002950  65 75 20 7c 20 63 6d 3d  6d 2e 6c 74 75 20 7c 20  |eu | cm=m.ltu | |
00002960  63 6d 3d 6d 2e 6c 65 75  3b 0a 20 20 20 54 45 53  |cm=m.leu;.   TES|
00002970  54 20 65 20 54 48 45 4e  0a 20 20 20 20 20 20 46  |T e THEN.      F|
00002980  31 49 6e 73 74 28 66 2e  63 6d 70 73 2c 20 72 2c  |1Inst(f.cmps, r,|
00002990  20 72 2c 20 4e 75 6c 6c  2c 20 6b 2c 20 4e 75 6c  | r, Null, k, Nul|
000029a0  6c 2c 20 30 2c 20 6d 2e  61 6c 77 61 79 73 29 0a  |l, 0, m.always).|
000029b0  20 20 20 45 4c 53 45 20  54 45 53 54 20 6b 3c 30  |   ELSE TEST k<0|
000029c0  20 26 20 7e 75 6e 73 69  67 6e 65 64 20 26 20 45  | & ~unsigned & E|
000029d0  69 67 68 74 42 69 74 73  4f 72 46 65 77 65 72 28  |ightBitsOrFewer(|
000029e0  2d 6b 29 20 54 48 45 4e  0a 20 20 20 20 20 20 46  |-k) THEN.      F|
000029f0  31 49 6e 73 74 28 66 2e  63 6d 6e 73 2c 20 72 2c  |1Inst(f.cmns, r,|
00002a00  20 72 2c 20 4e 75 6c 6c  2c 20 2d 6b 2c 20 4e 75  | r, Null, -k, Nu|
00002a10  6c 6c 2c 20 30 2c 20 6d  2e 61 6c 77 61 79 73 29  |ll, 0, m.always)|
00002a20  0a 20 20 20 45 4c 53 45  20 54 45 53 54 20 7e 75  |.   ELSE TEST ~u|
00002a30  6e 73 69 67 6e 65 64 20  26 20 6b 3e 30 20 26 20  |nsigned & k>0 & |
00002a40  45 69 67 68 74 42 69 74  73 4f 72 46 65 77 65 72  |EightBitsOrFewer|
00002a50  28 6b 26 7e 6d 29 20 54  48 45 4e 0a 20 20 20 20  |(k&~m) THEN.    |
00002a60  20 20 54 45 53 54 20 63  6d 3d 6d 2e 65 71 20 7c  |  TEST cm=m.eq ||
00002a70  20 63 6d 3d 6d 2e 6e 65  20 54 48 45 4e 20 7b 0a  | cm=m.ne THEN {.|
00002a80  09 20 47 65 6e 46 31 4b  28 66 2e 73 75 62 2c 20  |. GenF1K(f.sub, |
00002a90  72 2e 30 2c 20 72 2c 20  6b 26 6d 29 3b 0a 09 20  |r.0, r, k&m);.. |
00002aa0  47 65 6e 46 31 4b 28 66  2e 73 75 62 73 2c 20 72  |GenF1K(f.subs, r|
00002ab0  2e 30 2c 20 72 2e 30 2c  20 6b 26 7e 6d 29 3b 0a  |.0, r.0, k&~m);.|
00002ac0  09 20 72 30 4f 66 66 73  65 74 20 3a 3d 20 4e 75  |. r0Offset := Nu|
00002ad0  6c 6c 20 7d 0a 20 20 20  20 20 20 45 4c 53 45 20  |ll }.      ELSE |
00002ae0  7b 0a 09 20 46 31 49 6e  73 74 28 66 2e 73 75 62  |{.. F1Inst(f.sub|
00002af0  73 2c 20 72 2e 30 2c 20  72 2c 20 4e 75 6c 6c 2c  |s, r.0, r, Null,|
00002b00  20 6b 26 6d 2c 20 4e 75  6c 6c 2c 20 30 2c 20 6d  | k&m, Null, 0, m|
00002b10  2e 61 6c 77 61 79 73 29  3b 0a 09 20 46 31 49 6e  |.always);.. F1In|
00002b20  73 74 28 66 2e 73 75 62  73 2c 20 72 2e 30 2c 20  |st(f.subs, r.0, |
00002b30  72 2e 30 2c 20 4e 75 6c  6c 2c 20 6b 26 7e 6d 2c  |r.0, Null, k&~m,|
00002b40  20 4e 75 6c 6c 2c 20 30  2c 20 6d 2e 67 65 29 3b  | Null, 0, m.ge);|
00002b50  0a 09 20 72 30 4f 66 66  73 65 74 20 3a 3d 20 4e  |.. r0Offset := N|
00002b60  75 6c 6c 20 7d 0a 20 20  20 45 4c 53 45 20 54 45  |ull }.   ELSE TE|
00002b70  53 54 20 75 6e 73 69 67  6e 65 64 20 26 20 45 69  |ST unsigned & Ei|
00002b80  67 68 74 42 69 74 73 4f  72 46 65 77 65 72 28 6b  |ghtBitsOrFewer(k|
00002b90  26 7e 6d 29 20 54 48 45  4e 20 7b 0a 20 20 20 20  |&~m) THEN {.    |
00002ba0  20 20 46 31 49 6e 73 74  28 66 2e 73 75 62 73 2c  |  F1Inst(f.subs,|
00002bb0  20 72 2e 30 2c 20 72 2c  20 4e 75 6c 6c 2c 20 6b  | r.0, r, Null, k|
00002bc0  26 6d 2c 20 4e 75 6c 6c  2c 20 30 2c 20 6d 2e 61  |&m, Null, 0, m.a|
00002bd0  6c 77 61 79 73 29 3b 0a  20 20 20 20 20 20 46 31  |lways);.      F1|
00002be0  49 6e 73 74 28 66 2e 73  75 62 73 2c 20 72 2e 30  |Inst(f.subs, r.0|
00002bf0  2c 20 72 2e 30 2c 20 4e  75 6c 6c 2c 20 6b 26 7e  |, r.0, Null, k&~|
00002c00  6d 2c 20 4e 75 6c 6c 2c  20 30 2c 20 6d 2e 67 65  |m, Null, 0, m.ge|
00002c10  75 29 3b 0a 20 20 20 20  20 20 72 30 4f 66 66 73  |u);.      r0Offs|
00002c20  65 74 20 3a 3d 20 4e 75  6c 6c 20 7d 0a 20 20 20  |et := Null }.   |
00002c30  45 4c 53 45 20 7b 0a 20  20 20 20 20 20 53 65 74  |ELSE {.      Set|
00002c40  52 74 6f 4b 28 72 2e 30  2c 20 6b 29 3b 0a 20 20  |RtoK(r.0, k);.  |
00002c50  20 20 20 20 72 30 4f 66  66 73 65 74 20 3a 3d 20  |    r0Offset := |
00002c60  4e 75 6c 6c 3b 0a 20 20  20 20 20 20 47 65 6e 52  |Null;.      GenR|
00002c70  52 28 66 2e 63 6d 70 73  2c 20 72 2c 20 72 2c 20  |R(f.cmps, r, r, |
00002c80  72 2e 30 29 20 7d 20 7d  0a 0a 41 4e 44 20 47 65  |r.0) } }..AND Ge|
00002c90  6e 52 52 28 66 2c 20 72  2c 20 73 2c 20 72 32 29  |nRR(f, r, s, r2)|
00002ca0  20 42 45 0a 20 20 20 46  31 49 6e 73 74 28 66 2c  | BE.   F1Inst(f,|
00002cb0  20 72 2c 20 73 2c 20 72  32 2c 20 30 2c 20 4e 75  | r, s, r2, 0, Nu|
00002cc0  6c 6c 2c 20 30 2c 20 6d  2e 61 6c 77 61 79 73 29  |ll, 0, m.always)|
00002cd0  0a 0a 41 4e 44 20 47 65  6e 46 32 28 66 2c 20 72  |..AND GenF2(f, r|
00002ce0  2c 20 62 61 73 65 2c 20  6c 61 62 2c 20 6f 66 66  |, base, lab, off|
00002cf0  73 65 74 29 20 42 45 0a  24 28 20 49 46 20 70 65  |set) BE.$( IF pe|
00002d00  6e 64 69 6e 67 4c 61 62  7e 3d 4e 75 6c 6c 20 54  |ndingLab~=Null T|
00002d10  48 45 4e 0a 20 20 20 20  20 20 54 45 53 54 20 70  |HEN.      TEST p|
00002d20  65 6e 64 69 6e 67 43 6f  75 6e 74 3c 50 65 6e 64  |endingCount<Pend|
00002d30  69 6e 67 42 75 66 66 65  72 53 69 7a 65 20 54 48  |ingBufferSize TH|
00002d40  45 4e 20 24 28 0a 09 20  41 64 64 50 65 6e 64 69  |EN $(.. AddPendi|
00002d50  6e 67 49 6e 73 74 28 70  69 2e 47 65 6e 46 32 2c  |ngInst(pi.GenF2,|
00002d60  20 66 2c 20 72 2c 20 62  61 73 65 2c 20 6c 61 62  | f, r, base, lab|
00002d70  2c 20 6f 66 66 73 65 74  29 3b 0a 09 20 52 45 54  |, offset);.. RET|
00002d80  55 52 4e 20 24 29 0a 20  20 20 20 20 20 45 4c 53  |URN $).      ELS|
00002d90  45 0a 09 20 46 6c 75 73  68 50 65 6e 64 69 6e 67  |E.. FlushPending|
00002da0  49 6e 73 74 73 28 4e 75  6c 6c 2c 20 46 41 4c 53  |Insts(Null, FALS|
00002db0  45 29 3b 0a 20 20 20 47  65 6e 46 32 4d 28 66 2c  |E);.   GenF2M(f,|
00002dc0  20 72 2c 20 62 61 73 65  2c 20 6c 61 62 2c 20 6f  | r, base, lab, o|
00002dd0  66 66 73 65 74 2c 20 6d  2e 61 6c 77 61 79 73 29  |ffset, m.always)|
00002de0  0a 24 29 0a 0a 41 4e 44  20 47 65 6e 46 32 4d 28  |.$)..AND GenF2M(|
00002df0  66 2c 20 72 2c 20 62 61  73 65 2c 20 6c 61 62 2c  |f, r, base, lab,|
00002e00  20 6f 66 66 73 65 74 2c  20 6d 29 20 42 45 0a 20  | offset, m) BE. |
00002e10  20 20 54 45 53 54 20 6c  61 62 7e 3d 30 20 54 48  |  TEST lab~=0 TH|
00002e20  45 4e 20 24 28 0a 20 20  20 20 20 20 4c 45 54 20  |EN $(.      LET |
00002e30  6c 61 62 6f 66 66 73 65  74 20 3d 20 56 61 6c 75  |laboffset = Valu|
00002e40  65 4f 66 4c 61 62 65 6c  28 6c 61 62 29 3b 0a 20  |eOfLabel(lab);. |
00002e50  20 20 20 20 20 4c 45 54  20 66 6f 70 20 3d 20 28  |     LET fop = (|
00002e60  66 26 23 78 66 30 30 29  7e 3d 30 3b 0a 20 20 20  |f&#xf00)~=0;.   |
00002e70  20 20 20 49 46 20 6c 61  62 6f 66 66 73 65 74 7e  |   IF laboffset~|
00002e80  3d 4e 75 6c 6c 20 26 20  66 6f 70 20 54 48 45 4e  |=Null & fop THEN|
00002e90  0a 09 20 6c 61 62 6f 66  66 73 65 74 20 3a 3d 20  |.. laboffset := |
00002ea0  6c 61 62 6f 66 66 73 65  74 2f 42 79 74 65 73 50  |laboffset/BytesP|
00002eb0  65 72 57 6f 72 64 0a 20  20 20 20 20 20 2f 2a 20  |erWord.      /* |
00002ec0  59 65 75 63 68 21 21 20  20 46 6c 6f 61 74 69 6e  |Yeuch!!  Floatin|
00002ed0  67 20 70 6f 69 6e 74 20  6f 66 66 73 65 74 73 20  |g point offsets |
00002ee0  61 72 65 20 73 63 61 6c  65 64 20 2a 2f 0a 20 20  |are scaled */.  |
00002ef0  20 20 20 20 54 45 53 54  20 6c 61 62 6f 66 66 73  |    TEST laboffs|
00002f00  65 74 3d 4e 75 6c 6c 20  54 48 45 4e 20 24 28 0a  |et=Null THEN $(.|
00002f10  09 20 61 64 64 72 65 66  28 4c 6f 63 43 74 72 2c  |. addref(LocCtr,|
00002f20  20 28 66 6f 70 20 2d 3e  20 36 2c 20 32 29 2c 20  | (fop -> 6, 2), |
00002f30  6c 61 62 29 0a 09 20 46  32 49 6e 73 74 28 66 2c  |lab).. F2Inst(f,|
00002f40  20 72 2c 20 62 61 73 65  2c 20 6f 66 66 73 65 74  | r, base, offset|
00002f50  2c 20 4e 75 6c 6c 2c 20  66 2e 70 72 65 2c 20 4e  |, Null, f.pre, N|
00002f60  75 6c 6c 2c 20 30 2c 20  6d 29 20 24 29 0a 20 20  |ull, 0, m) $).  |
00002f70  20 20 20 20 45 4c 53 45  20 46 32 49 6e 73 74 28  |    ELSE F2Inst(|
00002f80  66 2c 20 72 2c 20 62 61  73 65 2c 20 6f 66 66 73  |f, r, base, offs|
00002f90  65 74 2b 6c 61 62 6f 66  66 73 65 74 2c 0a 09 09  |et+laboffset,...|
00002fa0  09 4e 75 6c 6c 2c 20 66  2e 70 72 65 2c 20 4e 75  |.Null, f.pre, Nu|
00002fb0  6c 6c 2c 20 30 2c 20 6d  29 20 24 29 0a 0a 20 20  |ll, 0, m) $)..  |
00002fc0  20 45 4c 53 45 20 24 28  0a 20 20 20 20 20 20 4c  | ELSE $(.      L|
00002fd0  45 54 20 6d 61 78 20 3d  20 66 32 2e 6d 61 78 2e  |ET max = f2.max.|
00002fe0  6f 66 66 73 65 74 3b 0a  20 20 20 20 20 20 49 46  |offset;.      IF|
00002ff0  20 28 6f 70 26 23 78 66  30 30 29 7e 3d 30 20 54  | (op&#xf00)~=0 T|
00003000  48 45 4e 20 6d 61 78 20  3a 3d 20 23 78 66 66 3b  |HEN max := #xff;|
00003010  0a 20 20 20 20 20 20 49  46 20 7e 28 2d 6d 61 78  |.      IF ~(-max|
00003020  3c 3d 6f 66 66 73 65 74  3c 3d 6d 61 78 29 20 54  |<=offset<=max) T|
00003030  48 45 4e 20 24 28 0a 09  20 4c 45 54 20 6f 20 3d  |HEN $(.. LET o =|
00003040  20 5b 6f 66 66 73 65 74  2f 28 6d 61 78 2b 31 29  | [offset/(max+1)|
00003050  5d 2a 28 6d 61 78 2b 31  29 3b 0a 09 20 53 65 74  |]*(max+1);.. Set|
00003060  52 74 6f 52 70 6c 75 73  4b 4d 28 72 2e 30 2c 20  |RtoRplusKM(r.0, |
00003070  62 61 73 65 2c 20 6f 2c  20 6d 29 3b 0a 09 20 6f  |base, o, m);.. o|
00003080  66 66 73 65 74 20 3a 3d  20 6f 66 66 73 65 74 2d  |ffset := offset-|
00003090  6f 3b 0a 09 20 72 30 4f  66 66 73 65 74 20 3a 3d  |o;.. r0Offset :=|
000030a0  20 4e 75 6c 6c 3b 0a 09  20 62 61 73 65 20 3a 3d  | Null;.. base :=|
000030b0  20 72 2e 30 20 24 29 3b  0a 20 20 20 20 20 20 46  | r.0 $);.      F|
000030c0  32 49 6e 73 74 28 66 2c  20 72 2c 20 62 61 73 65  |2Inst(f, r, base|
000030d0  2c 20 6f 66 66 73 65 74  2c 20 4e 75 6c 6c 2c 20  |, offset, Null, |
000030e0  66 2e 70 72 65 2c 20 4e  75 6c 6c 2c 20 30 2c 20  |f.pre, Null, 0, |
000030f0  6d 29 20 24 29 0a 0a 41  4e 44 20 43 61 6c 6c 53  |m) $)..AND CallS|
00003100  75 62 28 73 72 29 20 42  45 0a 24 28 20 44 69 73  |ub(sr) BE.$( Dis|
00003110  63 61 72 64 52 65 67 28  72 2e 31 34 2c 20 6b 2e  |cardReg(r.14, k.|
00003120  72 65 67 29 3b 0a 20 20  20 47 65 6e 52 52 28 66  |reg);.   GenRR(f|
00003130  2e 6d 6f 76 2c 20 72 2e  31 34 2c 20 30 2c 20 72  |.mov, r.14, 0, r|
00003140  2e 70 63 29 3b 0a 20 20  20 53 65 74 52 74 6f 52  |.pc);.   SetRtoR|
00003150  70 6c 75 73 4b 28 72 2e  70 63 2c 20 72 2e 67 62  |plusK(r.pc, r.gb|
00003160  2c 20 73 72 29 0a 24 29  0a 0a 41 4e 44 20 53 65  |, sr).$)..AND Se|
00003170  74 52 74 6f 52 70 6c 75  73 4c 70 6c 75 73 4b 28  |tRtoRplusLplusK(|
00003180  72 2c 20 73 2c 20 6c 2c  20 6b 29 20 42 45 0a 20  |r, s, l, k) BE. |
00003190  20 20 54 45 53 54 20 73  3d 72 2e 6c 20 54 48 45  |  TEST s=r.l THE|
000031a0  4e 20 24 28 0a 20 20 20  20 20 20 2f 2f 20 49 46  |N $(.      // IF|
000031b0  20 73 20 69 73 20 72 6c  2c 20 49 20 61 73 73 65  | s is rl, I asse|
000031c0  72 74 20 74 68 61 74 20  6c 20 77 69 6c 6c 20 61  |rt that l will a|
000031d0  6c 77 61 79 73 20 62 65  20 61 20 6c 61 62 65 6c  |lways be a label|
000031e0  0a 20 20 20 20 20 20 2f  2f 20 77 68 6f 73 65 20  |.      // whose |
000031f0  76 61 6c 75 65 20 28 72  65 6c 61 74 69 76 65 20  |value (relative |
00003200  74 6f 20 72 6c 29 20 69  73 20 6b 6e 6f 77 6e 2e  |to rl) is known.|
00003210  0a 20 20 20 20 20 20 4c  45 54 20 6e 20 3d 20 41  |.      LET n = A|
00003220  73 73 6f 63 28 6c 2c 20  31 2c 20 73 74 61 74 69  |ssoc(l, 1, stati|
00003230  63 4c 61 62 65 6c 73 29  3b 0a 20 20 20 20 20 20  |cLabels);.      |
00003240  54 45 53 54 20 6e 3d 4e  75 6c 6c 20 54 48 45 4e  |TEST n=Null THEN|
00003250  0a 09 20 43 47 45 72 72  6f 72 28 46 41 4c 53 45  |.. CGError(FALSE|
00003260  2c 20 22 53 65 74 52 74  6f 52 70 6c 75 73 4c 70  |, "SetRtoRplusLp|
00003270  6c 75 73 4b 3a 20 75 6e  73 65 74 20 6c 61 62 65  |lusK: unset labe|
00003280  6c 20 25 6e 2a 6e 22 2c  20 6c 29 0a 20 20 20 20  |l %n*n", l).    |
00003290  20 20 45 4c 53 45 0a 09  20 53 65 74 52 74 6f 52  |  ELSE.. SetRtoR|
000032a0  70 6c 75 73 4b 28 72 2c  20 73 2c 20 6b 2b 28 33  |plusK(r, s, k+(3|
000032b0  21 6e 29 29 20 24 29 0a  0a 20 20 20 45 4c 53 45  |!n)) $)..   ELSE|
000032c0  20 24 28 0a 20 20 20 20  20 20 49 46 20 70 65 6e  | $(.      IF pen|
000032d0  64 69 6e 67 4c 61 62 7e  3d 4e 75 6c 6c 20 54 48  |dingLab~=Null TH|
000032e0  45 4e 0a 09 20 54 45 53  54 20 70 65 6e 64 69 6e  |EN.. TEST pendin|
000032f0  67 43 6f 75 6e 74 3c 50  65 6e 64 69 6e 67 42 75  |gCount<PendingBu|
00003300  66 66 65 72 53 69 7a 65  20 54 48 45 4e 20 24 28  |fferSize THEN $(|
00003310  0a 09 20 20 20 20 41 64  64 50 65 6e 64 69 6e 67  |..    AddPending|
00003320  49 6e 73 74 28 70 69 2e  53 65 74 52 54 6f 52 70  |Inst(pi.SetRToRp|
00003330  6c 75 73 4c 70 6c 75 73  4b 2c 20 72 2c 20 73 2c  |lusLplusK, r, s,|
00003340  20 6c 2c 20 6b 29 3b 0a  09 20 20 20 20 52 45 54  | l, k);..    RET|
00003350  55 52 4e 20 24 29 0a 09  20 45 4c 53 45 0a 09 20  |URN $).. ELSE.. |
00003360  20 20 20 46 6c 75 73 68  50 65 6e 64 69 6e 67 49  |   FlushPendingI|
00003370  6e 73 74 73 28 4e 75 6c  6c 2c 20 46 41 4c 53 45  |nsts(Null, FALSE|
00003380  29 3b 0a 20 20 20 20 20  20 53 65 74 52 54 6f 52  |);.      SetRToR|
00003390  70 6c 75 73 4c 70 6c 75  73 4b 4d 28 72 2c 20 73  |plusLplusKM(r, s|
000033a0  2c 20 6c 2c 20 6b 2c 20  6d 2e 61 6c 77 61 79 73  |, l, k, m.always|
000033b0  29 20 24 29 0a 0a 41 4e  44 20 53 65 74 52 54 6f  |) $)..AND SetRTo|
000033c0  52 50 6c 75 73 4c 70 6c  75 73 4b 4d 28 72 2c 20  |RPlusLplusKM(r, |
000033d0  73 2c 20 6c 2c 20 6b 2c  20 6d 29 20 42 45 0a 24  |s, l, k, m) BE.$|
000033e0  28 20 41 64 64 52 65 66  28 6c 6f 63 43 74 72 2c  |( AddRef(locCtr,|
000033f0  20 31 2c 20 6c 29 3b 0a  20 20 20 53 65 74 52 54  | 1, l);.   SetRT|
00003400  6f 52 70 6c 75 73 4b 4d  28 72 2c 20 73 2c 20 6b  |oRplusKM(r, s, k|
00003410  2c 20 6d 29 0a 24 29 0a  0a 41 4e 44 20 53 65 74  |, m).$)..AND Set|
00003420  52 74 6f 52 70 6c 75 73  4b 4d 28 72 2c 20 73 2c  |RtoRplusKM(r, s,|
00003430  20 6b 2c 20 6d 29 20 42  45 0a 20 20 20 54 45 53  | k, m) BE.   TES|
00003440  54 20 45 69 67 68 74 42  69 74 73 4f 72 46 65 77  |T EightBitsOrFew|
00003450  65 72 28 6b 29 20 54 48  45 4e 0a 20 20 20 20 20  |er(k) THEN.     |
00003460  20 46 31 49 6e 73 74 28  66 2e 61 64 64 2c 20 72  | F1Inst(f.add, r|
00003470  2c 20 73 2c 20 4e 75 6c  6c 2c 20 6b 2c 20 4e 75  |, s, Null, k, Nu|
00003480  6c 6c 2c 20 30 2c 20 6d  29 0a 20 20 20 45 4c 53  |ll, 0, m).   ELS|
00003490  45 20 54 45 53 54 20 45  69 67 68 74 42 69 74 73  |E TEST EightBits|
000034a0  4f 72 46 65 77 65 72 28  2d 6b 29 20 54 48 45 4e  |OrFewer(-k) THEN|
000034b0  0a 20 20 20 20 20 20 46  31 49 6e 73 74 28 66 2e  |.      F1Inst(f.|
000034c0  73 75 62 2c 20 72 2c 20  73 2c 20 4e 75 6c 6c 2c  |sub, r, s, Null,|
000034d0  20 2d 6b 2c 20 4e 75 6c  6c 2c 20 30 2c 20 6d 29  | -k, Null, 0, m)|
000034e0  0a 20 20 20 45 4c 53 45  20 24 28 0a 20 20 20 20  |.   ELSE $(.    |
000034f0  20 20 42 61 63 6b 54 72  61 63 65 28 29 3b 0a 20  |  BackTrace();. |
00003500  20 20 20 20 20 43 47 45  72 72 6f 72 28 46 41 4c  |     CGError(FAL|
00003510  53 45 2c 20 22 53 65 74  52 74 6f 52 70 6c 75 73  |SE, "SetRtoRplus|
00003520  4b 4d 3a 20 6f 66 66 73  65 74 20 25 6e 20 6f 75  |KM: offset %n ou|
00003530  74 20 6f 66 20 72 61 6e  67 65 22 2c 20 6b 29 20  |t of range", k) |
00003540  24 29 0a 0a 41 4e 44 20  53 65 74 52 74 6f 52 70  |$)..AND SetRtoRp|
00003550  6c 75 73 4b 28 72 2c 20  73 2c 20 6b 29 20 42 45  |lusK(r, s, k) BE|
00003560  0a 24 28 20 4c 45 54 20  6d 2c 20 6d 6e 20 3d 20  |.$( LET m, mn = |
00003570  3f 2c 20 3f 3b 0a 20 20  20 65 69 67 68 74 42 69  |?, ?;.   eightBi|
00003580  74 4d 61 73 6b 20 3a 3d  20 32 35 35 3b 0a 20 20  |tMask := 255;.  |
00003590  20 49 46 20 45 69 67 68  74 42 69 74 73 4f 72 46  | IF EightBitsOrF|
000035a0  65 77 65 72 28 6b 29 20  54 48 45 4e 20 24 28 0a  |ewer(k) THEN $(.|
000035b0  20 20 20 20 20 20 47 65  6e 46 31 4b 28 66 2e 61  |      GenF1K(f.a|
000035c0  64 64 2c 20 72 2c 20 73  2c 20 6b 29 3b 20 52 45  |dd, r, s, k); RE|
000035d0  54 55 52 4e 20 24 29 3b  0a 20 20 20 6d 20 3a 3d  |TURN $);.   m :=|
000035e0  20 65 69 67 68 74 42 69  74 4d 61 73 6b 3b 0a 0a  | eightBitMask;..|
000035f0  20 20 20 49 46 20 45 69  67 68 74 42 69 74 73 4f  |   IF EightBitsO|
00003600  72 46 65 77 65 72 28 2d  6b 29 20 54 48 45 4e 20  |rFewer(-k) THEN |
00003610  24 28 0a 20 20 20 20 20  20 47 65 6e 46 31 4b 28  |$(.      GenF1K(|
00003620  66 2e 73 75 62 2c 20 72  2c 20 73 2c 20 2d 6b 29  |f.sub, r, s, -k)|
00003630  3b 20 52 45 54 55 52 4e  20 24 29 3b 0a 20 20 20  |; RETURN $);.   |
00003640  6d 6e 20 3a 3d 20 65 69  67 68 74 42 69 74 4d 61  |mn := eightBitMa|
00003650  73 6b 3b 0a 0a 20 20 20  54 45 53 54 20 45 69 67  |sk;..   TEST Eig|
00003660  68 74 42 69 74 73 4f 72  46 65 77 65 72 28 6b 26  |htBitsOrFewer(k&|
00003670  7e 6d 29 20 54 48 45 4e  0a 20 20 20 20 20 20 47  |~m) THEN.      G|
00003680  65 6e 46 31 4b 28 66 2e  61 64 64 2c 20 72 2c 20  |enF1K(f.add, r, |
00003690  73 2c 20 6b 29 0a 20 20  20 45 4c 53 45 20 54 45  |s, k).   ELSE TE|
000036a0  53 54 20 45 69 67 68 74  42 69 74 73 4f 72 46 65  |ST EightBitsOrFe|
000036b0  77 65 72 28 28 2d 6b 29  26 7e 6d 6e 29 20 54 48  |wer((-k)&~mn) TH|
000036c0  45 4e 0a 20 20 20 20 20  20 47 65 6e 46 31 4b 28  |EN.      GenF1K(|
000036d0  66 2e 73 75 62 2c 20 72  2c 20 73 2c 20 2d 6b 29  |f.sub, r, s, -k)|
000036e0  0a 20 20 20 45 4c 53 45  20 54 45 53 54 20 72 7e  |.   ELSE TEST r~|
000036f0  3d 73 20 54 48 45 4e 20  24 28 0a 20 20 20 20 20  |=s THEN $(.     |
00003700  20 53 65 74 52 74 6f 4b  28 72 2c 20 6b 29 3b 0a  | SetRtoK(r, k);.|
00003710  20 20 20 20 20 20 47 65  6e 52 52 28 66 2e 61 64  |      GenRR(f.ad|
00003720  64 2c 20 72 2c 20 72 2c  20 73 29 20 24 29 0a 20  |d, r, r, s) $). |
00003730  20 20 45 4c 53 45 20 24  28 0a 20 20 20 20 20 20  |  ELSE $(.      |
00003740  53 65 74 52 74 6f 4b 28  72 2e 30 2c 20 6b 29 3b  |SetRtoK(r.0, k);|
00003750  0a 20 20 20 20 20 20 72  30 4f 66 66 73 65 74 20  |.      r0Offset |
00003760  3a 3d 20 4e 75 6c 6c 3b  0a 20 20 20 20 20 20 47  |:= Null;.      G|
00003770  65 6e 52 52 28 66 2e 61  64 64 2c 20 72 2c 20 72  |enRR(f.add, r, r|
00003780  2c 20 72 2e 30 29 20 24  29 0a 24 29 0a 0a 41 4e  |, r.0) $).$)..AN|
00003790  44 20 53 65 74 52 74 6f  4b 28 72 2c 20 6b 29 20  |D SetRtoK(r, k) |
000037a0  42 45 0a 24 28 20 4c 45  54 20 6d 20 3d 20 3f 3b  |BE.$( LET m = ?;|
000037b0  0a 20 20 20 65 69 67 68  74 42 69 74 4d 61 73 6b  |.   eightBitMask|
000037c0  20 3a 3d 20 32 35 35 3b  0a 20 20 20 49 46 20 45  | := 255;.   IF E|
000037d0  69 67 68 74 42 69 74 73  4f 72 46 65 77 65 72 28  |ightBitsOrFewer(|
000037e0  6b 29 20 54 48 45 4e 20  24 28 0a 20 20 20 20 20  |k) THEN $(.     |
000037f0  20 47 65 6e 46 31 4b 28  66 2e 6d 6f 76 2c 20 72  | GenF1K(f.mov, r|
00003800  2c 20 30 2c 20 6b 29 3b  20 52 45 54 55 52 4e 20  |, 0, k); RETURN |
00003810  24 29 3b 0a 20 20 20 6d  20 3a 3d 20 65 69 67 68  |$);.   m := eigh|
00003820  74 42 69 74 4d 61 73 6b  3b 0a 0a 20 20 20 54 45  |tBitMask;..   TE|
00003830  53 54 20 45 69 67 68 74  42 69 74 73 4f 72 46 65  |ST EightBitsOrFe|
00003840  77 65 72 28 7e 6b 29 20  54 48 45 4e 0a 20 20 20  |wer(~k) THEN.   |
00003850  20 20 20 47 65 6e 46 31  4b 28 66 2e 6d 76 6e 2c  |   GenF1K(f.mvn,|
00003860  20 72 2c 20 30 2c 20 7e  6b 29 0a 20 20 20 45 4c  | r, 0, ~k).   EL|
00003870  53 45 20 54 45 53 54 20  45 69 67 68 74 42 69 74  |SE TEST EightBit|
00003880  73 4f 72 46 65 77 65 72  28 6b 26 7e 6d 29 20 54  |sOrFewer(k&~m) T|
00003890  48 45 4e 20 24 28 0a 20  20 20 20 20 20 47 65 6e  |HEN $(.      Gen|
000038a0  46 31 4b 28 66 2e 6d 6f  76 2c 20 72 2c 20 30 2c  |F1K(f.mov, r, 0,|
000038b0  20 6b 26 6d 29 0a 20 20  20 20 20 20 47 65 6e 46  | k&m).      GenF|
000038c0  31 4b 28 66 2e 61 64 64  2c 20 72 2c 20 72 2c 20  |1K(f.add, r, r, |
000038d0  6b 26 7e 6d 29 20 24 29  0a 20 20 20 45 4c 53 45  |k&~m) $).   ELSE|
000038e0  20 54 45 53 54 20 47 6c  6f 62 61 6c 43 6f 6e 73  | TEST GlobalCons|
000038f0  74 61 6e 74 28 6b 29 7e  3d 30 20 54 48 45 4e 0a  |tant(k)~=0 THEN.|
00003900  20 20 20 20 20 20 47 65  6e 46 32 28 66 2e 6c 64  |      GenF2(f.ld|
00003910  72 2c 20 72 2c 20 72 2e  67 2c 20 30 2c 20 47 6c  |r, r, r.g, 0, Gl|
00003920  6f 62 61 6c 43 6f 6e 73  74 61 6e 74 28 6b 29 29  |obalConstant(k))|
00003930  0a 20 20 20 45 4c 53 45  20 54 45 53 54 20 75 73  |.   ELSE TEST us|
00003940  65 73 52 4c 20 54 48 45  4e 20 24 28 0a 20 20 20  |esRL THEN $(.   |
00003950  20 20 20 43 68 65 63 6b  52 4c 4c 6f 61 64 65 64  |   CheckRLLoaded|
00003960  28 29 3b 0a 20 20 20 20  20 20 47 65 6e 46 32 28  |();.      GenF2(|
00003970  66 2e 6c 64 72 2c 20 72  2c 20 72 2e 6c 2c 20 30  |f.ldr, r, r.l, 0|
00003980  2c 20 73 74 61 74 69 63  44 61 74 61 53 69 7a 65  |, staticDataSize|
00003990  2b 46 64 61 74 61 28 6b  29 29 20 24 29 0a 20 20  |+Fdata(k)) $).  |
000039a0  20 45 4c 53 45 0a 20 20  20 20 20 20 47 65 6e 46  | ELSE.      GenF|
000039b0  32 28 66 2e 6c 64 72 2c  20 72 2c 20 72 2e 70 63  |2(f.ldr, r, r.pc|
000039c0  2c 20 4c 6f 63 61 6c 43  6f 6e 73 74 4c 61 62 2c  |, LocalConstLab,|
000039d0  20 46 64 61 74 61 28 6b  29 29 0a 24 29 0a 0a 41  | Fdata(k)).$)..A|
000039e0  4e 44 20 47 65 6e 46 28  66 2c 20 72 2c 20 78 29  |ND GenF(f, r, x)|
000039f0  20 42 45 0a 20 20 20 47  65 6e 46 44 53 28 66 2c  | BE.   GenFDS(f,|
00003a00  20 72 2c 20 72 2c 20 78  29 0a 0a 41 4e 44 20 47  | r, r, x)..AND G|
00003a10  65 6e 46 44 53 28 66 2c  20 72 2c 20 73 2c 20 78  |enFDS(f, r, s, x|
00003a20  29 20 42 45 0a 24 28 20  4c 45 54 20 6e 2c 20 6b  |) BE.$( LET n, k|
00003a30  20 3d 20 68 33 21 78 2c  20 68 34 21 78 3b 0a 20  | = h3!x, h4!x;. |
00003a40  20 20 49 46 20 66 7e 3d  66 2e 63 6d 70 73 20 26  |  IF f~=f.cmps &|
00003a50  20 66 7e 3d 66 2e 63 6d  6e 73 20 54 48 45 4e 0a  | f~=f.cmns THEN.|
00003a60  20 20 20 20 20 20 46 6c  75 73 68 50 65 6e 64 69  |      FlushPendi|
00003a70  6e 67 55 73 65 73 4f 66  52 65 67 28 72 29 3b 0a  |ngUsesOfReg(r);.|
00003a80  20 20 20 4c 6f 63 6b 28  72 2c 20 6b 2e 72 65 67  |   Lock(r, k.reg|
00003a90  29 3b 20 4c 6f 63 6b 28  73 2c 20 6b 2e 72 65 67  |); Lock(s, k.reg|
00003aa0  29 3b 0a 20 20 20 53 57  49 54 43 48 4f 4e 20 43  |);.   SWITCHON C|
00003ab0  6c 61 73 73 28 78 2c 20  54 52 55 45 29 20 49 4e  |lass(x, TRUE) IN|
00003ac0  54 4f 0a 20 20 20 24 28  20 43 41 53 45 20 73 68  |TO.   $( CASE sh|
00003ad0  69 66 74 65 64 72 74 79  70 65 3a 0a 09 20 46 31  |iftedrtype:.. F1|
00003ae0  49 6e 73 74 28 66 2c 20  72 2c 20 73 2c 20 6e 2c  |Inst(f, r, s, n,|
00003af0  20 4e 75 6c 6c 2c 20 6b  2f 33 32 2c 20 6b 20 52  | Null, k/32, k R|
00003b00  45 4d 20 33 32 2c 20 6d  2e 61 6c 77 61 79 73 29  |EM 32, m.always)|
00003b10  3b 0a 09 20 45 4e 44 43  41 53 45 0a 0a 20 20 20  |;.. ENDCASE..   |
00003b20  20 20 20 43 41 53 45 20  6c 6f 63 6b 65 64 72 74  |   CASE lockedrt|
00003b30  79 70 65 3a 0a 09 20 49  46 20 6b 3d 30 20 26 20  |ype:.. IF k=0 & |
00003b40  68 32 21 78 3c 30 20 54  48 45 4e 20 24 28 0a 09  |h2!x<0 THEN $(..|
00003b50  20 20 20 20 47 65 6e 52  52 28 66 2c 20 72 2c 20  |    GenRR(f, r, |
00003b60  73 2c 20 6e 29 3b 0a 09  20 20 20 20 45 4e 44 43  |s, n);..    ENDC|
00003b70  41 53 45 20 24 29 0a 0a  20 20 20 20 20 20 43 41  |ASE $)..      CA|
00003b80  53 45 20 72 74 79 70 65  3a 0a 09 20 24 28 20 4c  |SE rtype:.. $( L|
00003b90  45 54 20 72 32 20 3d 20  6b 3d 30 20 2d 3e 20 4d  |ET r2 = k=0 -> M|
00003ba0  6f 76 65 54 6f 41 6e 79  43 52 28 78 29 2c 0a 09  |oveToAnyCR(x),..|
00003bb0  09 09 20 20 20 20 4d 6f  76 65 54 6f 41 6e 79 52  |..    MoveToAnyR|
00003bc0  28 78 29 3b 0a 09 20 20  20 20 47 65 6e 52 52 28  |(x);..    GenRR(|
00003bd0  66 2c 20 72 2c 20 73 2c  20 72 32 29 20 24 29 3b  |f, r, s, r2) $);|
00003be0  0a 09 20 45 4e 44 43 41  53 45 0a 0a 20 20 20 20  |.. ENDCASE..    |
00003bf0  20 20 43 41 53 45 20 6b  74 79 70 65 3a 0a 09 20  |  CASE ktype:.. |
00003c00  47 65 6e 46 31 4b 28 66  2c 20 72 2c 20 73 2c 20  |GenF1K(f, r, s, |
00003c10  6e 2b 6b 29 3b 0a 09 20  45 4e 44 43 41 53 45 0a  |n+k);.. ENDCASE.|
00003c20  0a 20 20 20 20 20 20 44  45 46 41 55 4c 54 3a 0a  |.      DEFAULT:.|
00003c30  09 20 43 6f 6d 70 69 6c  65 44 53 28 66 2c 20 72  |. CompileDS(f, r|
00003c40  2c 20 73 2c 20 78 29 20  24 29 3b 0a 0a 20 20 20  |, s, x) $);..   |
00003c50  55 6e 4c 6f 63 6b 28 72  2c 20 6b 2e 72 65 67 29  |UnLock(r, k.reg)|
00003c60  3b 20 55 6e 4c 6f 63 6b  28 73 2c 20 6b 2e 72 65  |; UnLock(s, k.re|
00003c70  67 29 0a 24 29 0a 0a 41  4e 44 20 49 6e 73 65 72  |g).$)..AND Inser|
00003c80  74 43 6f 75 6e 74 28 73  72 29 20 42 45 0a 24 28  |tCount(sr) BE.$(|
00003c90  20 63 6f 75 6e 74 46 6c  61 67 20 3a 3d 20 46 41  | countFlag := FA|
00003ca0  4c 53 45 3b 0a 20 20 20  54 45 53 54 20 73 72 3d  |LSE;.   TEST sr=|
00003cb0  73 72 2e 65 6e 74 72 79  63 6f 75 6e 74 0a 20 20  |sr.entrycount.  |
00003cc0  20 20 20 20 54 48 45 4e  20 53 65 74 52 74 6f 52  |    THEN SetRtoR|
00003cd0  70 6c 75 73 4b 28 72 2e  70 63 2c 20 72 2e 67 62  |plusK(r.pc, r.gb|
00003ce0  2c 20 73 72 29 0a 20 20  20 20 20 20 45 4c 53 45  |, sr).      ELSE|
00003cf0  20 46 35 49 6e 73 74 4c  28 6d 2e 61 6c 77 61 79  | F5InstL(m.alway|
00003d00  73 2c 20 63 6f 75 6e 74  4c 61 62 65 6c 2c 20 66  |s, countLabel, f|
00003d10  2e 62 6c 29 3b 0a 0a 20  20 20 50 75 74 57 6f 72  |.bl);..   PutWor|
00003d20  64 28 30 29 0a 24 29 0a  0a 41 4e 44 20 45 69 67  |d(0).$)..AND Eig|
00003d30  68 74 42 69 74 73 4f 72  46 65 77 65 72 28 6e 29  |htBitsOrFewer(n)|
00003d40  20 3d 20 56 41 4c 4f 46  0a 24 28 20 4c 45 54 20  | = VALOF.$( LET |
00003d50  62 69 74 73 20 3d 20 30  3b 0a 20 20 20 65 69 67  |bits = 0;.   eig|
00003d60  68 74 42 69 74 4d 61 73  6b 20 3a 3d 20 32 35 35  |htBitMask := 255|
00003d70  3b 0a 20 20 20 54 45 53  54 20 6e 3d 30 0a 20 20  |;.   TEST n=0.  |
00003d80  20 20 20 20 54 48 45 4e  20 52 45 53 55 4c 54 49  |    THEN RESULTI|
00003d90  53 20 54 52 55 45 0a 20  20 20 45 4c 53 45 20 54  |S TRUE.   ELSE T|
00003da0  45 53 54 20 28 6e 26 33  29 3d 30 20 54 48 45 4e  |EST (n&3)=0 THEN|
00003db0  20 24 28 0a 20 20 20 20  20 20 57 48 49 4c 45 20  | $(.      WHILE |
00003dc0  28 6e 26 33 29 3d 30 20  44 4f 20 24 28 0a 09 20  |(n&3)=0 DO $(.. |
00003dd0  6e 20 3a 3d 20 6e 3e 3e  32 3b 0a 09 20 65 69 67  |n := n>>2;.. eig|
00003de0  68 74 42 69 74 4d 61 73  6b 20 3a 3d 20 65 69 67  |htBitMask := eig|
00003df0  68 74 42 69 74 4d 61 73  6b 3c 3c 32 20 24 29 3b  |htBitMask<<2 $);|
00003e00  0a 20 20 20 20 20 20 52  45 53 55 4c 54 49 53 20  |.      RESULTIS |
00003e10  30 3c 6e 3c 32 35 36 20  24 29 0a 20 20 20 45 4c  |0<n<256 $).   EL|
00003e20  53 45 20 24 28 0a 20 20  20 20 20 20 57 48 49 4c  |SE $(.      WHIL|
00003e30  45 20 28 6e 26 23 78 63  30 30 30 30 30 30 30 29  |E (n&#xc0000000)|
00003e40  7e 3d 30 20 44 4f 20 24  28 0a 09 20 49 46 20 62  |~=0 DO $(.. IF b|
00003e50  69 74 73 3d 38 20 54 48  45 4e 20 52 45 53 55 4c  |its=8 THEN RESUL|
00003e60  54 49 53 20 46 41 4c 53  45 3b 0a 09 20 6e 20 3a  |TIS FALSE;.. n :|
00003e70  3d 20 6e 3c 3c 32 3b 0a  09 20 65 69 67 68 74 42  |= n<<2;.. eightB|
00003e80  69 74 4d 61 73 6b 20 3a  3d 20 28 65 69 67 68 74  |itMask := (eight|
00003e90  42 69 74 4d 61 73 6b 3e  3e 32 29 7c 23 78 63 30  |BitMask>>2)|#xc0|
00003ea0  30 30 30 30 30 30 3b 0a  09 20 62 69 74 73 20 3a  |000000;.. bits :|
00003eb0  3d 20 62 69 74 73 2b 32  20 24 29 3b 0a 20 20 20  |= bits+2 $);.   |
00003ec0  20 20 20 52 45 53 55 4c  54 49 53 20 30 3c 6e 3c  |   RESULTIS 0<n<|
00003ed0  32 35 36 20 24 29 0a 24  29 0a 0a 41 4e 44 20 53  |256 $).$)..AND S|
00003ee0  68 69 66 74 52 65 67 69  73 74 65 72 44 53 28 72  |hiftRegisterDS(r|
00003ef0  2c 20 73 2c 20 73 68 2c  20 6e 29 20 42 45 0a 20  |, s, sh, n) BE. |
00003f00  20 20 46 31 49 6e 73 74  28 66 2e 6d 6f 76 2c 20  |  F1Inst(f.mov, |
00003f10  72 2c 20 30 2c 20 73 2c  20 30 2c 20 73 68 2c 20  |r, 0, s, 0, sh, |
00003f20  6e 2c 20 6d 2e 61 6c 77  61 79 73 29 0a 0a 41 4e  |n, m.always)..AN|
00003f30  44 20 53 68 69 66 74 52  65 67 69 73 74 65 72 28  |D ShiftRegister(|
00003f40  72 2c 20 73 68 2c 20 6e  29 20 42 45 0a 20 20 20  |r, sh, n) BE.   |
00003f50  46 31 49 6e 73 74 28 66  2e 6d 6f 76 2c 20 72 2c  |F1Inst(f.mov, r,|
00003f60  20 30 2c 20 72 2c 20 30  2c 20 73 68 2c 20 6e 2c  | 0, r, 0, sh, n,|
00003f70  20 6d 2e 61 6c 77 61 79  73 29 0a 0a 41 4e 44 20  | m.always)..AND |
00003f80  4d 61 73 6b 4f 75 74 54  61 67 42 69 74 73 28 72  |MaskOutTagBits(r|
00003f90  29 20 42 45 0a 20 20 20  46 31 49 6e 73 74 28 66  |) BE.   F1Inst(f|
00003fa0  2e 62 69 63 2c 20 72 2c  20 72 2c 20 4e 75 6c 6c  |.bic, r, r, Null|
00003fb0  2c 20 23 78 66 66 30 30  30 30 30 30 2c 20 73 68  |, #xff000000, sh|
00003fc0  2e 61 73 6c 2c 20 30 2c  20 6d 2e 61 6c 77 61 79  |.asl, 0, m.alway|
00003fd0  73 29 0a 0a 41 4e 44 20  54 72 61 6e 73 66 65 72  |s)..AND Transfer|
00003fe0  72 65 64 4c 61 62 65 6c  28 6c 29 20 3d 20 6c 3d  |redLabel(l) = l=|
00003ff0  30 20 2d 3e 20 30 2c 20  56 41 4c 4f 46 0a 24 28  |0 -> 0, VALOF.$(|
00004000  20 4c 45 54 20 70 20 3d  20 41 73 73 6f 63 28 6c  | LET p = Assoc(l|
00004010  2c 20 31 2c 20 74 72 61  6e 73 66 65 72 4c 61 62  |, 1, transferLab|
00004020  73 29 3b 0a 20 20 20 49  46 20 70 3d 4e 75 6c 6c  |s);.   IF p=Null|
00004030  20 54 48 45 4e 20 52 45  53 55 4c 54 49 53 20 6c  | THEN RESULTIS l|
00004040  3b 0a 20 20 20 6c 20 3a  3d 20 32 21 70 0a 24 29  |;.   l := 2!p.$)|
00004050  20 52 45 50 45 41 54 0a  0a 41 4e 44 20 4a 75 6d  | REPEAT..AND Jum|
00004060  70 28 6c 29 20 42 45 0a  20 20 20 49 46 20 64 65  |p(l) BE.   IF de|
00004070  61 64 43 6f 64 65 7e 3d  44 65 61 64 20 54 48 45  |adCode~=Dead THE|
00004080  4e 20 24 28 0a 20 20 20  20 20 20 49 46 20 6c 7e  |N $(.      IF l~|
00004090  3d 30 20 54 48 45 4e 20  6c 20 3a 3d 20 54 72 61  |=0 THEN l := Tra|
000040a0  6e 73 66 65 72 72 65 64  4c 61 62 65 6c 28 6c 29  |nsferredLabel(l)|
000040b0  3b 0a 20 20 20 20 20 20  54 45 53 54 20 6c 3d 30  |;.      TEST l=0|
000040c0  20 54 48 45 4e 0a 09 20  54 45 53 54 20 75 73 65  | THEN.. TEST use|
000040d0  73 46 72 61 6d 65 20 26  20 7e 6c 69 6e 6b 61 67  |sFrame & ~linkag|
000040e0  65 4e 6f 74 53 74 6f 72  65 64 20 54 48 45 4e 0a  |eNotStored THEN.|
000040f0  09 20 20 20 20 54 45 53  54 20 63 6f 6d 70 61 63  |.    TEST compac|
00004100  74 43 6f 64 65 20 54 48  45 4e 0a 09 20 20 20 20  |tCode THEN..    |
00004110  20 20 20 43 6f 6e 64 4a  75 6d 70 28 6d 2e 61 6c  |   CondJump(m.al|
00004120  77 61 79 73 2c 20 65 78  69 74 4c 61 62 29 0a 09  |ways, exitLab)..|
00004130  20 20 20 20 45 4c 53 45  20 24 28 0a 09 20 20 20  |    ELSE $(..   |
00004140  20 20 20 20 47 65 6e 52  52 28 66 2e 6d 6f 76 2c  |    GenRR(f.mov,|
00004150  20 72 2e 74 73 2c 20 30  2c 20 72 2e 70 29 3b 0a  | r.ts, 0, r.p);.|
00004160  09 20 20 20 20 20 20 20  46 34 49 6e 73 74 28 66  |.       F4Inst(f|
00004170  2e 6c 64 6d 2c 20 72 2e  70 2c 20 66 34 2e 70 62  |.ldm, r.p, f4.pb|
00004180  6c 70 63 2c 20 66 2e 70  6f 73 74 75 70 2b 66 2e  |lpc, f.postup+f.|
00004190  70 63 29 20 24 29 0a 09  20 45 4c 53 45 20 47 65  |pc) $).. ELSE Ge|
000041a0  6e 52 52 28 66 2e 6d 6f  76 73 2c 20 72 2e 70 63  |nRR(f.movs, r.pc|
000041b0  2c 20 30 2c 20 72 2e 31  34 29 0a 0a 20 20 20 20  |, 0, r.14)..    |
000041c0  20 20 45 4c 53 45 20 24  28 0a 09 20 53 61 76 65  |  ELSE $(.. Save|
000041d0  53 74 61 74 65 46 6f 72  4c 61 62 28 6c 29 3b 0a  |StateForLab(l);.|
000041e0  09 20 70 65 6e 64 69 6e  67 4a 75 6d 70 20 3a 3d  |. pendingJump :=|
000041f0  20 6c 20 24 29 20 24 29  0a 0a 41 4e 44 20 43 6f  | l $) $)..AND Co|
00004200  6e 64 4a 75 6d 70 28 6d  2c 20 6c 29 20 42 45 20  |ndJump(m, l) BE |
00004210  43 6f 6e 64 4a 75 6d 70  32 28 6d 2c 20 6c 2c 20  |CondJump2(m, l, |
00004220  54 52 55 45 29 0a 0a 41  4e 44 20 43 6f 6e 64 4a  |TRUE)..AND CondJ|
00004230  75 6d 70 32 28 6d 2c 20  6c 2c 20 75 70 64 61 74  |ump2(m, l, updat|
00004240  65 53 61 76 65 64 53 74  61 74 65 29 20 42 45 0a  |eSavedState) BE.|
00004250  24 28 20 49 46 20 6c 7e  3d 30 20 54 48 45 4e 20  |$( IF l~=0 THEN |
00004260  6c 20 3a 3d 20 54 72 61  6e 73 66 65 72 72 65 64  |l := Transferred|
00004270  4c 61 62 65 6c 28 6c 29  3b 0a 20 20 20 54 45 53  |Label(l);.   TES|
00004280  54 20 6c 3d 30 20 54 48  45 4e 0a 20 20 20 20 20  |T l=0 THEN.     |
00004290  20 54 45 53 54 20 75 73  65 73 46 72 61 6d 65 20  | TEST usesFrame |
000042a0  26 20 7e 6c 69 6e 6b 61  67 65 4e 6f 74 53 74 6f  |& ~linkageNotSto|
000042b0  72 65 64 20 54 48 45 4e  0a 09 20 46 35 49 6e 73  |red THEN.. F5Ins|
000042c0  74 4c 28 6d 2c 20 65 78  69 74 4c 61 62 2c 20 66  |tL(m, exitLab, f|
000042d0  2e 62 29 0a 20 20 20 20  20 20 45 4c 53 45 20 54  |.b).      ELSE T|
000042e0  45 53 54 20 70 65 6e 64  69 6e 67 4c 61 62 7e 3d  |EST pendingLab~=|
000042f0  4e 75 6c 6c 20 26 0a 09  09 6d 3d 43 6f 6d 70 6c  |Null &...m=Compl|
00004300  65 6d 65 6e 74 43 6f 6e  64 69 74 69 6f 6e 28 70  |ementCondition(p|
00004310  65 6e 64 69 6e 67 4d 61  73 6b 29 20 26 0a 09 09  |endingMask) &...|
00004320  70 65 6e 64 69 6e 67 43  6f 75 6e 74 3c 50 65 6e  |pendingCount<Pen|
00004330  64 69 6e 67 42 75 66 66  65 72 53 69 7a 65 20 54  |dingBufferSize T|
00004340  48 45 4e 0a 09 20 46 31  49 6e 73 74 28 66 2e 6d  |HEN.. F1Inst(f.m|
00004350  6f 76 73 2c 20 72 2e 70  63 2c 20 30 2c 20 72 2e  |ovs, r.pc, 0, r.|
00004360  31 34 2c 20 30 2c 20 4e  75 6c 6c 2c 20 30 2c 20  |14, 0, Null, 0, |
00004370  6d 2e 61 6c 77 61 79 73  29 0a 20 20 20 20 20 20  |m.always).      |
00004380  45 4c 53 45 0a 09 20 46  31 49 6e 73 74 28 66 2e  |ELSE.. F1Inst(f.|
00004390  6d 6f 76 73 2c 20 72 2e  70 63 2c 20 30 2c 20 72  |movs, r.pc, 0, r|
000043a0  2e 31 34 2c 20 30 2c 20  4e 75 6c 6c 2c 20 30 2c  |.14, 0, Null, 0,|
000043b0  20 6d 29 0a 20 20 20 45  4c 53 45 20 24 28 0a 20  | m).   ELSE $(. |
000043c0  20 20 20 20 20 49 46 20  75 70 64 61 74 65 53 61  |     IF updateSa|
000043d0  76 65 64 53 74 61 74 65  20 54 48 45 4e 20 53 61  |vedState THEN Sa|
000043e0  76 65 53 74 61 74 65 46  6f 72 4c 61 62 28 6c 29  |veStateForLab(l)|
000043f0  3b 0a 20 20 20 20 20 20  46 35 49 6e 73 74 4c 28  |;.      F5InstL(|
00004400  6d 2c 20 6c 2c 20 66 2e  62 29 20 24 29 0a 24 29  |m, l, f.b) $).$)|
00004410  0a 0a 41 4e 44 20 46 35  49 6e 73 74 4c 28 6d 2c  |..AND F5InstL(m,|
00004420  20 6c 2c 20 66 29 20 42  45 0a 24 28 20 4c 45 54  | l, f) BE.$( LET|
00004430  20 6e 20 3d 20 56 61 6c  75 65 4f 66 4c 61 62 65  | n = ValueOfLabe|
00004440  6c 28 6c 29 3b 0a 20 20  20 54 45 53 54 20 6d 7e  |l(l);.   TEST m~|
00004450  3d 6d 2e 61 6c 77 61 79  73 20 54 48 45 4e 20 24  |=m.always THEN $|
00004460  28 0a 20 20 20 20 20 20  54 45 53 54 20 70 65 6e  |(.      TEST pen|
00004470  64 69 6e 67 4d 61 73 6b  3d 6d 20 26 20 6c 3d 70  |dingMask=m & l=p|
00004480  65 6e 64 69 6e 67 4c 61  62 20 54 48 45 4e 0a 09  |endingLab THEN..|
00004490  20 46 6c 75 73 68 50 65  6e 64 69 6e 67 49 6e 73  | FlushPendingIns|
000044a0  74 73 28 6d 2c 20 46 41  4c 53 45 29 0a 20 20 20  |ts(m, FALSE).   |
000044b0  20 20 20 45 4c 53 45 20  54 45 53 54 20 70 65 6e  |   ELSE TEST pen|
000044c0  64 69 6e 67 4c 61 62 7e  3d 4e 75 6c 6c 20 26 0a  |dingLab~=Null &.|
000044d0  09 09 6d 3d 43 6f 6d 70  6c 65 6d 65 6e 74 43 6f  |..m=ComplementCo|
000044e0  6e 64 69 74 69 6f 6e 28  70 65 6e 64 69 6e 67 4d  |ndition(pendingM|
000044f0  61 73 6b 29 20 26 0a 09  09 70 65 6e 64 69 6e 67  |ask) &...pending|
00004500  43 6f 75 6e 74 3c 50 65  6e 64 69 6e 67 42 75 66  |Count<PendingBuf|
00004510  66 65 72 53 69 7a 65 20  26 0a 09 09 50 65 65 6b  |ferSize &...Peek|
00004520  4e 28 29 20 3d 20 73 2e  6c 61 62 20 54 48 45 4e  |N() = s.lab THEN|
00004530  20 24 28 0a 09 20 41 64  64 50 65 6e 64 69 6e 67  | $(.. AddPending|
00004540  49 6e 73 74 28 70 69 2e  46 35 49 6e 73 74 4c 4d  |Inst(pi.F5InstLM|
00004550  2c 20 6c 2c 20 66 2c 20  6d 29 3b 0a 09 20 52 45  |, l, f, m);.. RE|
00004560  54 55 52 4e 20 24 29 0a  20 20 20 20 20 20 45 4c  |TURN $).      EL|
00004570  53 45 0a 09 20 46 6c 75  73 68 50 65 6e 64 69 6e  |SE.. FlushPendin|
00004580  67 49 6e 73 74 73 28 4e  75 6c 6c 2c 20 46 41 4c  |gInsts(Null, FAL|
00004590  53 45 29 3b 0a 0a 20 20  20 20 20 20 49 46 20 6e  |SE);..      IF n|
000045a0  3c 30 20 54 48 45 4e 20  24 28 0a 09 20 70 65 6e  |<0 THEN $(.. pen|
000045b0  64 69 6e 67 4c 61 62 2c  20 70 65 6e 64 69 6e 67  |dingLab, pending|
000045c0  4d 61 73 6b 20 3a 3d 20  6c 2c 20 6d 3b 0a 09 20  |Mask := l, m;.. |
000045d0  70 65 6e 64 69 6e 67 43  6f 75 6e 74 20 3a 3d 20  |pendingCount := |
000045e0  30 3b 0a 09 20 52 45 54  55 52 4e 20 24 29 20 24  |0;.. RETURN $) $|
000045f0  29 0a 0a 20 20 20 45 4c  53 45 20 49 46 20 70 65  |)..   ELSE IF pe|
00004600  6e 64 69 6e 67 4c 61 62  7e 3d 4e 75 6c 6c 20 54  |ndingLab~=Null T|
00004610  48 45 4e 0a 20 20 20 20  20 20 54 45 53 54 20 70  |HEN.      TEST p|
00004620  65 6e 64 69 6e 67 43 6f  75 6e 74 3c 50 65 6e 64  |endingCount<Pend|
00004630  69 6e 67 42 75 66 66 65  72 53 69 7a 65 20 54 48  |ingBufferSize TH|
00004640  45 4e 20 24 28 0a 09 20  41 64 64 50 65 6e 64 69  |EN $(.. AddPendi|
00004650  6e 67 49 6e 73 74 28 70  69 2e 46 35 49 6e 73 74  |ngInst(pi.F5Inst|
00004660  4c 2c 20 6c 2c 20 66 29  3b 0a 09 20 52 45 54 55  |L, l, f);.. RETU|
00004670  52 4e 20 24 29 0a 20 20  20 20 20 20 45 4c 53 45  |RN $).      ELSE|
00004680  0a 09 20 46 6c 75 73 68  50 65 6e 64 69 6e 67 49  |.. FlushPendingI|
00004690  6e 73 74 73 28 4e 75 6c  6c 2c 20 46 41 4c 53 45  |nsts(Null, FALSE|
000046a0  29 3b 0a 0a 20 20 20 46  35 49 6e 73 74 4c 32 28  |);..   F5InstL2(|
000046b0  6c 2c 20 66 2c 20 6d 29  0a 24 29 0a 0a 41 4e 44  |l, f, m).$)..AND|
000046c0  20 46 35 49 6e 73 74 4c  32 28 6c 2c 20 66 2c 20  | F5InstL2(l, f, |
000046d0  6d 29 20 42 45 0a 24 28  20 4c 45 54 20 6e 20 3d  |m) BE.$( LET n =|
000046e0  20 56 61 6c 75 65 4f 66  4c 61 62 65 6c 28 6c 29  | ValueOfLabel(l)|
000046f0  3b 0a 20 20 20 46 6c 61  67 4c 61 62 65 6c 28 6c  |;.   FlagLabel(l|
00004700  2c 20 6c 61 62 2e 6a 75  6d 70 65 64 74 6f 29 3b  |, lab.jumpedto);|
00004710  0a 20 20 20 54 45 53 54  20 6e 3c 30 20 54 48 45  |.   TEST n<0 THE|
00004720  4e 20 24 28 0a 20 20 20  20 20 20 41 64 64 52 65  |N $(.      AddRe|
00004730  66 28 6c 6f 63 43 74 72  2c 20 35 2c 20 6c 29 3b  |f(locCtr, 5, l);|
00004740  0a 20 20 20 20 20 20 46  35 49 6e 73 74 28 66 2c  |.      F5Inst(f,|
00004750  20 30 2c 20 6d 29 20 24  29 0a 20 20 20 45 4c 53  | 0, m) $).   ELS|
00004760  45 0a 20 20 20 20 20 20  46 35 49 6e 73 74 28 66  |E.      F5Inst(f|
00004770  2c 20 6e 2c 20 6d 29 0a  24 29 0a 0a 41 4e 44 20  |, n, m).$)..AND |
00004780  4d 75 6c 74 69 70 6c 79  49 6e 73 74 28 66 6e 2c  |MultiplyInst(fn,|
00004790  20 72 64 2c 20 72 6d 2c  20 72 73 2c 20 72 6e 29  | rd, rm, rs, rn)|
000047a0  20 42 45 0a 20 20 20 46  34 49 6e 73 74 28 66 6e  | BE.   F4Inst(fn|
000047b0  2c 20 72 64 2c 20 72 6d  2b 23 78 39 30 2b 28 72  |, rd, rm+#x90+(r|
000047c0  73 3c 3c 38 29 2b 28 66  6e 3d 66 2e 6d 6c 61 2d  |s<<8)+(fn=f.mla-|
000047d0  3e 72 6e 2c 20 30 29 2c  20 30 29 0a 0a 41 4e 44  |>rn, 0), 0)..AND|
000047e0  20 43 68 65 63 6b 44 65  6c 61 79 65 64 4a 75 6d  | CheckDelayedJum|
000047f0  70 28 29 20 42 45 0a 20  20 20 49 46 20 70 65 6e  |p() BE.   IF pen|
00004800  64 69 6e 67 4a 75 6d 70  7e 3d 30 20 54 48 45 4e  |dingJump~=0 THEN|
00004810  20 24 28 0a 20 20 20 20  20 20 4c 45 54 20 64 20  | $(.      LET d |
00004820  3d 20 64 65 61 64 43 6f  64 65 3b 0a 20 20 20 20  |= deadCode;.    |
00004830  20 20 64 65 61 64 43 6f  64 65 20 3a 3d 20 41 6c  |  deadCode := Al|
00004840  69 76 65 3b 0a 20 20 20  20 20 20 43 6f 6e 64 4a  |ive;.      CondJ|
00004850  75 6d 70 32 28 6d 2e 61  6c 77 61 79 73 2c 20 70  |ump2(m.always, p|
00004860  65 6e 64 69 6e 67 4a 75  6d 70 2c 20 46 41 4c 53  |endingJump, FALS|
00004870  45 29 3b 0a 20 20 20 20  20 20 70 65 6e 64 69 6e  |E);.      pendin|
00004880  67 4a 75 6d 70 20 3a 3d  20 30 3b 0a 20 20 20 20  |gJump := 0;.    |
00004890  20 20 64 65 61 64 43 6f  64 65 20 3a 3d 20 64 20  |  deadCode := d |
000048a0  24 29 0a 0a 41 4e 44 20  47 6c 6f 62 61 6c 43 6f  |$)..AND GlobalCo|
000048b0  6e 73 74 61 6e 74 28 6e  29 20 3d 20 56 41 4c 4f  |nstant(n) = VALO|
000048c0  46 0a 24 28 20 2f 2f 20  53 65 65 20 77 68 65 74  |F.$( // See whet|
000048d0  68 65 72 20 6e 20 69 73  20 61 20 63 6f 6e 73 74  |her n is a const|
000048e0  61 6e 74 20 61 64 64 72  65 73 73 69 62 6c 65 20  |ant addressible |
000048f0  74 68 72 6f 75 67 68 0a  20 20 20 2f 2f 20 28 6e  |through.   // (n|
00004900  65 67 61 74 69 76 65 20  6f 66 66 73 65 74 73 20  |egative offsets |
00004910  66 72 6f 6d 29 20 72 67  2c 20 72 65 74 75 72 6e  |from) rg, return|
00004920  69 6e 67 20 74 68 65 20  6f 66 66 73 65 74 0a 20  |ing the offset. |
00004930  20 20 2f 2f 20 69 66 20  73 6f 2e 20 20 43 75 72  |  // if so.  Cur|
00004940  72 65 6e 74 6c 79 2c 20  74 68 65 72 65 20 61 72  |rently, there ar|
00004950  65 20 6e 6f 6e 65 20 73  75 63 68 0a 20 20 20 52  |e none such.   R|
00004960  45 53 55 4c 54 49 53 20  30 0a 24 29 0a           |ESULTIS 0.$).|
0000496d