|
@@ -287,7 +287,7 @@ begin
|
|
if RPNTop < RPNMax then
|
|
if RPNTop < RPNMax then
|
|
begin
|
|
begin
|
|
Inc(RPNTop);
|
|
Inc(RPNTop);
|
|
- RPNStack[RPNTop] := Num;
|
|
|
|
|
|
+ RPNStack[RPNTop]:=Num;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Error(stack_overflow); { Put some error handler here }
|
|
Error(stack_overflow); { Put some error handler here }
|
|
@@ -300,7 +300,7 @@ Function TExprParse.RPNPop : longint; { Get the operand at the top of the
|
|
begin
|
|
begin
|
|
if RPNTop > 0 then
|
|
if RPNTop > 0 then
|
|
begin
|
|
begin
|
|
- RPNPop := RPNStack[RPNTop];
|
|
|
|
|
|
+ RPNPop:=RPNStack[RPNTop];
|
|
Dec(RPNTop);
|
|
Dec(RPNTop);
|
|
end
|
|
end
|
|
else { Put some error handler here }
|
|
else { Put some error handler here }
|
|
@@ -334,7 +334,7 @@ begin
|
|
'<' : RPNPush(RPNPop SHL RPNPop);
|
|
'<' : RPNPush(RPNPop SHL RPNPop);
|
|
'>' : RPNPush(RPNPop SHR RPNPop);
|
|
'>' : RPNPush(RPNPop SHR RPNPop);
|
|
'%' : begin
|
|
'%' : begin
|
|
- Temp := RPNPop;
|
|
|
|
|
|
+ Temp:=RPNPop;
|
|
if Temp <> 0 then
|
|
if Temp <> 0 then
|
|
RPNPush(RPNPop mod Temp)
|
|
RPNPush(RPNPop mod Temp)
|
|
else Error(zero_divide); { Handle divide by zero error }
|
|
else Error(zero_divide); { Handle divide by zero error }
|
|
@@ -342,7 +342,7 @@ begin
|
|
'^' : RPNPush(RPNPop XOR RPNPop);
|
|
'^' : RPNPush(RPNPop XOR RPNPop);
|
|
'/' :
|
|
'/' :
|
|
begin
|
|
begin
|
|
- Temp := RPNPop;
|
|
|
|
|
|
+ Temp:=RPNPop;
|
|
if Temp <> 0 then
|
|
if Temp <> 0 then
|
|
RPNPush(RPNPop div Temp)
|
|
RPNPush(RPNPop div Temp)
|
|
else Error(zero_divide);{ Handle divide by 0 error }
|
|
else Error(zero_divide);{ Handle divide by 0 error }
|
|
@@ -368,8 +368,8 @@ begin
|
|
if OpTop < OpMax then
|
|
if OpTop < OpMax then
|
|
begin
|
|
begin
|
|
Inc(OpTop);
|
|
Inc(OpTop);
|
|
- OpStack[OpTop].ch := _Operator;
|
|
|
|
- OpStack[OpTop].is_prefix := prefix;
|
|
|
|
|
|
+ OpStack[OpTop].ch:=_Operator;
|
|
|
|
+ OpStack[OpTop].is_prefix:=prefix;
|
|
end
|
|
end
|
|
else Error(stack_overflow); { Put some error handler here }
|
|
else Error(stack_overflow); { Put some error handler here }
|
|
end;
|
|
end;
|
|
@@ -378,7 +378,7 @@ Procedure TExprParse.OpPop(var _Operator:TExprOperator); { Get ope
|
|
begin
|
|
begin
|
|
if OpTop > 0 then
|
|
if OpTop > 0 then
|
|
begin
|
|
begin
|
|
- _Operator := OpStack[OpTop];
|
|
|
|
|
|
+ _Operator:=OpStack[OpTop];
|
|
Dec(OpTop);
|
|
Dec(OpTop);
|
|
end
|
|
end
|
|
else Error(stack_underflow); { Put some error handler here }
|
|
else Error(stack_underflow); { Put some error handler here }
|
|
@@ -388,10 +388,10 @@ Function TExprParse.Priority(_Operator : Char) : Integer; { Return priority of o
|
|
{ The greater the priority, the higher the precedence }
|
|
{ The greater the priority, the higher the precedence }
|
|
begin
|
|
begin
|
|
Case _Operator OF
|
|
Case _Operator OF
|
|
- '(' : Priority := 0;
|
|
|
|
- '+', '-' : Priority := 1;
|
|
|
|
- '*', '/','%','<','>' : Priority := 2;
|
|
|
|
- '|','&','^','~': Priority := 0;
|
|
|
|
|
|
+ '(' : Priority:=0;
|
|
|
|
+ '+', '-' : Priority:=1;
|
|
|
|
+ '*', '/','%','<','>' : Priority:=2;
|
|
|
|
+ '|','&','^','~': Priority:=0;
|
|
else Error(invalid_op);{ More error handling }
|
|
else Error(invalid_op);{ More error handling }
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -403,15 +403,19 @@ Var
|
|
Token : String15;
|
|
Token : String15;
|
|
opr: TExprOperator;
|
|
opr: TExprOperator;
|
|
begin
|
|
begin
|
|
- OpTop := 0; { Reset stacks }
|
|
|
|
- RPNTop := 0;
|
|
|
|
- Token := '';
|
|
|
|
-
|
|
|
|
- For I := 1 to Length(Expr) DO
|
|
|
|
|
|
+ Evaluate:=0;
|
|
|
|
+ { Reset stacks }
|
|
|
|
+ OpTop :=0;
|
|
|
|
+ RPNTop:=0;
|
|
|
|
+ Token :='';
|
|
|
|
+ { nothing to do ? }
|
|
|
|
+ if Expr='' then
|
|
|
|
+ exit;
|
|
|
|
+ For I:=1 to Length(Expr) DO
|
|
begin
|
|
begin
|
|
if Expr[I] in ['0'..'9'] then
|
|
if Expr[I] in ['0'..'9'] then
|
|
begin { Build multi-digit numbers }
|
|
begin { Build multi-digit numbers }
|
|
- Token := Token + Expr[I];
|
|
|
|
|
|
+ Token:=Token + Expr[I];
|
|
if I = Length(Expr) then { Send last one to calculator }
|
|
if I = Length(Expr) then { Send last one to calculator }
|
|
RPNCalc(Token,false);
|
|
RPNCalc(Token,false);
|
|
end
|
|
end
|
|
@@ -421,7 +425,7 @@ begin
|
|
if Token <> '' then
|
|
if Token <> '' then
|
|
begin { Send last built number to calc. }
|
|
begin { Send last built number to calc. }
|
|
RPNCalc(Token,false);
|
|
RPNCalc(Token,false);
|
|
- Token := '';
|
|
|
|
|
|
+ Token:='';
|
|
end;
|
|
end;
|
|
|
|
|
|
Case Expr[I] OF
|
|
Case Expr[I] OF
|
|
@@ -480,7 +484,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
{ The result is stored on the top of the stack }
|
|
{ The result is stored on the top of the stack }
|
|
- Evaluate := RPNPop;
|
|
|
|
|
|
+ Evaluate:=RPNPop;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -494,7 +498,7 @@ var
|
|
expr: TExprParse;
|
|
expr: TExprParse;
|
|
Begin
|
|
Begin
|
|
expr.Init;
|
|
expr.Init;
|
|
- CalculateExpression := expr.Evaluate(expression);
|
|
|
|
|
|
+ CalculateExpression:=expr.Evaluate(expression);
|
|
expr.Done;
|
|
expr.Done;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -573,7 +577,7 @@ Function ValDecimal(const S:String):longint;
|
|
var
|
|
var
|
|
vs,c : longint;
|
|
vs,c : longint;
|
|
Begin
|
|
Begin
|
|
- vs := 0;
|
|
|
|
|
|
+ vs:=0;
|
|
for c:=1 to length(s) do
|
|
for c:=1 to length(s) do
|
|
begin
|
|
begin
|
|
vs:=vs*10;
|
|
vs:=vs*10;
|
|
@@ -595,7 +599,7 @@ Function ValOctal(const S:String):longint;
|
|
var
|
|
var
|
|
vs,c : longint;
|
|
vs,c : longint;
|
|
Begin
|
|
Begin
|
|
- vs := 0;
|
|
|
|
|
|
+ vs:=0;
|
|
for c:=1 to length(s) do
|
|
for c:=1 to length(s) do
|
|
begin
|
|
begin
|
|
vs:=vs shl 3;
|
|
vs:=vs shl 3;
|
|
@@ -617,7 +621,7 @@ Function ValBinary(const S:String):longint;
|
|
var
|
|
var
|
|
vs,c : longint;
|
|
vs,c : longint;
|
|
Begin
|
|
Begin
|
|
- vs := 0;
|
|
|
|
|
|
+ vs:=0;
|
|
for c:=1 to length(s) do
|
|
for c:=1 to length(s) do
|
|
begin
|
|
begin
|
|
vs:=vs shl 1;
|
|
vs:=vs shl 1;
|
|
@@ -639,7 +643,7 @@ Function ValHexadecimal(const S:String):longint;
|
|
var
|
|
var
|
|
vs,c : longint;
|
|
vs,c : longint;
|
|
Begin
|
|
Begin
|
|
- vs := 0;
|
|
|
|
|
|
+ vs:=0;
|
|
for c:=1 to length(s) do
|
|
for c:=1 to length(s) do
|
|
begin
|
|
begin
|
|
vs:=vs shl 4;
|
|
vs:=vs shl 4;
|
|
@@ -664,22 +668,22 @@ end;
|
|
|
|
|
|
Function PadZero(Var s: String; n: byte): Boolean;
|
|
Function PadZero(Var s: String; n: byte): Boolean;
|
|
Begin
|
|
Begin
|
|
- PadZero := TRUE;
|
|
|
|
|
|
+ PadZero:=TRUE;
|
|
{ Do some error checking first }
|
|
{ Do some error checking first }
|
|
if Length(s) = n then
|
|
if Length(s) = n then
|
|
exit
|
|
exit
|
|
else
|
|
else
|
|
if Length(s) > n then
|
|
if Length(s) > n then
|
|
Begin
|
|
Begin
|
|
- PadZero := FALSE;
|
|
|
|
|
|
+ PadZero:=FALSE;
|
|
delete(s,n+1,length(s));
|
|
delete(s,n+1,length(s));
|
|
exit;
|
|
exit;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
- PadZero := TRUE;
|
|
|
|
|
|
+ PadZero:=TRUE;
|
|
{ Fill it up with the specified character }
|
|
{ Fill it up with the specified character }
|
|
fillchar(s[length(s)+1],n-1,#0);
|
|
fillchar(s[length(s)+1],n-1,#0);
|
|
- s[0] := chr(n);
|
|
|
|
|
|
+ s[0]:=chr(n);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -692,7 +696,7 @@ Begin
|
|
Opcode:=A_NONE;
|
|
Opcode:=A_NONE;
|
|
Opsize:=S_NO;
|
|
Opsize:=S_NO;
|
|
Condition:=C_NONE;
|
|
Condition:=C_NONE;
|
|
- labeled := FALSE;
|
|
|
|
|
|
+ labeled:=FALSE;
|
|
Ops:=0;
|
|
Ops:=0;
|
|
FillChar(Operands,sizeof(Operands),0);
|
|
FillChar(Operands,sizeof(Operands),0);
|
|
end;
|
|
end;
|
|
@@ -709,8 +713,8 @@ end;
|
|
|
|
|
|
Constructor TAsmLabelList.Init;
|
|
Constructor TAsmLabelList.Init;
|
|
Begin
|
|
Begin
|
|
- First := nil;
|
|
|
|
- Last := nil;
|
|
|
|
|
|
+ First:=nil;
|
|
|
|
+ Last:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -728,17 +732,17 @@ end;
|
|
if First = nil then
|
|
if First = nil then
|
|
Begin
|
|
Begin
|
|
New(First);
|
|
New(First);
|
|
- Last := First;
|
|
|
|
|
|
+ Last:=First;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
Begin
|
|
Begin
|
|
New(Last^.Next);
|
|
New(Last^.Next);
|
|
- Last := Last^.Next;
|
|
|
|
|
|
+ Last:=Last^.Next;
|
|
end;
|
|
end;
|
|
- Last^.name := stringdup(s);
|
|
|
|
- Last^.Lab := lab;
|
|
|
|
- Last^.Next := nil;
|
|
|
|
- Last^.emitted := emitted;
|
|
|
|
|
|
+ Last^.name:=stringdup(s);
|
|
|
|
+ Last^.Lab:=lab;
|
|
|
|
+ Last^.Next:=nil;
|
|
|
|
+ Last^.emitted:=emitted;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -753,18 +757,18 @@ end;
|
|
Var
|
|
Var
|
|
asmlab: PAsmLabel;
|
|
asmlab: PAsmLabel;
|
|
Begin
|
|
Begin
|
|
- asmlab := First;
|
|
|
|
|
|
+ asmlab:=First;
|
|
if First = nil then
|
|
if First = nil then
|
|
Begin
|
|
Begin
|
|
- Search := nil;
|
|
|
|
|
|
+ Search:=nil;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
While (asmlab^.name^ <> s) and (asmlab^.Next <> nil) do
|
|
While (asmlab^.name^ <> s) and (asmlab^.Next <> nil) do
|
|
- asmlab := asmlab^.Next;
|
|
|
|
|
|
+ asmlab:=asmlab^.Next;
|
|
if asmlab^.name^ = s then
|
|
if asmlab^.name^ = s then
|
|
- search := asmlab
|
|
|
|
|
|
+ search:=asmlab
|
|
else
|
|
else
|
|
- search := nil;
|
|
|
|
|
|
+ search:=nil;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -781,13 +785,13 @@ end;
|
|
temp: PAsmLabel;
|
|
temp: PAsmLabel;
|
|
temp1: PAsmLabel;
|
|
temp1: PAsmLabel;
|
|
Begin
|
|
Begin
|
|
- temp := First;
|
|
|
|
|
|
+ temp:=First;
|
|
while temp <> nil do
|
|
while temp <> nil do
|
|
Begin
|
|
Begin
|
|
Freemem(Temp^.name, length(Temp^.name^)+1);
|
|
Freemem(Temp^.name, length(Temp^.name^)+1);
|
|
- Temp1 := Temp^.Next;
|
|
|
|
|
|
+ Temp1:=Temp^.Next;
|
|
Dispose(Temp);
|
|
Dispose(Temp);
|
|
- Temp := Temp1;
|
|
|
|
|
|
+ Temp:=Temp1;
|
|
{ The plabel could be deleted here, but let us not do }
|
|
{ The plabel could be deleted here, but let us not do }
|
|
{ it, FPC will do it instead. }
|
|
{ it, FPC will do it instead. }
|
|
end;
|
|
end;
|
|
@@ -804,16 +808,16 @@ end;
|
|
Begin
|
|
Begin
|
|
if instr.Ops = 2 then
|
|
if instr.Ops = 2 then
|
|
Begin
|
|
Begin
|
|
- tempopr := instr.operands[1];
|
|
|
|
- instr.operands[1] := instr.operands[2];
|
|
|
|
- instr.operands[2] := tempopr;
|
|
|
|
|
|
+ tempopr:=instr.operands[1];
|
|
|
|
+ instr.operands[1]:=instr.operands[2];
|
|
|
|
+ instr.operands[2]:=tempopr;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
if instr.Ops = 3 then
|
|
if instr.Ops = 3 then
|
|
Begin
|
|
Begin
|
|
- tempopr := instr.operands[1];
|
|
|
|
- instr.operands[1] := instr.operands[3];
|
|
|
|
- instr.operands[3] := tempopr;
|
|
|
|
|
|
+ tempopr:=instr.operands[1];
|
|
|
|
+ instr.operands[1]:=instr.operands[3];
|
|
|
|
+ instr.operands[3]:=tempopr;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -830,18 +834,18 @@ end;
|
|
var
|
|
var
|
|
sym: psym;
|
|
sym: psym;
|
|
Begin
|
|
Begin
|
|
- SearchIConstant := FALSE;
|
|
|
|
|
|
+ SearchIConstant:=FALSE;
|
|
{ check for TRUE or FALSE reserved words first }
|
|
{ check for TRUE or FALSE reserved words first }
|
|
if s = 'TRUE' then
|
|
if s = 'TRUE' then
|
|
Begin
|
|
Begin
|
|
- SearchIConstant := TRUE;
|
|
|
|
- l := 1;
|
|
|
|
|
|
+ SearchIConstant:=TRUE;
|
|
|
|
+ l:=1;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
if s = 'FALSE' then
|
|
if s = 'FALSE' then
|
|
Begin
|
|
Begin
|
|
- SearchIConstant := TRUE;
|
|
|
|
- l := 0;
|
|
|
|
|
|
+ SearchIConstant:=TRUE;
|
|
|
|
+ l:=0;
|
|
end
|
|
end
|
|
else
|
|
else
|
|
if assigned(aktprocsym) then
|
|
if assigned(aktprocsym) then
|
|
@@ -851,16 +855,16 @@ end;
|
|
{ Check the local constants }
|
|
{ Check the local constants }
|
|
if assigned(aktprocsym^.definition^.localst) and
|
|
if assigned(aktprocsym^.definition^.localst) and
|
|
(lexlevel >= normal_function_level) then
|
|
(lexlevel >= normal_function_level) then
|
|
- sym := aktprocsym^.definition^.localst^.search(s)
|
|
|
|
|
|
+ sym:=aktprocsym^.definition^.localst^.search(s)
|
|
else
|
|
else
|
|
- sym := nil;
|
|
|
|
|
|
+ sym:=nil;
|
|
if assigned(sym) then
|
|
if assigned(sym) then
|
|
Begin
|
|
Begin
|
|
if (sym^.typ = constsym) and
|
|
if (sym^.typ = constsym) and
|
|
(pconstsym(sym)^.consttype in [constord,constint,constchar,constbool]) then
|
|
(pconstsym(sym)^.consttype in [constord,constint,constchar,constbool]) then
|
|
Begin
|
|
Begin
|
|
l:=pconstsym(sym)^.value;
|
|
l:=pconstsym(sym)^.value;
|
|
- SearchIConstant := TRUE;
|
|
|
|
|
|
+ SearchIConstant:=TRUE;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -876,7 +880,7 @@ end;
|
|
if (pconstsym(srsym)^.consttype in [constord,constint,constchar,constbool]) then
|
|
if (pconstsym(srsym)^.consttype in [constord,constint,constchar,constbool]) then
|
|
Begin
|
|
Begin
|
|
l:=pconstsym(srsym)^.value;
|
|
l:=pconstsym(srsym)^.value;
|
|
- SearchIConstant := TRUE;
|
|
|
|
|
|
+ SearchIConstant:=TRUE;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -898,8 +902,8 @@ end;
|
|
if assigned(procinfo.retdef) and
|
|
if assigned(procinfo.retdef) and
|
|
(procinfo.retdef<>pdef(voiddef)) then
|
|
(procinfo.retdef<>pdef(voiddef)) then
|
|
begin
|
|
begin
|
|
- instr.operands[operandnum].ref.offset := procinfo.retoffset;
|
|
|
|
- instr.operands[operandnum].ref.base := procinfo.framepointer;
|
|
|
|
|
|
+ instr.operands[operandnum].ref.offset:=procinfo.retoffset;
|
|
|
|
+ instr.operands[operandnum].ref.base:= procinfo.framepointer;
|
|
{ always assume that the result is valid. }
|
|
{ always assume that the result is valid. }
|
|
procinfo.funcret_is_valid:=true;
|
|
procinfo.funcret_is_valid:=true;
|
|
end
|
|
end
|
|
@@ -925,16 +929,16 @@ end;
|
|
if (instr.operands[operandnum].size = S_NO) or (instr.operands[operandnum].overriden = FALSE) then
|
|
if (instr.operands[operandnum].size = S_NO) or (instr.operands[operandnum].overriden = FALSE) then
|
|
Begin
|
|
Begin
|
|
case size of
|
|
case size of
|
|
- 1: instr.operands[operandnum].size := S_B;
|
|
|
|
- 2: instr.operands[operandnum].size := S_W{ could be S_IS};
|
|
|
|
- 4: instr.operands[operandnum].size := S_L{ could be S_IL or S_FS};
|
|
|
|
- 8: instr.operands[operandnum].size := S_IQ{ could be S_D or S_FL};
|
|
|
|
- extended_size: instr.operands[operandnum].size := S_FX;
|
|
|
|
|
|
+ 1: instr.operands[operandnum].size:=S_B;
|
|
|
|
+ 2: instr.operands[operandnum].size:=S_W{ could be S_IS};
|
|
|
|
+ 4: instr.operands[operandnum].size:=S_L{ could be S_IL or S_FS};
|
|
|
|
+ 8: instr.operands[operandnum].size:=S_IQ{ could be S_D or S_FL};
|
|
|
|
+ extended_size: instr.operands[operandnum].size:=S_FX;
|
|
else
|
|
else
|
|
{ this is in the case where the instruction is LEA }
|
|
{ this is in the case where the instruction is LEA }
|
|
{ or something like that, in that case size is not }
|
|
{ or something like that, in that case size is not }
|
|
{ important. }
|
|
{ important. }
|
|
- instr.operands[operandnum].size := S_NO;
|
|
|
|
|
|
+ instr.operands[operandnum].size:=S_NO;
|
|
end; { end case }
|
|
end; { end case }
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -951,7 +955,7 @@ var
|
|
i : longint;
|
|
i : longint;
|
|
base : string;
|
|
base : string;
|
|
Begin
|
|
Begin
|
|
- GetRecordOffsetSize := FALSE;
|
|
|
|
|
|
+ GetRecordOffsetSize:=FALSE;
|
|
Offset:=0;
|
|
Offset:=0;
|
|
Size:=0;
|
|
Size:=0;
|
|
i:=pos('.',s);
|
|
i:=pos('.',s);
|
|
@@ -1028,7 +1032,7 @@ Function CreateVarInstr(var Instr: TInstruction; const hs:string;operandnum:byte
|
|
var
|
|
var
|
|
sym : psym;
|
|
sym : psym;
|
|
Begin
|
|
Begin
|
|
- CreateVarInstr := FALSE;
|
|
|
|
|
|
+ CreateVarInstr:=FALSE;
|
|
{ are we in a routine ? }
|
|
{ are we in a routine ? }
|
|
getsym(hs,false);
|
|
getsym(hs,false);
|
|
sym:=srsym;
|
|
sym:=srsym;
|
|
@@ -1048,10 +1052,10 @@ Begin
|
|
instr.operands[operandnum].ref.symbol:=newasmsymbol(pvarsym(sym)^.mangledname);
|
|
instr.operands[operandnum].ref.symbol:=newasmsymbol(pvarsym(sym)^.mangledname);
|
|
parasymtable :
|
|
parasymtable :
|
|
begin
|
|
begin
|
|
- instr.operands[operandnum].ref.base := procinfo.framepointer;
|
|
|
|
- instr.operands[operandnum].ref.offset := pvarsym(sym)^.address;
|
|
|
|
|
|
+ instr.operands[operandnum].ref.base:=procinfo.framepointer;
|
|
|
|
+ instr.operands[operandnum].ref.offset:=pvarsym(sym)^.address;
|
|
instr.operands[operandnum].ref.offsetfixup:=aktprocsym^.definition^.parast^.address_fixup;
|
|
instr.operands[operandnum].ref.offsetfixup:=aktprocsym^.definition^.parast^.address_fixup;
|
|
- instr.operands[operandnum].ref.options := ref_parafixup;
|
|
|
|
|
|
+ instr.operands[operandnum].ref.options:=ref_parafixup;
|
|
end;
|
|
end;
|
|
localsymtable :
|
|
localsymtable :
|
|
begin
|
|
begin
|
|
@@ -1059,9 +1063,9 @@ Begin
|
|
instr.operands[operandnum].ref.symbol:=newasmsymbol(pvarsym(sym)^.mangledname)
|
|
instr.operands[operandnum].ref.symbol:=newasmsymbol(pvarsym(sym)^.mangledname)
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- instr.operands[operandnum].ref.base := procinfo.framepointer;
|
|
|
|
- instr.operands[operandnum].ref.offset := -(pvarsym(sym)^.address);
|
|
|
|
- instr.operands[operandnum].ref.options := ref_localfixup;
|
|
|
|
|
|
+ instr.operands[operandnum].ref.base:=procinfo.framepointer;
|
|
|
|
+ instr.operands[operandnum].ref.offset:=-(pvarsym(sym)^.address);
|
|
|
|
+ instr.operands[operandnum].ref.options:=ref_localfixup;
|
|
instr.operands[operandnum].ref.offsetfixup:=aktprocsym^.definition^.localst^.address_fixup;
|
|
instr.operands[operandnum].ref.offsetfixup:=aktprocsym^.definition^.localst^.address_fixup;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1075,7 +1079,7 @@ Begin
|
|
SetOperandSize(instr,operandnum,parraydef(pvarsym(sym)^.definition)^.elesize)
|
|
SetOperandSize(instr,operandnum,parraydef(pvarsym(sym)^.definition)^.elesize)
|
|
end;
|
|
end;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
- CreateVarInstr := TRUE;
|
|
|
|
|
|
+ CreateVarInstr:=TRUE;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
typedconstsym :
|
|
typedconstsym :
|
|
@@ -1090,7 +1094,7 @@ Begin
|
|
SetOperandSize(instr,operandnum,parraydef(ptypedconstsym(sym)^.definition)^.elesize)
|
|
SetOperandSize(instr,operandnum,parraydef(ptypedconstsym(sym)^.definition)^.elesize)
|
|
end;
|
|
end;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
- CreateVarInstr := TRUE;
|
|
|
|
|
|
+ CreateVarInstr:=TRUE;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
constsym :
|
|
constsym :
|
|
@@ -1100,7 +1104,7 @@ Begin
|
|
instr.operands[operandnum].operandtype:=OPR_CONSTANT;
|
|
instr.operands[operandnum].operandtype:=OPR_CONSTANT;
|
|
instr.operands[operandnum].val:=pconstsym(sym)^.value;
|
|
instr.operands[operandnum].val:=pconstsym(sym)^.value;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
- CreateVarInstr := TRUE;
|
|
|
|
|
|
+ CreateVarInstr:=TRUE;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1111,7 +1115,7 @@ Begin
|
|
instr.operands[operandnum].operandtype:=OPR_CONSTANT;
|
|
instr.operands[operandnum].operandtype:=OPR_CONSTANT;
|
|
instr.operands[operandnum].val:=0;
|
|
instr.operands[operandnum].val:=0;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
- CreateVarInstr := TRUE;
|
|
|
|
|
|
+ CreateVarInstr:=TRUE;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1122,7 +1126,7 @@ Begin
|
|
instr.operands[operandnum].operandtype:=OPR_SYMBOL;
|
|
instr.operands[operandnum].operandtype:=OPR_SYMBOL;
|
|
instr.operands[operandnum].symbol:=newasmsymbol(pprocsym(sym)^.definition^.mangledname);
|
|
instr.operands[operandnum].symbol:=newasmsymbol(pprocsym(sym)^.definition^.mangledname);
|
|
instr.operands[operandnum].hasvar:=true;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
- CreateVarInstr := TRUE;
|
|
|
|
|
|
+ CreateVarInstr:=TRUE;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
else
|
|
else
|
|
@@ -1143,22 +1147,22 @@ end;
|
|
var
|
|
var
|
|
sym: psym;
|
|
sym: psym;
|
|
Begin
|
|
Begin
|
|
- SearchLabel := FALSE;
|
|
|
|
|
|
+ SearchLabel:=FALSE;
|
|
if assigned(aktprocsym) then
|
|
if assigned(aktprocsym) then
|
|
Begin
|
|
Begin
|
|
{ Check the local constants }
|
|
{ Check the local constants }
|
|
if assigned(aktprocsym^.definition) then
|
|
if assigned(aktprocsym^.definition) then
|
|
Begin
|
|
Begin
|
|
if assigned(aktprocsym^.definition^.localst) then
|
|
if assigned(aktprocsym^.definition^.localst) then
|
|
- sym := aktprocsym^.definition^.localst^.search(s)
|
|
|
|
|
|
+ sym:=aktprocsym^.definition^.localst^.search(s)
|
|
else
|
|
else
|
|
- sym := nil;
|
|
|
|
|
|
+ sym:=nil;
|
|
if assigned(sym) then
|
|
if assigned(sym) then
|
|
Begin
|
|
Begin
|
|
if (sym^.typ = labelsym) then
|
|
if (sym^.typ = labelsym) then
|
|
Begin
|
|
Begin
|
|
hl:=plabelsym(sym)^.number;
|
|
hl:=plabelsym(sym)^.number;
|
|
- SearchLabel := TRUE;
|
|
|
|
|
|
+ SearchLabel:=TRUE;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1171,7 +1175,7 @@ end;
|
|
if (srsym^.typ=labelsym) then
|
|
if (srsym^.typ=labelsym) then
|
|
Begin
|
|
Begin
|
|
hl:=plabelsym(srsym)^.number;
|
|
hl:=plabelsym(srsym)^.number;
|
|
- SearchLabel:= TRUE;
|
|
|
|
|
|
+ SearchLabel:=TRUE;
|
|
exit;
|
|
exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1192,20 +1196,20 @@ Begin
|
|
begin
|
|
begin
|
|
instr.operands[operandnum].ref.symbol:=p^.sym;
|
|
instr.operands[operandnum].ref.symbol:=p^.sym;
|
|
case p^.exttyp of
|
|
case p^.exttyp of
|
|
- EXT_BYTE : instr.operands[operandnum].size := S_B;
|
|
|
|
- EXT_WORD : instr.operands[operandnum].size := S_W;
|
|
|
|
|
|
+ EXT_BYTE : instr.operands[operandnum].size:=S_B;
|
|
|
|
+ EXT_WORD : instr.operands[operandnum].size:=S_W;
|
|
EXT_NEAR,EXT_FAR,EXT_PROC,EXT_DWORD,EXT_CODEPTR,EXT_DATAPTR:
|
|
EXT_NEAR,EXT_FAR,EXT_PROC,EXT_DWORD,EXT_CODEPTR,EXT_DATAPTR:
|
|
- instr.operands[operandnum].size := S_L;
|
|
|
|
- EXT_QWORD : instr.operands[operandnum].size := S_FL;
|
|
|
|
- EXT_TBYTE : instr.operands[operandnum].size := S_FX;
|
|
|
|
|
|
+ instr.operands[operandnum].size:=S_L;
|
|
|
|
+ EXT_QWORD : instr.operands[operandnum].size:=S_FL;
|
|
|
|
+ EXT_TBYTE : instr.operands[operandnum].size:=S_FX;
|
|
else
|
|
else
|
|
{ this is in the case where the instruction is LEA }
|
|
{ this is in the case where the instruction is LEA }
|
|
{ or something like that, in that case size is not }
|
|
{ or something like that, in that case size is not }
|
|
{ important. }
|
|
{ important. }
|
|
- instr.operands[operandnum].size := S_NO;
|
|
|
|
|
|
+ instr.operands[operandnum].size:=S_NO;
|
|
end;
|
|
end;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
instr.operands[operandnum].hasvar:=true;
|
|
- SearchDirectVar := TRUE;
|
|
|
|
|
|
+ SearchDirectVar:=TRUE;
|
|
Exit;
|
|
Exit;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1273,7 +1277,7 @@ end;
|
|
Begin
|
|
Begin
|
|
Message(assem_e_constant_out_of_bounds);
|
|
Message(assem_e_constant_out_of_bounds);
|
|
{ assuming a value of maxvalue }
|
|
{ assuming a value of maxvalue }
|
|
- value := maxvalue;
|
|
|
|
|
|
+ value:=maxvalue;
|
|
end;
|
|
end;
|
|
if maxvalue = $ff then
|
|
if maxvalue = $ff then
|
|
p^.concat(new(pai_const,init_8bit(byte(value))))
|
|
p^.concat(new(pai_const,init_8bit(byte(value))))
|
|
@@ -1397,7 +1401,11 @@ end;
|
|
end.
|
|
end.
|
|
{
|
|
{
|
|
$Log$
|
|
$Log$
|
|
- Revision 1.10 1999-05-01 13:24:41 peter
|
|
|
|
|
|
+ Revision 1.11 1999-05-02 22:41:57 peter
|
|
|
|
+ * moved section names to systems
|
|
|
|
+ * fixed nasm,intel writer
|
|
|
|
+
|
|
|
|
+ Revision 1.10 1999/05/01 13:24:41 peter
|
|
* merged nasm compiler
|
|
* merged nasm compiler
|
|
* old asm moved to oldasm/
|
|
* old asm moved to oldasm/
|
|
|
|
|