Browse Source

+ handle OT_IMM8 and OT_IMM16 for getting symbol addresses in taicpu.Matches

git-svn-id: trunk@45185 -
nickysn 5 năm trước cách đây
mục cha
commit
34112c932c
1 tập tin đã thay đổi với 8 bổ sung4 xóa
  1. 8 4
      compiler/z80/aasmcpu.pas

+ 8 - 4
compiler/z80/aasmcpu.pas

@@ -205,11 +205,15 @@ implementation
             OT_IMM3:
               result:=(oper.typ=top_const) and (oper.val>=0) and (oper.val<=7);
             OT_IMM8:
-              { todo: lo8, hi8 addresses }
-              result:=(oper.typ=top_const) and (oper.val>=0) and (oper.val<=255);
+              result:=((oper.typ=top_const) and (oper.val>=0) and (oper.val<=255)) or
+                      ((oper.typ=top_ref) and
+                       (oper.ref^.refaddr in [addr_hi8,addr_lo8]) and assigned(oper.ref^.symbol) and
+                       (oper.ref^.base=NR_NO) and (oper.ref^.index=NR_NO));
             OT_IMM16:
-              { todo: addresses }
-              result:=(oper.typ=top_const) and (oper.val>=0) and (oper.val<=65535);
+              result:=((oper.typ=top_const) and (oper.val>=0) and (oper.val<=65535)) or
+                      ((oper.typ=top_ref) and
+                       (oper.ref^.refaddr=addr_full) and assigned(oper.ref^.symbol) and
+                       (oper.ref^.base=NR_NO) and (oper.ref^.index=NR_NO));
             OT_IMM_VAL0:
               result:=(oper.typ=top_const) and (oper.val=0);
             OT_IMM_VAL1: