Browse Source

+ far pointer support in tpointerconstnode

git-svn-id: trunk@24566 -
nickysn 12 years ago
parent
commit
ed29f7a92d
2 changed files with 9 additions and 0 deletions
  1. 4 0
      compiler/globtype.pas
  2. 5 0
      compiler/ncon.pas

+ 4 - 0
compiler/globtype.pas

@@ -103,7 +103,11 @@ interface
          pointer(-1) will result in a pointer with the value
          pointer(-1) will result in a pointer with the value
          $fffffffffffffff on a 32bit machine if the compiler uses
          $fffffffffffffff on a 32bit machine if the compiler uses
          int64 constants internally (JM) }
          int64 constants internally (JM) }
+{$ifdef i8086}
+       TConstPtrUInt = LongWord;  { 32-bit for far pointers support }
+{$else i8086}
        TConstPtrUInt = AWord;
        TConstPtrUInt = AWord;
+{$endif i8086}
 
 
        { Use a variant record to be sure that the array if aligned correctly }
        { Use a variant record to be sure that the array if aligned correctly }
        tdoublerec=record
        tdoublerec=record

+ 5 - 0
compiler/ncon.pas

@@ -724,6 +724,11 @@ implementation
 
 
       begin
       begin
          inherited create(pointerconstn);
          inherited create(pointerconstn);
+{$ifdef i8086}
+         { truncate near pointers }
+         if (def.typ<>pointerdef) or not (tpointerdef(def).x86pointertyp in [x86pt_far,x86pt_huge]) then
+           v := Word(v);
+{$endif i8086}
          value:=v;
          value:=v;
          typedef:=def;
          typedef:=def;
       end;
       end;