mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 12:46:11 +02:00
* moved section names to systems
* fixed nasm,intel writer
This commit is contained in:
parent
116e172bbc
commit
adda83dac6
@ -25,7 +25,7 @@ unit aasm;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
cobjects,files,globals;
|
systems,cobjects,files,globals;
|
||||||
|
|
||||||
type
|
type
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
@ -70,13 +70,6 @@ unit aasm;
|
|||||||
{ never used, makes insertation of new ait_ easier to type }
|
{ never used, makes insertation of new ait_ easier to type }
|
||||||
ait_dummy);
|
ait_dummy);
|
||||||
|
|
||||||
tsection=(sec_none,
|
|
||||||
sec_code,sec_data,sec_bss,
|
|
||||||
sec_stab,sec_stabstr,
|
|
||||||
sec_idata2,sec_idata4,sec_idata5,sec_idata6,sec_idata7,sec_edata,
|
|
||||||
sec_fake
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
{ asm symbol functions }
|
{ asm symbol functions }
|
||||||
type
|
type
|
||||||
@ -350,7 +343,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
strings,verbose,systems,globtype;
|
strings,verbose,globtype;
|
||||||
|
|
||||||
{****************************************************************************
|
{****************************************************************************
|
||||||
TAI
|
TAI
|
||||||
@ -1013,7 +1006,11 @@ uses
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.40 1999-04-21 09:43:28 peter
|
Revision 1.41 1999-05-02 22:41:46 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.40 1999/04/21 09:43:28 peter
|
||||||
* storenumber works
|
* storenumber works
|
||||||
* fixed some typos in double_checksum
|
* fixed some typos in double_checksum
|
||||||
+ incompatible types type1 and type2 message (with storenumber)
|
+ incompatible types type1 and type2 message (with storenumber)
|
||||||
|
@ -338,9 +338,6 @@ unit ag386int;
|
|||||||
ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
|
ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
|
||||||
(#9'DD'#9,#9'DW'#9,#9'DB'#9);
|
(#9'DD'#9,#9'DW'#9,#9'DB'#9);
|
||||||
|
|
||||||
ait_section2masmstr : array[tsection] of string[6]=
|
|
||||||
('','CODE','DATA','BSS','','','','','','','','','');
|
|
||||||
|
|
||||||
Function PadTabs(const p:string;addch:char):string;
|
Function PadTabs(const p:string;addch:char):string;
|
||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
@ -395,13 +392,13 @@ unit ag386int;
|
|||||||
ait_tempalloc : ;
|
ait_tempalloc : ;
|
||||||
ait_section : begin
|
ait_section : begin
|
||||||
if LastSec<>sec_none then
|
if LastSec<>sec_none then
|
||||||
AsmWriteLn('_'+ait_section2masmstr[LastSec]+#9#9'ENDS');
|
AsmWriteLn('_'+target_asm.secnames[LastSec]+#9#9'ENDS');
|
||||||
if pai_section(hp)^.sec<>sec_none then
|
if pai_section(hp)^.sec<>sec_none then
|
||||||
begin
|
begin
|
||||||
AsmLn;
|
AsmLn;
|
||||||
AsmWriteLn('_'+ait_section2masmstr[pai_section(hp)^.sec]+#9#9+
|
AsmWriteLn('_'+target_asm.secnames[pai_section(hp)^.sec]+#9#9+
|
||||||
'SEGMENT'#9'PARA PUBLIC USE32 '''+
|
'SEGMENT'#9'PARA PUBLIC USE32 '''+
|
||||||
ait_section2masmstr[pai_section(hp)^.sec]+'''');
|
target_asm.secnames[pai_section(hp)^.sec]+'''');
|
||||||
end;
|
end;
|
||||||
LastSec:=pai_section(hp)^.sec;
|
LastSec:=pai_section(hp)^.sec;
|
||||||
end;
|
end;
|
||||||
@ -554,6 +551,7 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]
|
|||||||
ait_instruction : begin
|
ait_instruction : begin
|
||||||
suffix:='';
|
suffix:='';
|
||||||
prefix:= '';
|
prefix:= '';
|
||||||
|
s:='';
|
||||||
{$ifndef OLDASM}
|
{$ifndef OLDASM}
|
||||||
{ added prefix instructions, must be on same line as opcode }
|
{ added prefix instructions, must be on same line as opcode }
|
||||||
if (pai386(hp)^.ops = 0) and
|
if (pai386(hp)^.ops = 0) and
|
||||||
@ -582,7 +580,7 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]
|
|||||||
if pai386(hp)^.ops<>0 then
|
if pai386(hp)^.ops<>0 then
|
||||||
begin
|
begin
|
||||||
if pai386(hp)^.opcode=A_CALL then
|
if pai386(hp)^.opcode=A_CALL then
|
||||||
s:='dword ptr '+getopstr_jmp(pai386(hp)^.oper[0])
|
s:=#9+getopstr_jmp(pai386(hp)^.oper[0])
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
for i:=0to pai386(hp)^.ops-1 do
|
for i:=0to pai386(hp)^.ops-1 do
|
||||||
@ -594,30 +592,6 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]
|
|||||||
s:=s+sep+getopstr(pai386(hp)^.oper[i],pai386(hp)^.opsize,pai386(hp)^.opcode,(i=1));
|
s:=s+sep+getopstr(pai386(hp)^.oper[i],pai386(hp)^.opsize,pai386(hp)^.opcode,(i=1));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
{ check if string instruction }
|
|
||||||
{ long form, otherwise may give range check errors }
|
|
||||||
{ in turbo pascal... }
|
|
||||||
{ if ((pai386(hp)^.opcode = A_CMPS) or
|
|
||||||
(pai386(hp)^.opcode = A_INS) or
|
|
||||||
(pai386(hp)^.opcode = A_OUTS) or
|
|
||||||
(pai386(hp)^.opcode = A_SCAS) or
|
|
||||||
(pai386(hp)^.opcode = A_STOS) or
|
|
||||||
(pai386(hp)^.opcode = A_MOVS) or
|
|
||||||
(pai386(hp)^.opcode = A_LODS) or
|
|
||||||
(pai386(hp)^.opcode = A_XLAT)) then
|
|
||||||
Begin
|
|
||||||
case pai386(hp)^.opsize of
|
|
||||||
S_B: suffix:='b';
|
|
||||||
S_W: suffix:='w';
|
|
||||||
S_L: suffix:='d';
|
|
||||||
else
|
|
||||||
Message(assem_f_invalid_suffix_intel);
|
|
||||||
end;
|
|
||||||
end; }
|
|
||||||
s:='';
|
|
||||||
end;
|
end;
|
||||||
AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+cond2str[pai386_labeled(hp)^.condition]+suffix+s);
|
AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+cond2str[pai386_labeled(hp)^.condition]+suffix+s);
|
||||||
{$else}
|
{$else}
|
||||||
@ -722,7 +696,7 @@ ait_stab_function_name : ;
|
|||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
if LastSec<>sec_none then
|
if LastSec<>sec_none then
|
||||||
AsmWriteLn('_'+ait_section2masmstr[LastSec]+#9#9'ENDS');
|
AsmWriteLn('_'+target_asm.secnames[LastSec]+#9#9'ENDS');
|
||||||
AsmLn;
|
AsmLn;
|
||||||
AsmWriteLn(#9'END');
|
AsmWriteLn(#9'END');
|
||||||
AsmClose;
|
AsmClose;
|
||||||
@ -743,9 +717,9 @@ ait_stab_function_name : ;
|
|||||||
AsmWriteLn(#9'.386p');
|
AsmWriteLn(#9'.386p');
|
||||||
AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
|
AsmWriteLn(#9'LOCALS '+target_asm.labelprefix);
|
||||||
if lastsec<>sec_none then
|
if lastsec<>sec_none then
|
||||||
AsmWriteLn('_'+ait_section2masmstr[lastsec]+#9#9+
|
AsmWriteLn('_'+target_asm.secnames[lastsec]+#9#9+
|
||||||
'SEGMENT'#9'PARA PUBLIC USE32 '''+
|
'SEGMENT'#9'PARA PUBLIC USE32 '''+
|
||||||
ait_section2masmstr[lastsec]+'''');
|
target_asm.secnames[lastsec]+'''');
|
||||||
AsmStartSize:=AsmSize;
|
AsmStartSize:=AsmSize;
|
||||||
end;
|
end;
|
||||||
ait_marker: ;
|
ait_marker: ;
|
||||||
@ -795,7 +769,11 @@ ait_stab_function_name : ;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.34 1999-05-01 13:23:58 peter
|
Revision 1.35 1999-05-02 22:41:49 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.34 1999/05/01 13:23:58 peter
|
||||||
* merged nasm compiler
|
* merged nasm compiler
|
||||||
* old asm moved to oldasm/
|
* old asm moved to oldasm/
|
||||||
|
|
||||||
|
@ -344,12 +344,6 @@ unit ag386nsm;
|
|||||||
ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
|
ait_const2str:array[ait_const_32bit..ait_const_8bit] of string[8]=
|
||||||
(#9'DD'#9,#9'DW'#9,#9'DB'#9);
|
(#9'DD'#9,#9'DW'#9,#9'DB'#9);
|
||||||
|
|
||||||
ait_section2nasmstr : array[tsection] of string[8]=
|
|
||||||
('','.text','.data','.bss',
|
|
||||||
'.stab','.stabstr',
|
|
||||||
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
|
||||||
'');
|
|
||||||
|
|
||||||
Function PadTabs(const p:string;addch:char):string;
|
Function PadTabs(const p:string;addch:char):string;
|
||||||
var
|
var
|
||||||
s : string;
|
s : string;
|
||||||
@ -408,7 +402,7 @@ unit ag386nsm;
|
|||||||
if pai_section(hp)^.sec<>sec_none then
|
if pai_section(hp)^.sec<>sec_none then
|
||||||
begin
|
begin
|
||||||
AsmLn;
|
AsmLn;
|
||||||
AsmWriteLn('SECTION '+ait_section2nasmstr[pai_section(hp)^.sec]);
|
AsmWriteLn('SECTION '+target_asm.secnames[pai_section(hp)^.sec]);
|
||||||
end;
|
end;
|
||||||
LastSec:=pai_section(hp)^.sec;
|
LastSec:=pai_section(hp)^.sec;
|
||||||
end;
|
end;
|
||||||
@ -557,6 +551,7 @@ ait_labeled_instruction :
|
|||||||
ait_instruction : begin
|
ait_instruction : begin
|
||||||
suffix:='';
|
suffix:='';
|
||||||
prefix:='';
|
prefix:='';
|
||||||
|
s:='';
|
||||||
{$ifndef OLDASM}
|
{$ifndef OLDASM}
|
||||||
if pai386(hp)^.ops<>0 then
|
if pai386(hp)^.ops<>0 then
|
||||||
begin
|
begin
|
||||||
@ -573,9 +568,7 @@ ait_labeled_instruction :
|
|||||||
s:=s+sep+getopstr(pai386(hp)^.oper[i],pai386(hp)^.opsize,pai386(hp)^.opcode,(i=1));
|
s:=s+sep+getopstr(pai386(hp)^.oper[i],pai386(hp)^.opsize,pai386(hp)^.opcode,(i=1));
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end
|
end;
|
||||||
else
|
|
||||||
s:='';
|
|
||||||
if pai386(hp)^.opcode=A_FWAIT then
|
if pai386(hp)^.opcode=A_FWAIT then
|
||||||
AsmWriteln(#9#9'DB'#9'09bh')
|
AsmWriteln(#9#9'DB'#9'09bh')
|
||||||
else
|
else
|
||||||
@ -696,7 +689,7 @@ ait_stab_function_name : ;
|
|||||||
hp:=pai(hp^.next);
|
hp:=pai(hp^.next);
|
||||||
end;
|
end;
|
||||||
if lastsec<>sec_none then
|
if lastsec<>sec_none then
|
||||||
AsmWriteLn('SECTION '+ait_section2nasmstr[lastsec]);
|
AsmWriteLn('SECTION '+target_asm.secnames[lastsec]);
|
||||||
AsmStartSize:=AsmSize;
|
AsmStartSize:=AsmSize;
|
||||||
end;
|
end;
|
||||||
ait_marker : ;
|
ait_marker : ;
|
||||||
@ -740,7 +733,11 @@ ait_stab_function_name : ;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.29 1999-05-01 13:23:59 peter
|
Revision 1.30 1999-05-02 22:41:50 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.29 1999/05/01 13:23:59 peter
|
||||||
* merged nasm compiler
|
* merged nasm compiler
|
||||||
* old asm moved to oldasm/
|
* old asm moved to oldasm/
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ uses
|
|||||||
{$endif}
|
{$endif}
|
||||||
,strings
|
,strings
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
{$ifndef OLDASM}
|
{$ifndef NoAg386Bin}
|
||||||
,ag386bin
|
,ag386bin
|
||||||
{$endif}
|
{$endif}
|
||||||
{$ifndef NoAg386Att}
|
{$ifndef NoAg386Att}
|
||||||
@ -446,14 +446,14 @@ Procedure GenerateAsm;
|
|||||||
var
|
var
|
||||||
a : PAsmList;
|
a : PAsmList;
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
{$ifndef OLDASM}
|
{$ifndef NoAg386Bin}
|
||||||
b : Pi386binasmlist;
|
b : Pi386binasmlist;
|
||||||
{$endif}
|
{$endif}
|
||||||
{$endif}
|
{$endif}
|
||||||
begin
|
begin
|
||||||
case aktoutputformat of
|
case aktoutputformat of
|
||||||
{$ifdef i386}
|
{$ifdef i386}
|
||||||
{$ifndef OLDASM}
|
{$ifndef NoAg386Bin}
|
||||||
as_i386_dbg,
|
as_i386_dbg,
|
||||||
as_i386_coff,
|
as_i386_coff,
|
||||||
as_i386_pecoff :
|
as_i386_pecoff :
|
||||||
@ -479,7 +479,7 @@ begin
|
|||||||
SynchronizeFileTime(current_module^.ppufilename^,current_module^.objfilename^);
|
SynchronizeFileTime(current_module^.ppufilename^,current_module^.objfilename^);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
{$endif Ag386Bin}
|
{$endif NoAg386Bin}
|
||||||
{$ifndef NoAg386Att}
|
{$ifndef NoAg386Att}
|
||||||
as_i386_as,
|
as_i386_as,
|
||||||
as_i386_as_aout,
|
as_i386_as_aout,
|
||||||
@ -541,7 +541,11 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.42 1999-05-01 13:24:00 peter
|
Revision 1.43 1999-05-02 22:41:51 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.42 1999/05/01 13:24:00 peter
|
||||||
* merged nasm compiler
|
* merged nasm compiler
|
||||||
* old asm moved to oldasm/
|
* old asm moved to oldasm/
|
||||||
|
|
||||||
|
@ -209,6 +209,8 @@ uses
|
|||||||
|
|
||||||
procedure tai386.loadconst(opidx:longint;l:longint);
|
procedure tai386.loadconst(opidx:longint;l:longint);
|
||||||
begin
|
begin
|
||||||
|
if opidx>=ops then
|
||||||
|
ops:=opidx+1;
|
||||||
with oper[opidx] do
|
with oper[opidx] do
|
||||||
begin
|
begin
|
||||||
if typ=top_ref then
|
if typ=top_ref then
|
||||||
@ -220,6 +222,8 @@ uses
|
|||||||
|
|
||||||
procedure tai386.loadsymbol(opidx:longint;s:pasmsymbol;sofs:longint);
|
procedure tai386.loadsymbol(opidx:longint;s:pasmsymbol;sofs:longint);
|
||||||
begin
|
begin
|
||||||
|
if opidx>=ops then
|
||||||
|
ops:=opidx+1;
|
||||||
with oper[opidx] do
|
with oper[opidx] do
|
||||||
begin
|
begin
|
||||||
if typ=top_ref then
|
if typ=top_ref then
|
||||||
@ -232,6 +236,8 @@ uses
|
|||||||
|
|
||||||
procedure tai386.loadref(opidx:longint;p:preference);
|
procedure tai386.loadref(opidx:longint;p:preference);
|
||||||
begin
|
begin
|
||||||
|
if opidx>=ops then
|
||||||
|
ops:=opidx+1;
|
||||||
with oper[opidx] do
|
with oper[opidx] do
|
||||||
begin
|
begin
|
||||||
if typ=top_ref then
|
if typ=top_ref then
|
||||||
@ -257,6 +263,8 @@ uses
|
|||||||
|
|
||||||
procedure tai386.loadreg(opidx:longint;r:tregister);
|
procedure tai386.loadreg(opidx:longint;r:tregister);
|
||||||
begin
|
begin
|
||||||
|
if opidx>=ops then
|
||||||
|
ops:=opidx+1;
|
||||||
with oper[opidx] do
|
with oper[opidx] do
|
||||||
begin
|
begin
|
||||||
if typ=top_ref then
|
if typ=top_ref then
|
||||||
@ -268,6 +276,8 @@ uses
|
|||||||
|
|
||||||
procedure tai386.loadoper(opidx:longint;o:toper);
|
procedure tai386.loadoper(opidx:longint;o:toper);
|
||||||
begin
|
begin
|
||||||
|
if opidx>=ops then
|
||||||
|
ops:=opidx+1;
|
||||||
if oper[opidx].typ=top_ref then
|
if oper[opidx].typ=top_ref then
|
||||||
disposereference(oper[opidx].ref);
|
disposereference(oper[opidx].ref);
|
||||||
oper[opidx]:=o;
|
oper[opidx]:=o;
|
||||||
@ -1569,7 +1579,11 @@ end;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.2 1999-05-02 21:33:52 florian
|
Revision 1.3 1999-05-02 22:41:53 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.2 1999/05/02 21:33:52 florian
|
||||||
* several bugs regarding -Or fixed
|
* several bugs regarding -Or fixed
|
||||||
|
|
||||||
Revision 1.1 1999/05/01 13:24:23 peter
|
Revision 1.1 1999/05/01 13:24:23 peter
|
||||||
|
@ -30,7 +30,7 @@ unit og386;
|
|||||||
uses
|
uses
|
||||||
dos,
|
dos,
|
||||||
owbase,owar,
|
owbase,owar,
|
||||||
i386base,aasm;
|
systems,i386base,aasm;
|
||||||
|
|
||||||
type
|
type
|
||||||
tsecsize = array[tsection] of longint;
|
tsecsize = array[tsection] of longint;
|
||||||
@ -77,7 +77,7 @@ unit og386;
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
systems,globtype,globals,verbose,files,
|
globtype,globals,verbose,files,
|
||||||
assemble;
|
assemble;
|
||||||
|
|
||||||
|
|
||||||
@ -236,7 +236,11 @@ unit og386;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1999-05-01 13:24:23 peter
|
Revision 1.2 1999-05-02 22:41:54 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.1 1999/05/01 13:24:23 peter
|
||||||
* merged nasm compiler
|
* merged nasm compiler
|
||||||
* old asm moved to oldasm/
|
* old asm moved to oldasm/
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ unit og386dbg;
|
|||||||
|
|
||||||
interface
|
interface
|
||||||
uses
|
uses
|
||||||
i386base,
|
systems,i386base,
|
||||||
aasm,
|
aasm,
|
||||||
og386;
|
og386;
|
||||||
|
|
||||||
@ -189,7 +189,11 @@ unit og386dbg;
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 1999-05-01 13:24:24 peter
|
Revision 1.2 1999-05-02 22:41:55 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.1 1999/05/01 13:24:24 peter
|
||||||
* merged nasm compiler
|
* merged nasm compiler
|
||||||
* old asm moved to oldasm/
|
* old asm moved to oldasm/
|
||||||
|
|
||||||
|
@ -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].ch:=_Operator;
|
||||||
OpStack[OpTop].is_prefix := prefix;
|
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:=0;
|
||||||
'+', '-' : Priority := 1;
|
'+', '-' : Priority:=1;
|
||||||
'*', '/','%','<','>' : Priority := 2;
|
'*', '/','%','<','>' : Priority:=2;
|
||||||
'|','&','^','~': Priority := 0;
|
'|','&','^','~': 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 }
|
Evaluate:=0;
|
||||||
RPNTop := 0;
|
{ Reset stacks }
|
||||||
Token := '';
|
OpTop :=0;
|
||||||
|
RPNTop:=0;
|
||||||
For I := 1 to Length(Expr) DO
|
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;
|
First:=nil;
|
||||||
Last := 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^.name:=stringdup(s);
|
||||||
Last^.Lab := lab;
|
Last^.Lab:=lab;
|
||||||
Last^.Next := nil;
|
Last^.Next:=nil;
|
||||||
Last^.emitted := emitted;
|
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];
|
tempopr:=instr.operands[1];
|
||||||
instr.operands[1] := instr.operands[2];
|
instr.operands[1]:=instr.operands[2];
|
||||||
instr.operands[2] := tempopr;
|
instr.operands[2]:=tempopr;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if instr.Ops = 3 then
|
if instr.Ops = 3 then
|
||||||
Begin
|
Begin
|
||||||
tempopr := instr.operands[1];
|
tempopr:=instr.operands[1];
|
||||||
instr.operands[1] := instr.operands[3];
|
instr.operands[1]:=instr.operands[3];
|
||||||
instr.operands[3] := tempopr;
|
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;
|
SearchIConstant:=TRUE;
|
||||||
l := 1;
|
l:=1;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if s = 'FALSE' then
|
if s = 'FALSE' then
|
||||||
Begin
|
Begin
|
||||||
SearchIConstant := TRUE;
|
SearchIConstant:=TRUE;
|
||||||
l := 0;
|
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.offset:=procinfo.retoffset;
|
||||||
instr.operands[operandnum].ref.base := procinfo.framepointer;
|
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;
|
1: instr.operands[operandnum].size:=S_B;
|
||||||
2: instr.operands[operandnum].size := S_W{ could be S_IS};
|
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};
|
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};
|
8: instr.operands[operandnum].size:=S_IQ{ could be S_D or S_FL};
|
||||||
extended_size: instr.operands[operandnum].size := S_FX;
|
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.base:=procinfo.framepointer;
|
||||||
instr.operands[operandnum].ref.offset := pvarsym(sym)^.address;
|
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.base:=procinfo.framepointer;
|
||||||
instr.operands[operandnum].ref.offset := -(pvarsym(sym)^.address);
|
instr.operands[operandnum].ref.offset:=-(pvarsym(sym)^.address);
|
||||||
instr.operands[operandnum].ref.options := ref_localfixup;
|
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_BYTE : instr.operands[operandnum].size:=S_B;
|
||||||
EXT_WORD : instr.operands[operandnum].size := S_W;
|
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;
|
instr.operands[operandnum].size:=S_L;
|
||||||
EXT_QWORD : instr.operands[operandnum].size := S_FL;
|
EXT_QWORD : instr.operands[operandnum].size:=S_FL;
|
||||||
EXT_TBYTE : instr.operands[operandnum].size := S_FX;
|
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/
|
||||||
|
|
||||||
|
@ -37,6 +37,12 @@ unit systems;
|
|||||||
,MC68000,MC68100,MC68020
|
,MC68000,MC68100,MC68020
|
||||||
);
|
);
|
||||||
|
|
||||||
|
tsection=(sec_none,
|
||||||
|
sec_code,sec_data,sec_bss,
|
||||||
|
sec_stab,sec_stabstr,
|
||||||
|
sec_idata2,sec_idata4,sec_idata5,sec_idata6,sec_idata7,sec_edata,
|
||||||
|
sec_fake
|
||||||
|
);
|
||||||
|
|
||||||
type
|
type
|
||||||
tasmmode= (asmmode_none
|
tasmmode= (asmmode_none
|
||||||
@ -150,6 +156,7 @@ unit systems;
|
|||||||
externals : boolean;
|
externals : boolean;
|
||||||
labelprefix : string[2];
|
labelprefix : string[2];
|
||||||
comment : string[2];
|
comment : string[2];
|
||||||
|
secnames : array[tsection] of string[20];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
tlinkinfo = packed record
|
tlinkinfo = packed record
|
||||||
@ -471,7 +478,12 @@ implementation
|
|||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '# '
|
comment : '# ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'','','','','','',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_as_aout;
|
id : as_i386_as_aout;
|
||||||
@ -480,7 +492,12 @@ implementation
|
|||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : 'L';
|
labelprefix : 'L';
|
||||||
comment : '# '
|
comment : '# ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'','','','','','',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_asw;
|
id : as_i386_asw;
|
||||||
@ -489,7 +506,13 @@ implementation
|
|||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '# '
|
comment : '# ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.section .bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.section .idata$2','.section .idata$4','.section .idata$5',
|
||||||
|
'.section .idata$6','.section .idata$7','.section .edata',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_nasmcoff;
|
id : as_i386_nasmcoff;
|
||||||
@ -498,7 +521,12 @@ implementation
|
|||||||
asmcmd : '-f coff -o $OBJ $ASM';
|
asmcmd : '-f coff -o $OBJ $ASM';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : 'L';
|
labelprefix : 'L';
|
||||||
comment : '; '
|
comment : '; ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_nasmelf;
|
id : as_i386_nasmelf;
|
||||||
@ -507,7 +535,12 @@ implementation
|
|||||||
asmcmd : '-f elf -o $OBJ $ASM';
|
asmcmd : '-f elf -o $OBJ $ASM';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : 'L';
|
labelprefix : 'L';
|
||||||
comment : '; '
|
comment : '; ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_nasmobj;
|
id : as_i386_nasmobj;
|
||||||
@ -516,7 +549,12 @@ implementation
|
|||||||
asmcmd : '-f obj -o $OBJ $ASM';
|
asmcmd : '-f obj -o $OBJ $ASM';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : 'L';
|
labelprefix : 'L';
|
||||||
comment : '; '
|
comment : '; ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata2','.idata4','.idata5','.idata6','.idata7','.edata',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_tasm;
|
id : as_i386_tasm;
|
||||||
@ -524,8 +562,12 @@ implementation
|
|||||||
asmbin : 'tasm';
|
asmbin : 'tasm';
|
||||||
asmcmd : '/m2 $ASM $OBJ';
|
asmcmd : '/m2 $ASM $OBJ';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : 'L';
|
labelprefix : '@@';
|
||||||
comment : '; '
|
comment : '; ';
|
||||||
|
secnames : ('',
|
||||||
|
'CODE','DATA','BSS',
|
||||||
|
'','','','','','','','',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_masm;
|
id : as_i386_masm;
|
||||||
@ -534,7 +576,11 @@ implementation
|
|||||||
asmcmd : '$ASM $OBJ';
|
asmcmd : '$ASM $OBJ';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '; '
|
comment : '; ';
|
||||||
|
secnames : ('',
|
||||||
|
'CODE','DATA','BSS',
|
||||||
|
'','','','','','','','',
|
||||||
|
'')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_dbg;
|
id : as_i386_dbg;
|
||||||
@ -543,7 +589,12 @@ implementation
|
|||||||
asmcmd : '';
|
asmcmd : '';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : 'L';
|
labelprefix : 'L';
|
||||||
comment : ''
|
comment : '';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_coff;
|
id : as_i386_coff;
|
||||||
@ -552,7 +603,12 @@ implementation
|
|||||||
asmcmd : '';
|
asmcmd : '';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : ''
|
comment : '';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_i386_pecoff;
|
id : as_i386_pecoff;
|
||||||
@ -561,7 +617,12 @@ implementation
|
|||||||
asmcmd : '';
|
asmcmd : '';
|
||||||
externals : true;
|
externals : true;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : ''
|
comment : '';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
{$endif i386}
|
{$endif i386}
|
||||||
{$ifdef m68k}
|
{$ifdef m68k}
|
||||||
@ -572,7 +633,12 @@ implementation
|
|||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '# '
|
comment : '# ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_m68k_gas;
|
id : as_m68k_gas;
|
||||||
@ -581,7 +647,12 @@ implementation
|
|||||||
asmcmd : '--register-prefix-optional -o $OBJ $ASM';
|
asmcmd : '--register-prefix-optional -o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '| '
|
comment : '| ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_m68k_mit;
|
id : as_m68k_mit;
|
||||||
@ -590,7 +661,12 @@ implementation
|
|||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '.L';
|
labelprefix : '.L';
|
||||||
comment : '| '
|
comment : '| ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_m68k_mot;
|
id : as_m68k_mot;
|
||||||
@ -599,7 +675,12 @@ implementation
|
|||||||
asmcmd : '-o $OBJ $ASM';
|
asmcmd : '-o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '__L';
|
labelprefix : '__L';
|
||||||
comment : '| '
|
comment : '| ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
,(
|
,(
|
||||||
id : as_m68k_mpw;
|
id : as_m68k_mpw;
|
||||||
@ -608,7 +689,12 @@ implementation
|
|||||||
asmcmd : '-model far -o $OBJ $ASM';
|
asmcmd : '-model far -o $OBJ $ASM';
|
||||||
externals : false;
|
externals : false;
|
||||||
labelprefix : '__L';
|
labelprefix : '__L';
|
||||||
comment : '| '
|
comment : '| ';
|
||||||
|
secnames : ('',
|
||||||
|
'.text','.data','.bss',
|
||||||
|
'.stab','.stabstr',
|
||||||
|
'.idata$2','.idata$4','.idata$5','.idata$6','.idata$7','.edata',
|
||||||
|
'.fake')
|
||||||
)
|
)
|
||||||
{$endif m68k}
|
{$endif m68k}
|
||||||
);
|
);
|
||||||
@ -1369,7 +1455,11 @@ begin
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.67 1999-05-01 14:18:12 peter
|
Revision 1.68 1999-05-02 22:41:59 peter
|
||||||
|
* moved section names to systems
|
||||||
|
* fixed nasm,intel writer
|
||||||
|
|
||||||
|
Revision 1.67 1999/05/01 14:18:12 peter
|
||||||
* win32 pecoff disabled because it's still not ok
|
* win32 pecoff disabled because it's still not ok
|
||||||
|
|
||||||
Revision 1.66 1999/05/01 13:24:44 peter
|
Revision 1.66 1999/05/01 13:24:44 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user