* fix for jmps to be always near

* string writing fixed
This commit is contained in:
peter 1999-09-13 16:27:24 +00:00
parent 8a6774104d
commit 1163717044

View File

@ -50,7 +50,7 @@ unit ag386nsm;
;
const
line_length = 70;
line_length = 64;
{$ifdef EXTTYPE}
extstr : array[EXT_NEAR..EXT_ABS] of String[8] =
@ -270,7 +270,7 @@ unit ag386nsm;
else
if o.symofs<0 then
hs:=hs+tostr(o.symofs);
getopstr_jmp:=hs;
getopstr_jmp:='NEAR '+hs;
end;
else
internalerror(10001);
@ -352,7 +352,8 @@ unit ag386nsm;
tostr(paitempalloc(hp)^.tempsize)+allocstr[paitempalloc(hp)^.allocation]);
end;
ait_section : begin
ait_section :
begin
if pai_section(hp)^.sec<>sec_none then
begin
AsmLn;
@ -360,15 +361,25 @@ unit ag386nsm;
end;
LastSec:=pai_section(hp)^.sec;
end;
ait_align : AsmWriteLn(#9'ALIGN '+tostr(pai_align(hp)^.aligntype));
ait_datablock : begin
ait_align :
AsmWriteLn(#9'ALIGN '+tostr(pai_align(hp)^.aligntype));
ait_datablock :
begin
if pai_datablock(hp)^.is_global then
AsmWriteLn(#9'GLOBAL '+pai_datablock(hp)^.sym^.name);
AsmWriteLn(PadTabs(pai_datablock(hp)^.sym^.name,':')+'RESB'#9+tostr(pai_datablock(hp)^.size));
begin
AsmWrite(#9'GLOBAL ');
AsmWriteLn(pai_datablock(hp)^.sym^.name);
end;
AsmWrite(PadTabs(pai_datablock(hp)^.sym^.name,':'));
AsmWriteLn('RESB'#9+tostr(pai_datablock(hp)^.size));
end;
ait_const_32bit,
ait_const_8bit,
ait_const_16bit : begin
ait_const_16bit,
ait_const_8bit :
begin
AsmWrite(ait_const2str[hp^.typ]+tostr(pai_const(hp)^.value));
consttyp:=hp^.typ;
l:=0;
@ -384,22 +395,38 @@ unit ag386nsm;
until (not found) or (l>line_length);
AsmLn;
end;
ait_const_symbol : begin
AsmWriteLn(#9#9'DD'#9+pai_const_symbol(hp)^.sym^.name);
ait_const_symbol :
begin
AsmWrite(#9#9'DD'#9);
AsmWrite(pai_const_symbol(hp)^.sym^.name);
if pai_const_symbol(hp)^.offset>0 then
AsmWrite('+'+tostr(pai_const_symbol(hp)^.offset))
else if pai_const_symbol(hp)^.offset<0 then
AsmWrite(tostr(pai_const_symbol(hp)^.offset));
AsmLn;
end;
ait_const_rva : begin
AsmWriteLn(#9#9'RVA'#9+pai_const_symbol(hp)^.sym^.name);
ait_const_rva :
begin
AsmWrite(#9#9'RVA'#9);
AsmWriteLn(pai_const_symbol(hp)^.sym^.name);
end;
ait_real_32bit : AsmWriteLn(#9#9'DD'#9+single2str(pai_real_32bit(hp)^.value));
ait_real_64bit : AsmWriteLn(#9#9'DQ'#9+double2str(pai_real_64bit(hp)^.value));
ait_real_80bit : AsmWriteLn(#9#9'DT'#9+extended2str(pai_real_80bit(hp)^.value));
ait_comp_64bit : AsmWriteLn(#9#9'DQ'#9+comp2str(pai_real_80bit(hp)^.value));
ait_string : begin
ait_real_32bit :
AsmWriteLn(#9#9'DD'#9+single2str(pai_real_32bit(hp)^.value));
ait_real_64bit :
AsmWriteLn(#9#9'DQ'#9+double2str(pai_real_64bit(hp)^.value));
ait_real_80bit :
AsmWriteLn(#9#9'DT'#9+extended2str(pai_real_80bit(hp)^.value));
ait_comp_64bit :
AsmWriteLn(#9#9'DQ'#9+comp2str(pai_real_80bit(hp)^.value));
ait_string :
begin
counter := 0;
lines := pai_string(hp)^.len div line_length;
{ separate lines in different parts }
@ -409,7 +436,7 @@ unit ag386nsm;
begin
AsmWrite(#9#9'DB'#9);
quoted:=false;
for i:=counter to counter+line_length do
for i:=counter to counter+line_length-1 do
begin
{ it is an ascii character. }
if (ord(pai_string(hp)^.str[i])>31) and
@ -437,7 +464,7 @@ unit ag386nsm;
end; { end for i:=0 to... }
if quoted then AsmWrite('"');
AsmWrite(target_os.newline);
counter := counter+line_length;
inc(counter,line_length);
end; { end for j:=0 ... }
{ do last line of lines }
AsmWrite(#9#9'DB'#9);
@ -473,17 +500,26 @@ unit ag386nsm;
end;
AsmLn;
end;
ait_label : begin
ait_label :
begin
if pai_label(hp)^.l^.is_used then
AsmWriteLn(pai_label(hp)^.l^.name+':');
end;
ait_direct : begin
ait_direct :
begin
AsmWritePChar(pai_direct(hp)^.str);
AsmLn;
end;
ait_symbol : begin
ait_symbol :
begin
if pai_symbol(hp)^.is_global then
AsmWriteLn(#9'GLOBAL '+pai_symbol(hp)^.sym^.name);
begin
AsmWrite(#9'GLOBAL ');
AsmWriteLn(pai_symbol(hp)^.sym^.name);
end;
AsmWrite(pai_symbol(hp)^.sym^.name);
if assigned(hp^.next) and not(pai(hp^.next)^.typ in
[ait_const_32bit,ait_const_16bit,ait_const_8bit,
@ -491,10 +527,13 @@ unit ag386nsm;
ait_real_32bit,ait_real_64bit,ait_real_80bit,ait_comp_64bit,ait_string]) then
AsmWriteLn(':')
end;
ait_symbol_end :
begin
end;
ait_instruction : begin
ait_instruction :
begin
{ We need intel order, no At&t }
paicpu(hp)^.SwapOperands;
{ Reset }
@ -530,7 +569,9 @@ unit ag386nsm;
ait_force_line,
ait_stab_function_name : ;
{$endif GDB}
ait_cut : begin
ait_cut :
begin
{ only reset buffer if nothing has changed }
if AsmSize=AsmStartSize then
AsmClear
@ -553,7 +594,9 @@ ait_stab_function_name : ;
AsmWriteLn('SECTION '+target_asm.secnames[lastsec]);
AsmStartSize:=AsmSize;
end;
ait_marker : ;
else
internalerror(10000);
end;
@ -574,11 +617,7 @@ ait_stab_function_name : ;
procedure ti386nasmasmlist.WriteExternals;
begin
currentasmlist:=@self;
{$ifdef Delphi}
AsmSymbolList^.foreach(@writeexternal);
{$else}
AsmSymbolList^.foreach({$ifndef TP}@{$endif}writeexternal);
{$endif Delphi}
end;
@ -617,7 +656,11 @@ ait_stab_function_name : ;
end.
{
$Log$
Revision 1.51 1999-09-10 15:41:18 peter
Revision 1.52 1999-09-13 16:27:24 peter
* fix for jmps to be always near
* string writing fixed
Revision 1.51 1999/09/10 15:41:18 peter
* added symbol_end
Revision 1.50 1999/09/02 18:47:43 daniel