Changeset 64 for trunk/Target/UTargetFPC.pas
- Timestamp:
- Dec 4, 2014, 2:59:28 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Target/UTargetFPC.pas
r60 r64 44 44 45 45 procedure TTargetFPC.Compile; 46 var47 Sum: Integer;48 46 begin 49 47 inherited; … … 62 60 FProgramIndex := 0; 63 61 while (FProgramIndex < Length(FProgram)) do begin 64 case FProgram[FProgramIndex] of 65 cmPointerInc: begin 66 Sum := CheckOccurence(cmPointerInc); 67 AddLine('Inc(Pos, ' + IntToStr(Sum) + ');'); 68 end; 69 cmPointerDec: begin 70 Sum := CheckOccurence(cmPointerDec); 71 AddLine('Dec(Pos, ' + IntToStr(Sum) + ');'); 72 end; 73 cmInc: begin 74 Sum := CheckOccurence(cmInc); 75 AddLine('Memory[Pos] := Memory[Pos] + ' + IntToStr(Sum) + ';'); 76 end; 77 cmDec: begin 78 Sum := CheckOccurence(cmDec); 79 AddLine('Memory[Pos] := Memory[Pos] - ' + IntToStr(Sum) + ';'); 80 end; 62 case FProgram[FProgramIndex].Command of 63 cmPointerInc: AddLine('Inc(Pos, ' + IntToStr(FProgram[FProgramIndex].Parameter) + ');'); 64 cmPointerDec: AddLine('Dec(Pos, ' + IntToStr(FProgram[FProgramIndex].Parameter) + ');'); 65 cmInc: AddLine('Memory[Pos] := Memory[Pos] + ' + IntToStr(FProgram[FProgramIndex].Parameter) + ';'); 66 cmDec: AddLine('Memory[Pos] := Memory[Pos] - ' + IntToStr(FProgram[FProgramIndex].Parameter) + ';'); 67 cmSet: AddLine('Memory[Pos] := ' + IntToStr(FProgram[FProgramIndex].Parameter) + ';'); 81 68 cmOutput: AddLine('Write(Chr(Memory[Pos]));'); 82 69 cmInput: AddLine('Read(ReadChar); Memory[Pos] := Ord(ReadChar);'); 83 70 cmLoopStart: begin 84 if CheckClear then begin 85 AddLine('Memory[Pos] := 0;'); 86 Inc(FProgramIndex, 2); 87 end else begin 88 AddLine('while Memory[Pos] <> 0 do begin'); 89 Inc(Indent); 90 end; 71 AddLine('while Memory[Pos] <> 0 do begin'); 72 Inc(Indent); 91 73 end; 92 74 cmLoopEnd: begin
Note:
See TracChangeset
for help on using the changeset viewer.