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

+ implemented Seg() for i8086 (small/tiny memory model)

git-svn-id: branches/i8086@24071 -
nickysn 12 жил өмнө
parent
commit
4d8adbf5ff

+ 25 - 2
compiler/i8086/n8086inl.pas

@@ -26,7 +26,7 @@ unit n8086inl;
 interface
 
     uses
-       nx86inl;
+       nx86inl,node;
 
     type
 
@@ -35,6 +35,10 @@ interface
        ti8086inlinenode = class(tx86inlinenode)
          procedure second_round_real; override;
          procedure second_trunc_real; override;
+
+         function typecheck_seg: tnode; override;
+         function first_seg: tnode; override;
+         procedure second_seg; override;
        private
          procedure load_fpu_location;
        end;
@@ -55,7 +59,7 @@ implementation
     nbas,ncon,ncal,ncnv,nld,ncgutil,
     tgobj,
     cga,cgutils,cgx86,cgobj,hlcgobj,
-    node;
+    htypechk;
 
      procedure ti8086inlinenode.second_round_real;
        begin
@@ -88,6 +92,25 @@ implementation
          tg.UnGetTemp(current_asmdata.CurrAsmList,newcw);
        end;
 
+     function ti8086inlinenode.typecheck_seg: tnode;
+       begin
+         result := nil;
+         resultdef:=u16inttype;
+       end;
+
+     function ti8086inlinenode.first_seg: tnode;
+       begin
+         expectloc:=LOC_REGISTER;
+         result:=nil;
+       end;
+
+     procedure ti8086inlinenode.second_seg;
+       begin
+         location_reset(location,LOC_REGISTER,OS_16);
+         location.register:=cg.getintregister(current_asmdata.CurrAsmList,OS_16);
+         current_asmdata.CurrAsmList.Concat(Taicpu.op_reg_reg(A_MOV,S_W,NR_DS,location.register));
+       end;
+
      procedure ti8086inlinenode.load_fpu_location;
        var
          lnode: tnode;

+ 3 - 0
compiler/ncginl.pas

@@ -59,6 +59,7 @@ interface
           procedure second_setlength; virtual; abstract;
           procedure second_box; virtual; abstract;
           procedure second_popcnt; virtual;
+          procedure second_seg; virtual; abstract;
        end;
 
 implementation
@@ -187,6 +188,8 @@ implementation
                second_box;
             in_popcnt_x:
                second_popcnt;
+            in_seg_x:
+               second_seg;
             else internalerror(9);
          end;
       end;