+ support the OFFSET directive in the Z80 inline assembler reader

git-svn-id: trunk@45618 -
This commit is contained in:
nickysn 2020-06-07 22:17:10 +00:00
parent c90f78488c
commit 09bd361b48

View File

@ -42,7 +42,7 @@ Unit raz80asm;
{------------------ Assembler directives --------------------} {------------------ Assembler directives --------------------}
AS_DEFB,AS_DEFW,AS_AREA,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_OFFSET,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
{------------------ Target-specific directive ---------------} {------------------ Target-specific directive ---------------}
AS_TARGET_DIRECTIVE AS_TARGET_DIRECTIVE
@ -62,7 +62,7 @@ Unit raz80asm;
'#','{','}','[',']', '#','{','}','[',']',
'=', '=',
'defb','defw','area','END', 'defb','defw','area','END',
'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','reltype', 'TYPE','OFFSET','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','reltype',
'directive'); 'directive');
type type
@ -303,6 +303,11 @@ Unit raz80asm;
actasmtoken:=AS_TYPE; actasmtoken:=AS_TYPE;
exit; exit;
end; end;
if actasmpattern = 'OFFSET' then
begin
actasmtoken:=AS_OFFSET;
exit;
end;
if actasmpattern = 'SIZEOF' then if actasmpattern = 'SIZEOF' then
begin begin
actasmtoken:=AS_SIZEOF; actasmtoken:=AS_SIZEOF;
@ -1153,15 +1158,15 @@ Unit raz80asm;
Message(asmr_e_seg_without_identifier); Message(asmr_e_seg_without_identifier);
end; end;
{$endif i8086} {$endif i8086}
AS_VMTOFFSET{, AS_VMTOFFSET,
AS_OFFSET}: AS_OFFSET:
begin begin
{if (actasmtoken = AS_OFFSET) then if (actasmtoken = AS_OFFSET) then
begin begin
include(in_flags,cseif_needofs); include(in_flags,cseif_needofs);
include(out_flags,cseof_hasofs); include(out_flags,cseof_hasofs);
end end
else} else
needvmtofs:=true; needvmtofs:=true;
Consume(actasmtoken); Consume(actasmtoken);
if actasmtoken<>AS_ID then if actasmtoken<>AS_ID then
@ -1349,14 +1354,13 @@ Unit raz80asm;
if actasmtoken<>AS_DOT then if actasmtoken<>AS_DOT then
delete(expr,length(expr),1); delete(expr,length(expr),1);
end end
else if (cseif_needofs in in_flags) then
begin
if (prevtok<>AS_OFFSET) then
Message(asmr_e_need_offset);
end
else else
//if (cseif_needofs in in_flags) then Message(asmr_e_only_add_relocatable_symbol);
// begin
// if (prevtok<>AS_OFFSET) then
// Message(asmr_e_need_offset);
// end
//else
Message(asmr_e_only_add_relocatable_symbol);
end; end;
if (actasmtoken=AS_DOT) or if (actasmtoken=AS_DOT) or
(assigned(sym) and (assigned(sym) and
@ -1836,11 +1840,11 @@ Unit raz80asm;
GotStar:=false; GotStar:=false;
end; end;
//AS_OFFSET : AS_OFFSET :
// begin begin
// Consume(AS_OFFSET); Consume(AS_OFFSET);
// GotOffset:=true; GotOffset:=true;
// end; end;
AS_TYPE, AS_TYPE,
AS_NOT, AS_NOT,
@ -2001,7 +2005,7 @@ Unit raz80asm;
begin begin
repeat repeat
case actasmtoken of case actasmtoken of
//AS_OFFSET, AS_OFFSET,
AS_SIZEOF, AS_SIZEOF,
AS_VMTOFFSET, AS_VMTOFFSET,
AS_TYPE, AS_TYPE,