mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:29:19 +02:00
+ added the 'AREA' directive support to the Z80 inline assembler, that allows
you to define custom sections git-svn-id: trunk@45617 -
This commit is contained in:
parent
3c9a5ff758
commit
c90f78488c
@ -314,6 +314,9 @@ implementation
|
|||||||
'.ARM.attributes'
|
'.ARM.attributes'
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
|
if atype=sec_user then
|
||||||
|
result:=aname
|
||||||
|
else
|
||||||
result:=secnames[atype];
|
result:=secnames[atype];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -310,6 +310,9 @@ unit agsdasz80;
|
|||||||
'.ARM.attributes'
|
'.ARM.attributes'
|
||||||
);
|
);
|
||||||
begin
|
begin
|
||||||
|
if atype=sec_user then
|
||||||
|
result:=aname
|
||||||
|
else
|
||||||
result:=secnames[atype];
|
result:=secnames[atype];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -328,6 +328,9 @@ unit agz80vasm;
|
|||||||
var
|
var
|
||||||
sep: string[3];
|
sep: string[3];
|
||||||
begin
|
begin
|
||||||
|
if atype=sec_user then
|
||||||
|
result:=aname
|
||||||
|
else
|
||||||
result:=secnames[atype];
|
result:=secnames[atype];
|
||||||
|
|
||||||
if (aname<>'') then
|
if (aname<>'') then
|
||||||
|
@ -40,7 +40,7 @@ Unit raz80asm;
|
|||||||
AS_HASH,AS_LSBRACKET,AS_RSBRACKET,AS_LBRACKET,AS_RBRACKET,
|
AS_HASH,AS_LSBRACKET,AS_RSBRACKET,AS_LBRACKET,AS_RBRACKET,
|
||||||
AS_EQUAL,
|
AS_EQUAL,
|
||||||
{------------------ Assembler directives --------------------}
|
{------------------ Assembler directives --------------------}
|
||||||
AS_DEFB,AS_DEFW,AS_END,
|
AS_DEFB,AS_DEFW,AS_AREA,AS_END,
|
||||||
{------------------ Assembler Operators --------------------}
|
{------------------ Assembler Operators --------------------}
|
||||||
AS_TYPE,AS_SIZEOF,AS_VMTOFFSET,AS_MOD,AS_SHL,AS_SHR,AS_NOT,AS_AND,AS_OR,AS_XOR,AS_NOR,AS_AT,
|
AS_TYPE,AS_SIZEOF,AS_VMTOFFSET,AS_MOD,AS_SHL,AS_SHR,AS_NOT,AS_AND,AS_OR,AS_XOR,AS_NOR,AS_AT,
|
||||||
AS_RELTYPE, // common token for relocation types
|
AS_RELTYPE, // common token for relocation types
|
||||||
@ -61,7 +61,7 @@ Unit raz80asm;
|
|||||||
';','identifier','register','opcode','condition','/','$',
|
';','identifier','register','opcode','condition','/','$',
|
||||||
'#','{','}','[',']',
|
'#','{','}','[',']',
|
||||||
'=',
|
'=',
|
||||||
'defb','defw','END',
|
'defb','defw','area','END',
|
||||||
'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','reltype',
|
'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','reltype',
|
||||||
'directive');
|
'directive');
|
||||||
|
|
||||||
@ -2354,6 +2354,8 @@ Unit raz80asm;
|
|||||||
function tz80reader.Assemble: tlinkedlist;
|
function tz80reader.Assemble: tlinkedlist;
|
||||||
var
|
var
|
||||||
hl: tasmlabel;
|
hl: tasmlabel;
|
||||||
|
sectionname: String;
|
||||||
|
section: tai_section;
|
||||||
begin
|
begin
|
||||||
Message1(asmr_d_start_reading,'Z80');
|
Message1(asmr_d_start_reading,'Z80');
|
||||||
firsttoken:=TRUE;
|
firsttoken:=TRUE;
|
||||||
@ -2420,6 +2422,68 @@ Unit raz80asm;
|
|||||||
inexpression:=false;
|
inexpression:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AS_AREA :
|
||||||
|
begin
|
||||||
|
Consume(AS_AREA);
|
||||||
|
sectionname:=actasmpattern;
|
||||||
|
{secflags:=[];
|
||||||
|
secprogbits:=SPB_None;}
|
||||||
|
Consume(AS_STRING);
|
||||||
|
{if actasmtoken=AS_COMMA then
|
||||||
|
begin
|
||||||
|
Consume(AS_COMMA);
|
||||||
|
if actasmtoken=AS_STRING then
|
||||||
|
begin
|
||||||
|
case actasmpattern of
|
||||||
|
'a':
|
||||||
|
Include(secflags,SF_A);
|
||||||
|
'w':
|
||||||
|
Include(secflags,SF_W);
|
||||||
|
'x':
|
||||||
|
Include(secflags,SF_X);
|
||||||
|
'':
|
||||||
|
;
|
||||||
|
else
|
||||||
|
Message(asmr_e_syntax_error);
|
||||||
|
end;
|
||||||
|
Consume(AS_STRING);
|
||||||
|
if actasmtoken=AS_COMMA then
|
||||||
|
begin
|
||||||
|
Consume(AS_COMMA);
|
||||||
|
if (actasmtoken=AS_MOD) or (actasmtoken=AS_AT) then
|
||||||
|
begin
|
||||||
|
Consume(actasmtoken);
|
||||||
|
if actasmtoken=AS_ID then
|
||||||
|
begin
|
||||||
|
case actasmpattern of
|
||||||
|
'PROGBITS':
|
||||||
|
secprogbits:=SPB_PROGBITS;
|
||||||
|
'NOBITS':
|
||||||
|
secprogbits:=SPB_NOBITS;
|
||||||
|
'NOTE':
|
||||||
|
secprogbits:=SPB_NOTE;
|
||||||
|
else
|
||||||
|
Message(asmr_e_syntax_error);
|
||||||
|
end;
|
||||||
|
Consume(AS_ID);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Message(asmr_e_syntax_error);
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Message(asmr_e_syntax_error);
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
Message(asmr_e_syntax_error);
|
||||||
|
end;}
|
||||||
|
|
||||||
|
//curList.concat(tai_section.create(sec_user, actasmpattern, 0));
|
||||||
|
section:=new_section(curlist, sec_user, sectionname, 0);
|
||||||
|
//section.secflags:=secflags;
|
||||||
|
//section.secprogbits:=secprogbits;
|
||||||
|
end;
|
||||||
|
|
||||||
AS_OPCODE:
|
AS_OPCODE:
|
||||||
begin
|
begin
|
||||||
HandleOpCode;
|
HandleOpCode;
|
||||||
|
Loading…
Reference in New Issue
Block a user