diff --git a/compiler/ogrel.pas b/compiler/ogrel.pas index bb4a2b4493..0fcd1cf412 100644 --- a/compiler/ogrel.pas +++ b/compiler/ogrel.pas @@ -314,7 +314,10 @@ implementation '.ARM.attributes' ); begin - result:=secnames[atype]; + if atype=sec_user then + result:=aname + else + result:=secnames[atype]; end; function TRelObjData.sectiontype2align(atype:TAsmSectiontype):longint; diff --git a/compiler/z80/agsdasz80.pas b/compiler/z80/agsdasz80.pas index 4394211751..64993ea1c9 100644 --- a/compiler/z80/agsdasz80.pas +++ b/compiler/z80/agsdasz80.pas @@ -310,7 +310,10 @@ unit agsdasz80; '.ARM.attributes' ); begin - result:=secnames[atype]; + if atype=sec_user then + result:=aname + else + result:=secnames[atype]; end; procedure TSdccSdasZ80Assembler.WriteSection(atype: TAsmSectiontype; diff --git a/compiler/z80/agz80vasm.pas b/compiler/z80/agz80vasm.pas index 15eecfe14d..7baf1e1fa5 100644 --- a/compiler/z80/agz80vasm.pas +++ b/compiler/z80/agz80vasm.pas @@ -328,7 +328,10 @@ unit agz80vasm; var sep: string[3]; begin - result:=secnames[atype]; + if atype=sec_user then + result:=aname + else + result:=secnames[atype]; if (aname<>'') then begin diff --git a/compiler/z80/raz80asm.pas b/compiler/z80/raz80asm.pas index e584fcca30..39c52f8e14 100644 --- a/compiler/z80/raz80asm.pas +++ b/compiler/z80/raz80asm.pas @@ -40,7 +40,7 @@ Unit raz80asm; AS_HASH,AS_LSBRACKET,AS_RSBRACKET,AS_LBRACKET,AS_RBRACKET, AS_EQUAL, {------------------ Assembler directives --------------------} - AS_DEFB,AS_DEFW,AS_END, + AS_DEFB,AS_DEFW,AS_AREA,AS_END, {------------------ 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_RELTYPE, // common token for relocation types @@ -61,7 +61,7 @@ Unit raz80asm; ';','identifier','register','opcode','condition','/','$', '#','{','}','[',']', '=', - 'defb','defw','END', + 'defb','defw','area','END', 'TYPE','SIZEOF','VMTOFFSET','%','<<','>>','!','&','|','^','~','@','reltype', 'directive'); @@ -2354,6 +2354,8 @@ Unit raz80asm; function tz80reader.Assemble: tlinkedlist; var hl: tasmlabel; + sectionname: String; + section: tai_section; begin Message1(asmr_d_start_reading,'Z80'); firsttoken:=TRUE; @@ -2420,6 +2422,68 @@ Unit raz80asm; inexpression:=false; 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: begin HandleOpCode;