mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-14 21:09:08 +02:00
* some ait_string and ait_const asm output fixes for sdcc-sdasz80
git-svn-id: branches/z80@44446 -
This commit is contained in:
parent
377f52ee69
commit
8589227fb0
@ -60,7 +60,7 @@ unit agsdasz80;
|
|||||||
line_length = 70;
|
line_length = 70;
|
||||||
max_tokens : longint = 25;
|
max_tokens : longint = 25;
|
||||||
ait_const2str : array[aitconst_128bit..aitconst_64bit_unaligned] of string[20]=(
|
ait_const2str : array[aitconst_128bit..aitconst_64bit_unaligned] of string[20]=(
|
||||||
#9''#9,#9'DQ'#9,#9'DD'#9,#9'DW'#9,#9'DB'#9,
|
#9''#9,#9'DQ'#9,#9'DD'#9,#9'.dw'#9,#9'.db'#9,
|
||||||
#9'FIXMESLEB',#9'FIXEMEULEB',
|
#9'FIXMESLEB',#9'FIXEMEULEB',
|
||||||
#9'DD RVA'#9,#9'DD SECREL32'#9,
|
#9'DD RVA'#9,#9'DD SECREL32'#9,
|
||||||
#9'FIXME',#9'FIXME',#9'FIXME',#9'FIXME',
|
#9'FIXME',#9'FIXME',#9'FIXME',#9'FIXME',
|
||||||
@ -188,9 +188,10 @@ unit agsdasz80;
|
|||||||
var
|
var
|
||||||
hp: tai;
|
hp: tai;
|
||||||
s: string;
|
s: string;
|
||||||
counter,lines,i,j,l,tokens: longint;
|
counter,lines,i,j,l,tokens,pos: longint;
|
||||||
quoted: Boolean;
|
quoted: Boolean;
|
||||||
consttype: taiconst_type;
|
consttype: taiconst_type;
|
||||||
|
ch: Char;
|
||||||
begin
|
begin
|
||||||
if not assigned(p) then
|
if not assigned(p) then
|
||||||
exit;
|
exit;
|
||||||
@ -306,79 +307,32 @@ unit agsdasz80;
|
|||||||
end;
|
end;
|
||||||
ait_string :
|
ait_string :
|
||||||
begin
|
begin
|
||||||
counter := 0;
|
pos:=0;
|
||||||
lines := tai_string(hp).len div line_length;
|
for i:=1 to tai_string(hp).len do
|
||||||
{ separate lines in different parts }
|
begin
|
||||||
if tai_string(hp).len > 0 then
|
if pos=0 then
|
||||||
Begin
|
begin
|
||||||
for j := 0 to lines-1 do
|
writer.AsmWrite(#9'.ascii'#9'"');
|
||||||
begin
|
pos:=20;
|
||||||
writer.AsmWrite(#9#9'DB'#9);
|
end;
|
||||||
quoted:=false;
|
ch:=tai_string(hp).str[i-1];
|
||||||
for i:=counter to counter+line_length-1 do
|
case ch of
|
||||||
begin
|
#0, {This can't be done by range, because a bug in FPC}
|
||||||
{ it is an ascii character. }
|
#1..#31,
|
||||||
if (ord(tai_string(hp).str[i])>31) and
|
#128..#255 : s:='\'+tostr(ord(ch) shr 6)+tostr((ord(ch) and 63) shr 3)+tostr(ord(ch) and 7);
|
||||||
(ord(tai_string(hp).str[i])<127) and
|
'"' : s:='\"';
|
||||||
(tai_string(hp).str[i]<>'"') then
|
'\' : s:='\\';
|
||||||
begin
|
else
|
||||||
if not(quoted) then
|
s:=ch;
|
||||||
begin
|
end;
|
||||||
if i>counter then
|
writer.AsmWrite(s);
|
||||||
writer.AsmWrite(',');
|
inc(pos,length(s));
|
||||||
writer.AsmWrite('"');
|
if (pos>line_length) or (i=tai_string(hp).len) then
|
||||||
end;
|
begin
|
||||||
writer.AsmWrite(tai_string(hp).str[i]);
|
writer.AsmWriteLn('"');
|
||||||
quoted:=true;
|
pos:=0;
|
||||||
end { if > 31 and < 127 and ord('"') }
|
end;
|
||||||
else
|
end;
|
||||||
begin
|
|
||||||
if quoted then
|
|
||||||
writer.AsmWrite('"');
|
|
||||||
if i>counter then
|
|
||||||
writer.AsmWrite(',');
|
|
||||||
quoted:=false;
|
|
||||||
writer.AsmWrite(tostr(ord(tai_string(hp).str[i])));
|
|
||||||
end;
|
|
||||||
end; { end for i:=0 to... }
|
|
||||||
if quoted then writer.AsmWrite('"');
|
|
||||||
writer.AsmWrite(target_info.newline);
|
|
||||||
counter := counter+line_length;
|
|
||||||
end; { end for j:=0 ... }
|
|
||||||
{ do last line of lines }
|
|
||||||
if counter<tai_string(hp).len then
|
|
||||||
writer.AsmWrite(#9#9'DB'#9);
|
|
||||||
quoted:=false;
|
|
||||||
for i:=counter to tai_string(hp).len-1 do
|
|
||||||
begin
|
|
||||||
{ it is an ascii character. }
|
|
||||||
if (ord(tai_string(hp).str[i])>31) and
|
|
||||||
(ord(tai_string(hp).str[i])<128) and
|
|
||||||
(tai_string(hp).str[i]<>'"') then
|
|
||||||
begin
|
|
||||||
if not(quoted) then
|
|
||||||
begin
|
|
||||||
if i>counter then
|
|
||||||
writer.AsmWrite(',');
|
|
||||||
writer.AsmWrite('"');
|
|
||||||
end;
|
|
||||||
writer.AsmWrite(tai_string(hp).str[i]);
|
|
||||||
quoted:=true;
|
|
||||||
end { if > 31 and < 128 and " }
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
if quoted then
|
|
||||||
writer.AsmWrite('"');
|
|
||||||
if i>counter then
|
|
||||||
writer.AsmWrite(',');
|
|
||||||
quoted:=false;
|
|
||||||
writer.AsmWrite(tostr(ord(tai_string(hp).str[i])));
|
|
||||||
end;
|
|
||||||
end; { end for i:=0 to... }
|
|
||||||
if quoted then
|
|
||||||
writer.AsmWrite('"');
|
|
||||||
end;
|
|
||||||
writer.AsmLn;
|
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user