Browse Source

* i8086 far data model implementation of typeconvnode.second_ansistring_to_pchar

git-svn-id: trunk@27248 -
nickysn 11 years ago
parent
commit
2b57a50233
1 changed files with 25 additions and 0 deletions
  1. 25 0
      compiler/i8086/n8086cnv.pas

+ 25 - 0
compiler/i8086/n8086cnv.pas

@@ -33,6 +33,7 @@ interface
        protected
          procedure second_proc_to_procvar;override;
          procedure second_nil_to_methodprocvar;override;
+         procedure second_ansistring_to_pchar;override;
        end;
 
 
@@ -161,6 +162,30 @@ implementation
       end;
 
 
+    procedure t8086typeconvnode.second_ansistring_to_pchar;
+      var
+        l1 : tasmlabel;
+        hr : treference;
+      begin
+        if current_settings.x86memorymodel in x86_far_data_models then
+          begin
+            location_reset(location,LOC_REGISTER,OS_32);
+            current_asmdata.getjumplabel(l1);
+            location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_32);
+            cg.a_load_loc_reg(current_asmdata.CurrAsmList,OS_32,
+              left.location,location.register);
+            cg.a_cmp_const_reg_label(current_asmdata.CurrAsmList,OS_32,OC_NE,0,location.register,l1);
+            { FPC_EMPTYCHAR is a widechar -> 2 bytes }
+            reference_reset(hr,2);
+            hr.symbol:=current_asmdata.RefAsmSymbol('FPC_EMPTYCHAR');
+            cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,hr,location.register);
+            cg.a_label(current_asmdata.CurrAsmList,l1);
+          end
+        else
+          inherited;
+      end;
+
+
 begin
   ctypeconvnode:=t8086typeconvnode
 end.