From 383e834324c3e69f27745e1f74a74e5c460043f9 Mon Sep 17 00:00:00 2001 From: nickysn Date: Sat, 18 Apr 2020 22:12:43 +0000 Subject: [PATCH] + handle 0 operand instructions in the z80 asm reader git-svn-id: branches/z80@44802 - --- compiler/z80/raz80asm.pas | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/compiler/z80/raz80asm.pas b/compiler/z80/raz80asm.pas index 6a1ab996bd..0f5af017d0 100644 --- a/compiler/z80/raz80asm.pas +++ b/compiler/z80/raz80asm.pas @@ -81,7 +81,8 @@ Unit raz80asm; Function is_asmdirective(const s: string):boolean; function is_register(const s:string):boolean; function is_targetdirective(const s: string):boolean; - //procedure handleopcode;override; + procedure BuildOpCode(instr:TZ80Instruction); + procedure handleopcode; //procedure BuildReference(oper : tz80operand); //procedure BuildOperand(oper : tz80operand); //procedure BuildOpCode(instr : tz80instruction); @@ -784,6 +785,34 @@ Unit raz80asm; end; + procedure tz80reader.BuildOpCode(instr: TZ80Instruction); + begin + instr.opcode:=actopcode; + Consume(AS_OPCODE); + { Zero operand opcode ? } + if actasmtoken in [AS_SEPARATOR,AS_END] then + exit; + end; + + + procedure tz80reader.handleopcode; + var + instr: TZ80Instruction; + begin + instr:=TZ80Instruction.create(TZ80Operand); + BuildOpcode(instr); + with instr do + begin + //CheckNonCommutativeOpcodes; + //AddReferenceSizes; + //SetInstructionOpsize; + //CheckOperandSizes; + ConcatInstruction(curlist); + end; + instr.Free; + end; + + //procedure tz80reader.ReadSym(oper : tz80operand); // var // tempstr, mangledname : string; @@ -1317,6 +1346,11 @@ Unit raz80asm; Consume(AS_SEPARATOR); end; + AS_OPCODE: + begin + HandleOpCode; + end; + else begin Message(asmr_e_syntax_error);