2
0
Эх сурвалжийг харах

+ added support for far pointer constants in the assembly output

git-svn-id: trunk@24854 -
nickysn 12 жил өмнө
parent
commit
e4a1230356

+ 9 - 2
compiler/aasmtai.pas

@@ -138,7 +138,9 @@ interface
           { for use by dwarf debugger information }
           { for use by dwarf debugger information }
           aitconst_16bit_unaligned,
           aitconst_16bit_unaligned,
           aitconst_32bit_unaligned,
           aitconst_32bit_unaligned,
-          aitconst_64bit_unaligned
+          aitconst_64bit_unaligned,
+          { i8086 far pointer }
+          aitconst_farptr
         );
         );
 
 
     const
     const
@@ -1628,7 +1630,12 @@ implementation
       begin
       begin
          inherited Create;
          inherited Create;
          typ:=ait_const;
          typ:=ait_const;
-         consttype:=aitconst_ptr;
+{$ifdef i8086}
+         if current_settings.x86memorymodel in x86_far_code_models then
+           consttype:=aitconst_farptr
+         else
+{$endif i8086}
+           consttype:=aitconst_ptr;
          { sym is allowed to be nil, this is used to write nil pointers }
          { sym is allowed to be nil, this is used to write nil pointers }
          sym:=_sym;
          sym:=_sym;
          endsym:=nil;
          endsym:=nil;

+ 19 - 0
compiler/x86/agx86nsm.pas

@@ -667,6 +667,25 @@ interface
                  aitconst_128bit:
                  aitconst_128bit:
                     begin
                     begin
                     end;
                     end;
+{$ifdef i8086}
+                 aitconst_farptr:
+                   begin
+                     AsmWrite(ait_const2str[aitconst_16bit]);
+                     if assigned(tai_const(hp).sym) then
+                       begin
+                         if SmartAsm then
+                           AddSymbol(tai_const(hp).sym.name,false);
+                         s:=tai_const(hp).sym.name;
+                         if tai_const(hp).value<>0 then
+                           s:=s+tostr_with_plus(tai_const(hp).value);
+                         s:=s+',SEG '+tai_const(hp).sym.name;
+                       end
+                     else
+                       s:=tostr(lo(longint(tai_const(hp).value)))+','+
+                          tostr(hi(longint(tai_const(hp).value)));
+                     AsmWriteLn(s);
+                   end;
+{$endif i8086}
                  aitconst_32bit,
                  aitconst_32bit,
                  aitconst_16bit,
                  aitconst_16bit,
                  aitconst_8bit,
                  aitconst_8bit,