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