Browse Source

* emit 16-bit addresses on i8086 for asm codes &64..&66 in the internal asm

git-svn-id: trunk@30580 -
nickysn 10 years ago
parent
commit
bd460eec43
1 changed files with 14 additions and 2 deletions
  1. 14 2
      compiler/x86/aasmcpu.pas

+ 14 - 2
compiler/x86/aasmcpu.pas

@@ -2255,10 +2255,15 @@ implementation
             &54,&55,&56:
             &54,&55,&56:
               inc(len,8);
               inc(len,8);
             &40,&41,&42,
             &40,&41,&42,
-            &64,&65,&66,
             &70,&71,&72,
             &70,&71,&72,
             &254,&255,&256 :
             &254,&255,&256 :
               inc(len,4);
               inc(len,4);
+            &64,&65,&66:
+{$ifdef i8086}
+              inc(len,2);
+{$else i8086}
+              inc(len,4);
+{$endif i8086}
             &74,&75,&76,&77: ; // ignore vex-coded operand-idx
             &74,&75,&76,&77: ; // ignore vex-coded operand-idx
             &320,&321,&322 :
             &320,&321,&322 :
               begin
               begin
@@ -2927,13 +2932,20 @@ implementation
                 else
                 else
                   objdata.writebytes(currval,8);
                   objdata.writebytes(currval,8);
               end;
               end;
-            &64,&65,&66 :  // 064..066 - select between 16/32 address mode, but we support only 32
+            &64,&65,&66 :  // 064..066 - select between 16/32 address mode, but we support only 32 (only 16 on i8086)
               begin
               begin
                 getvalsym(c-&64);
                 getvalsym(c-&64);
+{$ifdef i8086}
+                if assigned(currsym) then
+                 objdata_writereloc(currval,2,currsym,currrelreloc)
+                else
+                 objdata_writereloc(currval-insend,2,nil,currabsreloc)
+{$else i8086}
                 if assigned(currsym) then
                 if assigned(currsym) then
                  objdata_writereloc(currval,4,currsym,currrelreloc)
                  objdata_writereloc(currval,4,currsym,currrelreloc)
                 else
                 else
                  objdata_writereloc(currval-insend,4,nil,currabsreloc32)
                  objdata_writereloc(currval-insend,4,nil,currabsreloc32)
+{$endif i8086}
               end;
               end;
             &70,&71,&72 :  // 070..072 - long relative operand
             &70,&71,&72 :  // 070..072 - long relative operand
               begin
               begin