浏览代码

+ handle 0 operand instructions in the z80 asm reader

git-svn-id: branches/z80@44802 -
nickysn 5 年之前
父节点
当前提交
383e834324
共有 1 个文件被更改,包括 35 次插入1 次删除
  1. 35 1
      compiler/z80/raz80asm.pas

+ 35 - 1
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);