diff --git a/compiler/aasmtai.pas b/compiler/aasmtai.pas index e24cac6c02..8a47384b47 100644 --- a/compiler/aasmtai.pas +++ b/compiler/aasmtai.pas @@ -138,7 +138,9 @@ interface { for use by dwarf debugger information } aitconst_16bit_unaligned, aitconst_32bit_unaligned, - aitconst_64bit_unaligned + aitconst_64bit_unaligned, + { i8086 far pointer } + aitconst_farptr ); const @@ -1628,7 +1630,12 @@ implementation begin inherited Create; 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:=_sym; endsym:=nil; diff --git a/compiler/x86/agx86nsm.pas b/compiler/x86/agx86nsm.pas index 72b6bdc964..fa8412120e 100644 --- a/compiler/x86/agx86nsm.pas +++ b/compiler/x86/agx86nsm.pas @@ -667,6 +667,25 @@ interface aitconst_128bit: begin 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_16bit, aitconst_8bit,