瀏覽代碼

* assembler writers fixed for ag386bin

peter 26 年之前
父節點
當前提交
a17c03cca3
共有 10 個文件被更改,包括 655 次插入325 次删除
  1. 173 26
      compiler/ag386int.pas
  2. 192 40
      compiler/ag386nsm.pas
  3. 9 12
      compiler/assemble.pas
  4. 5 1
      compiler/compiler.pas
  5. 15 12
      compiler/csopt386.pas
  6. 18 15
      compiler/daopt386.pas
  7. 56 54
      compiler/i386.pas
  8. 153 150
      compiler/popt386.pas
  9. 9 1
      compiler/pstatmnt.pas
  10. 25 14
      compiler/systems.pas

+ 173 - 26
compiler/ag386int.pas

@@ -39,7 +39,12 @@ unit ag386int;
   implementation
 
     uses
-      dos,globals,systems,cobjects,i386,
+      dos,globals,systems,cobjects,
+{$ifdef AG386BIN}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
       strings,files,verbose
 {$ifdef GDB}
       ,gdb
@@ -109,7 +114,10 @@ unit ag386int;
       first : boolean;
     begin
       if ref.is_immediate then
-       s:= tostr(ref.offset)
+       begin
+         getreferencestring:=tostr(ref.offset);
+         exit;
+       end
       else
       with ref do
         begin
@@ -150,6 +158,90 @@ unit ag386int;
        getreferencestring:=s;
      end;
 
+{$ifdef AG386BIN}
+    function getopstr(t : byte;o : pointer;s : topsize; _operator: tasmop;dest : boolean) : string;
+    var
+      hs : string;
+    begin
+      if (t and OT_REGISTER)=OT_REGISTER then
+        getopstr:=int_reg2str[tregister(o)]
+      else
+       if (t and OT_SYMBOL)=OT_SYMBOL then
+        begin
+          hs:='offset '+pasmsymbol(o)^.name;
+          if preference(o)^.offset>0 then
+           hs:=hs+'+'+tostr(preference(o)^.offset)
+          else
+           if preference(o)^.offset<0 then
+            hs:=hs+tostr(preference(o)^.offset);
+          getopstr:=hs;
+        end
+      else
+       if (t and (OT_IMMEDIATE or OT_MEMORY))<>0 then
+        begin
+          hs:=getreferencestring(preference(o)^);
+          { can possibly give a range check error under tp }
+          { if using in...                                 }
+          if ((_operator <> A_LGS) and (_operator <> A_LSS) and
+              (_operator <> A_LFS) and (_operator <> A_LDS) and
+              (_operator <> A_LES)) then
+           Begin
+             case s of
+              S_B : hs:='byte ptr '+hs;
+              S_W : hs:='word ptr '+hs;
+              S_L : hs:='dword ptr '+hs;
+             S_IS : hs:='word ptr '+hs;
+             S_IL : hs:='dword ptr '+hs;
+             S_IQ : hs:='qword ptr '+hs;
+             S_FS : hs:='dword ptr '+hs;
+             S_FL : hs:='qword ptr '+hs;
+             S_FX : hs:='tbyte ptr '+hs;
+             S_BW : if dest then
+                     hs:='word ptr '+hs
+                    else
+                     hs:='byte ptr '+hs;
+             S_BL : if dest then
+                     hs:='dword ptr '+hs
+                    else
+                     hs:='byte ptr '+hs;
+             S_WL : if dest then
+                     hs:='dword ptr '+hs
+                    else
+                     hs:='word ptr '+hs;
+             end;
+           end;
+          getopstr:=hs;
+        end
+      else
+        internalerror(10001);
+    end;
+
+    function getopstr_jmp(t : byte;o : pointer) : string;
+    var
+      hs : string;
+    begin
+      if (t and OT_REGISTER)=OT_REGISTER then
+       getopstr_jmp:=int_reg2str[tregister(o)]
+      else
+       if (t and OT_SYMBOL)=OT_SYMBOL then
+        begin
+          hs:=pasmsymbol(o)^.name;
+          if preference(o)^.offset>0 then
+           hs:=hs+'+'+tostr(preference(o)^.offset)
+          else
+           if preference(o)^.offset<0 then
+            hs:=hs+tostr(preference(o)^.offset);
+          getopstr_jmp:=hs;
+        end
+      else
+       if (t and (OT_MEMORY or OT_IMMEDIATE))<>0 then
+        getopstr_jmp:=getreferencestring(preference(o)^)
+      else
+        internalerror(10001);
+    end;
+
+{$else}
+
     function getopstr(t : byte;o : pointer;opofs:longint;s : topsize; _operator: tasmop;dest : boolean) : string;
     var
       hs : string;
@@ -229,6 +321,7 @@ unit ag386int;
        internalerror(10001);
       end;
     end;
+{$endif}
 
 
 {****************************************************************************
@@ -280,6 +373,9 @@ unit ag386int;
       consttyp : tait;
       found,
       quoted   : boolean;
+{$ifdef AG386Bin}
+      sep      : char;
+{$endif}
     begin
       if not assigned(p) then
        exit;
@@ -441,7 +537,7 @@ unit ag386int;
                        AsmWritePChar(pai_direct(hp)^.str);
                        AsmLn;
                      end;
-ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operator]+#9+lab2str(pai386_labeled(hp)^.lab));
+ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]+#9+lab2str(pai386_labeled(hp)^.lab));
         ait_symbol : begin
                        if pai_symbol(hp)^.is_global then
                          AsmWriteLn(#9'PUBLIC'#9+pai_symbol(hp)^.sym^.name);
@@ -455,14 +551,61 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operat
    ait_instruction : begin
                        suffix:='';
                        prefix:= '';
+{$ifdef AG386BIN}
+                     { added prefix instructions, must be on same line as opcode }
+                       for i:=1to pai386(hp)^.nprefixes do
+                        prefix:=int_prefix2str[pai386(hp)^.prefixes[i-1]]+#9;
+                       if pai386(hp)^.ops<>0 then
+                        begin
+                          if pai386(hp)^.opcode=A_CALL then
+                           s:='dword ptr '+getopstr_jmp(pai386(hp)^.opertype[0],pai386(hp)^.oper[0])
+                          else
+                           begin
+                             for i:=0to pai386(hp)^.ops-1 do
+                              begin
+                                if i=0 then
+                                 sep:=#9
+                                else
+                                 sep:=',';
+                                s:=s+sep+getopstr(pai386(hp)^.opertype[i],pai386(hp)^.oper[i],
+                                  pai386(hp)^.opsize,pai386(hp)^.opcode,(i=1))
+                              end;
+                           end;
+                        end
+                       else
+                        begin
+                          { check if string instruction }
+                          { long form, otherwise may give range check errors }
+                          { in turbo pascal...                               }
+{                          if ((pai386(hp)^.opcode = A_CMPS) or
+                             (pai386(hp)^.opcode = A_INS) or
+                             (pai386(hp)^.opcode = A_OUTS) or
+                             (pai386(hp)^.opcode = A_SCAS) or
+                             (pai386(hp)^.opcode = A_STOS) or
+                             (pai386(hp)^.opcode = A_MOVS) or
+                             (pai386(hp)^.opcode = A_LODS) or
+                             (pai386(hp)^.opcode = A_XLAT)) then
+                           Begin
+                             case pai386(hp)^.opsize of
+                              S_B: suffix:='b';
+                              S_W: suffix:='w';
+                              S_L: suffix:='d';
+                             else
+                              Message(assem_f_invalid_suffix_intel);
+                             end;
+                           end; }
+                          s:='';
+                        end;
+                       AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+cond2str[pai386_labeled(hp)^.condition]+suffix+s);
+{$else}
                      { added prefix instructions, must be on same line as opcode }
                        if (pai386(hp)^.op1t = top_none) and
-                          ((pai386(hp)^._operator = A_REP) or
-                           (pai386(hp)^._operator = A_LOCK) or
-                           (pai386(hp)^._operator =  A_REPE) or
-                           (pai386(hp)^._operator = A_REPNE)) then
+                          ((pai386(hp)^.opcode = A_REP) or
+                           (pai386(hp)^.opcode = A_LOCK) or
+                           (pai386(hp)^.opcode =  A_REPE) or
+                           (pai386(hp)^.opcode = A_REPNE)) then
                         Begin
-                          prefix:=int_op2str[pai386(hp)^._operator]+#9;
+                          prefix:=int_op2str[pai386(hp)^.opcode]+#9;
                           hp:=Pai(hp^.next);
                         { this is theorically impossible... }
                           if hp=nil then
@@ -476,7 +619,7 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operat
                         prefix:= '';
                        if pai386(hp)^.op1t<>top_none then
                         begin
-                          if pai386(hp)^._operator=A_CALL then
+                          if pai386(hp)^.opcode=A_CALL then
                            begin
                            { with tasm call near ptr [edi+12] does not
                              work but call near [edi+12] works ?? (PM)
@@ -492,20 +635,20 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operat
                            end
                           else
                            begin
-                             s:=getopstr(pai386(hp)^.op1t,pai386(hp)^.op1,pai386(hp)^.op1ofs,pai386(hp)^.size,
-                               pai386(hp)^._operator,false);
+                             s:=getopstr(pai386(hp)^.op1t,pai386(hp)^.op1,pai386(hp)^.op1ofs,pai386(hp)^.opsize,
+                               pai386(hp)^.opcode,false);
                              if pai386(hp)^.op3t<>top_none then
                               begin
                                 if pai386(hp)^.op2t<>top_none then
                                  s:=getopstr(pai386(hp)^.op2t,pointer(longint(twowords(pai386(hp)^.op2).word1)),0,
-                                             pai386(hp)^.size,pai386(hp)^._operator,true)+','+s;
+                                             pai386(hp)^.opsize,pai386(hp)^.opcode,true)+','+s;
                                 s:=getopstr(pai386(hp)^.op3t,pointer(longint(twowords(pai386(hp)^.op2).word2)),0,
-                                            pai386(hp)^.size,pai386(hp)^._operator,false)+','+s;
+                                            pai386(hp)^.opsize,pai386(hp)^.opcode,false)+','+s;
                               end
                              else
                               if pai386(hp)^.op2t<>top_none then
-                               s:=getopstr(pai386(hp)^.op2t,pai386(hp)^.op2,0,pai386(hp)^.size,
-                                           pai386(hp)^._operator,true)+','+s;
+                               s:=getopstr(pai386(hp)^.op2t,pai386(hp)^.op2,0,pai386(hp)^.opsize,
+                                           pai386(hp)^.opcode,true)+','+s;
                            end;
                           s:=#9+s;
                         end
@@ -514,16 +657,16 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operat
                           { check if string instruction }
                           { long form, otherwise may give range check errors }
                           { in turbo pascal...                               }
-                          if ((pai386(hp)^._operator = A_CMPS) or
-                             (pai386(hp)^._operator = A_INS) or
-                             (pai386(hp)^._operator = A_OUTS) or
-                             (pai386(hp)^._operator = A_SCAS) or
-                             (pai386(hp)^._operator = A_STOS) or
-                             (pai386(hp)^._operator = A_MOVS) or
-                             (pai386(hp)^._operator = A_LODS) or
-                             (pai386(hp)^._operator = A_XLAT)) then
+                          if ((pai386(hp)^.opcode = A_CMPS) or
+                             (pai386(hp)^.opcode = A_INS) or
+                             (pai386(hp)^.opcode = A_OUTS) or
+                             (pai386(hp)^.opcode = A_SCAS) or
+                             (pai386(hp)^.opcode = A_STOS) or
+                             (pai386(hp)^.opcode = A_MOVS) or
+                             (pai386(hp)^.opcode = A_LODS) or
+                             (pai386(hp)^.opcode = A_XLAT)) then
                            Begin
-                             case pai386(hp)^.size of
+                             case pai386(hp)^.opsize of
                               S_B: suffix:='b';
                               S_W: suffix:='w';
                               S_L: suffix:='d';
@@ -533,7 +676,8 @@ ait_labeled_instruction : AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operat
                            end;
                           s:='';
                         end;
-                       AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^._operator]+suffix+s);
+                       AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+suffix+s);
+{$endif AG386BIN}
                      end;
 {$ifdef GDB}
              ait_stabn,
@@ -621,7 +765,10 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.26  1999-02-25 21:02:18  peter
+  Revision 1.27  1999-02-26 00:48:13  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.26  1999/02/25 21:02:18  peter
     * ag386bin updates
     + coff writer
 

+ 192 - 40
compiler/ag386nsm.pas

@@ -40,7 +40,12 @@ unit ag386nsm;
   implementation
 
     uses
-      dos,globals,systems,cobjects,i386,
+      dos,globals,systems,cobjects,
+{$ifdef AG386BIN}
+      i386base,i386asm,
+{$else}
+      i386,
+{$endif}
       strings,files,verbose
 {$ifdef GDB}
       ,gdb
@@ -110,7 +115,10 @@ unit ag386nsm;
       first : boolean;
     begin
       if ref.is_immediate then
-       s:= tostr(ref.offset)
+       begin
+         getreferencestring:=tostr(ref.offset);
+         exit;
+       end
       else
       with ref do
         begin
@@ -151,7 +159,92 @@ unit ag386nsm;
        getreferencestring:=s;
      end;
 
-    function getopstr(t : byte;o : pointer;opofs:longint;s : topsize; _operator: tasmop;dest : boolean) : string;
+{$ifdef AG386BIN}
+    function getopstr(t : byte;o : pointer;s : topsize; opcode: tasmop;dest : boolean) : string;
+    var
+      hs : string;
+    begin
+      if (t and OT_REGISTER)=OT_REGISTER then
+        getopstr:=int_nasmreg2str[tregister(o)]
+      else
+       if (t and OT_SYMBOL)=OT_SYMBOL then
+        begin
+          hs:='dword '+pasmsymbol(o)^.name;
+          if preference(o)^.offset>0 then
+           hs:=hs+'+'+tostr(preference(o)^.offset)
+          else
+           if preference(o)^.offset<0 then
+            hs:=hs+tostr(preference(o)^.offset);
+          getopstr:=hs;
+        end
+      else
+       if (t and (OT_IMMEDIATE or OT_MEMORY))<>0 then
+        begin
+          hs:=getreferencestring(preference(o)^);
+          if not ((opcode = A_LEA) or (opcode = A_LGS) or
+                  (opcode = A_LSS) or (opcode = A_LFS) or
+                  (opcode = A_LES) or (opcode = A_LDS) or
+                  (opcode = A_SHR) or (opcode = A_SHL) or
+                  (opcode = A_SAR) or (opcode = A_SAL) or
+                  (opcode = A_OUT) or (opcode = A_IN)) then
+           begin
+             case s of
+                S_B : hs:='byte '+hs;
+                S_W : hs:='word '+hs;
+                S_L : hs:='dword '+hs;
+                S_IS : hs:='word '+hs;
+                S_IL : hs:='dword '+hs;
+                S_IQ : hs:='qword '+hs;
+                S_FS : hs:='dword '+hs;
+                S_FL : hs:='qword '+hs;
+                S_FX : hs:='tword '+hs;
+                S_BW : if dest then
+                    hs:='word '+hs
+                  else
+                    hs:='byte '+hs;
+                S_BL : if dest then
+                    hs:='dword '+hs
+                  else
+                    hs:='byte '+hs;
+                S_WL : if dest then
+                    hs:='dword '+hs
+                  else
+                    hs:='word '+hs;
+             end
+           end;
+          getopstr:=hs;
+        end
+      else
+        internalerror(10001);
+    end;
+
+    function getopstr_jmp(t : byte;o : pointer) : string;
+    var
+      hs : string;
+    begin
+      if (t and OT_REGISTER)=OT_REGISTER then
+       getopstr_jmp:=int_nasmreg2str[tregister(o)]
+      else
+       if (t and OT_SYMBOL)=OT_SYMBOL then
+        begin
+          hs:=pasmsymbol(o)^.name;
+          if preference(o)^.offset>0 then
+           hs:=hs+'+'+tostr(preference(o)^.offset)
+          else
+           if preference(o)^.offset<0 then
+            hs:=hs+tostr(preference(o)^.offset);
+          getopstr_jmp:=hs;
+        end
+      else
+       if (t and (OT_MEMORY or OT_IMMEDIATE))<>0 then
+        getopstr_jmp:=getreferencestring(preference(o)^)
+      else
+        internalerror(10001);
+    end;
+
+{$else}
+
+    function getopstr(t : byte;o : pointer;opofs:longint;s : topsize; opcode: tasmop;dest : boolean) : string;
     var
       hs : string;
     begin
@@ -163,12 +256,12 @@ unit ag386nsm;
                      hs := tostr(longint(o))
                    else
                      hs:=getreferencestring(preference(o)^);
-                   if not ((_operator = A_LEA) or (_operator = A_LGS) or
-                           (_operator = A_LSS) or (_operator = A_LFS) or
-                           (_operator = A_LES) or (_operator = A_LDS) or
-                           (_operator = A_SHR) or (_operator = A_SHL) or
-                           (_operator = A_SAR) or (_operator = A_SAL) or
-                           (_operator = A_OUT) or (_operator = A_IN)) then
+                   if not ((opcode = A_LEA) or (opcode = A_LGS) or
+                           (opcode = A_LSS) or (opcode = A_LFS) or
+                           (opcode = A_LES) or (opcode = A_LDS) or
+                           (opcode = A_SHR) or (opcode = A_SHL) or
+                           (opcode = A_SAR) or (opcode = A_SAL) or
+                           (opcode = A_OUT) or (opcode = A_IN)) then
                      begin
                        case s of
                           S_B : hs:='byte '+hs;
@@ -232,6 +325,9 @@ unit ag386nsm;
       end;
     end;
 
+{$endif}
+
+
 {****************************************************************************
                                Ti386nasmasmlist
  ****************************************************************************}
@@ -283,6 +379,9 @@ unit ag386nsm;
       consttyp : tait;
       found,
       quoted   : boolean;
+{$ifdef AG386Bin}
+      sep      : char;
+{$endif}
     begin
       if not assigned(p) then
        exit;
@@ -429,13 +528,13 @@ unit ag386nsm;
                      end;
 ait_labeled_instruction :
                      begin
-                       op:=pai386_labeled(hp)^._operator;
+                       op:=pai386_labeled(hp)^.opcode;
                        if not((op=A_JMP) or (op=A_LOOP) or (op=A_LOOPZ) or
                               (op=A_LOOPE) or (op=A_LOOPNZ) or (op=A_LOOPNE) or
                               (op=A_JCXZ) or (op=A_JECXZ)) then
-                        AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operator]+#9+'near '+lab2str(pai386_labeled(hp)^.lab))
+                        AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]+#9+'near '+lab2str(pai386_labeled(hp)^.lab))
                        else
-                        AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^._operator]+#9+lab2str(pai386_labeled(hp)^.lab));
+                        AsmWriteLn(#9#9+int_op2str[pai386_labeled(hp)^.opcode]+#9+lab2str(pai386_labeled(hp)^.lab));
                      end;
         ait_symbol : begin
                        if pai_symbol(hp)^.is_global then
@@ -449,15 +548,64 @@ ait_labeled_instruction :
                      end;
    ait_instruction : begin
                        suffix:='';
-                       prefix:= '';
+                       prefix:='';
+{$ifdef AG386BIN}
+                       for i:=1to pai386(hp)^.nprefixes do
+                        AsmWriteln(int_prefix2str[pai386(hp)^.prefixes[i-1]]);
+                       if pai386(hp)^.ops<>0 then
+                        begin
+                          if pai386(hp)^.opcode=A_CALL then
+                           s:=#9+getopstr_jmp(pai386(hp)^.opertype[0],pai386(hp)^.oper[0])
+                          else
+                           begin
+                             for i:=0to pai386(hp)^.ops-1 do
+                              begin
+                                if i=0 then
+                                 sep:=#9
+                                else
+                                 sep:=',';
+                                s:=s+sep+getopstr(pai386(hp)^.opertype[i],pai386(hp)^.oper[i],
+                                  pai386(hp)^.opsize,pai386(hp)^.opcode,(i=1))
+                              end;
+                           end;
+                        end
+                       else
+                        begin
+                          { check if string instruction }
+                          { long form, otherwise may give range check errors }
+                          { in turbo pascal...                               }
+                       {   if ((pai386(hp)^.opcode = A_CMPS) or
+                             (pai386(hp)^.opcode = A_INS) or
+                             (pai386(hp)^.opcode = A_OUTS) or
+                             (pai386(hp)^.opcode = A_SCAS) or
+                             (pai386(hp)^.opcode = A_STOS) or
+                             (pai386(hp)^.opcode = A_MOVS) or
+                             (pai386(hp)^.opcode = A_LODS) or
+                             (pai386(hp)^.opcode = A_XLAT)) then
+                           Begin
+                             case pai386(hp)^.opsize of
+                              S_B: suffix:='b';
+                              S_W: suffix:='w';
+                              S_L: suffix:='d';
+                             else
+                              Message(assem_f_invalid_suffix_intel);
+                             end;
+                           end; }
+                          s:='';
+                        end;
+                       if pai386(hp)^.opcode=A_FWAIT then
+                        AsmWriteln(#9#9'DB'#9'09bh')
+                       else
+                        AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+cond2str[pai386_labeled(hp)^.condition]+suffix+s);
+{$else}
                      { added prefix instructions, must be on same line as opcode }
                        if (pai386(hp)^.op1t = top_none) and
-                          ((pai386(hp)^._operator = A_REP) or
-                           (pai386(hp)^._operator = A_LOCK) or
-                           (pai386(hp)^._operator =  A_REPE) or
-                           (pai386(hp)^._operator = A_REPNE)) then
+                          ((pai386(hp)^.opcode = A_REP) or
+                           (pai386(hp)^.opcode = A_LOCK) or
+                           (pai386(hp)^.opcode =  A_REPE) or
+                           (pai386(hp)^.opcode = A_REPNE)) then
                         Begin
-                          prefix:=int_op2str[pai386(hp)^._operator]+#9;
+                          prefix:=int_op2str[pai386(hp)^.opcode]+#9;
                           hp:=Pai(hp^.next);
                         { this is theorically impossible... }
                           if hp=nil then
@@ -473,31 +621,31 @@ ait_labeled_instruction :
                        else
                         prefix:= '';
                        { A_FNSTS need the w as suffix at least for nasm}
-                       if (pai386(hp)^._operator = A_FNSTS) then
-                        pai386(hp)^._operator:=A_FNSTSW
+                       if (pai386(hp)^.opcode = A_FNSTS) then
+                        pai386(hp)^.opcode:=A_FNSTSW
                        else
-                        if (pai386(hp)^._operator = A_FSTS) then
-                         pai386(hp)^._operator:=A_FSTSW;
+                        if (pai386(hp)^.opcode = A_FSTS) then
+                         pai386(hp)^.opcode:=A_FSTSW;
                        if pai386(hp)^.op1t<>top_none then
                         begin
-                          if pai386(hp)^._operator=A_CALL then
+                          if pai386(hp)^.opcode=A_CALL then
                            s:=getopstr_jmp(pai386(hp)^.op1t,pai386(hp)^.op1,pai386(hp)^.op1ofs)
                           else
                            begin
                              s:=getopstr(pai386(hp)^.op1t,pai386(hp)^.op1,pai386(hp)^.op1ofs,
-                               pai386(hp)^.size,pai386(hp)^._operator,false);
+                               pai386(hp)^.opsize,pai386(hp)^.opcode,false);
                              if pai386(hp)^.op3t<>top_none then
                               begin
                                 if pai386(hp)^.op2t<>top_none then
                                  s:=getopstr(pai386(hp)^.op2t,pointer(longint(twowords(pai386(hp)^.op2).word1)),0,
-                                             pai386(hp)^.size,pai386(hp)^._operator,true)+','+s;
+                                             pai386(hp)^.opsize,pai386(hp)^.opcode,true)+','+s;
                                           s:=getopstr(pai386(hp)^.op3t,pointer(longint(twowords(pai386(hp)^.op2).word2)),0,
-                                           pai386(hp)^.size,pai386(hp)^._operator,false)+','+s;
+                                           pai386(hp)^.opsize,pai386(hp)^.opcode,false)+','+s;
                               end
                              else
                               if pai386(hp)^.op2t<>top_none then
-                               s:=getopstr(pai386(hp)^.op2t,pai386(hp)^.op2,0,pai386(hp)^.size,
-                                           pai386(hp)^._operator,true)+','+s;
+                               s:=getopstr(pai386(hp)^.op2t,pai386(hp)^.op2,0,pai386(hp)^.opsize,
+                                           pai386(hp)^.opcode,true)+','+s;
                            end;
                           s:=#9+s;
                         end
@@ -506,16 +654,16 @@ ait_labeled_instruction :
                           { check if string instruction }
                           { long form, otherwise may give range check errors }
                           { in turbo pascal...                               }
-                          if ((pai386(hp)^._operator = A_CMPS) or
-                             (pai386(hp)^._operator = A_INS) or
-                             (pai386(hp)^._operator = A_OUTS) or
-                             (pai386(hp)^._operator = A_SCAS) or
-                             (pai386(hp)^._operator = A_STOS) or
-                             (pai386(hp)^._operator = A_MOVS) or
-                             (pai386(hp)^._operator = A_LODS) or
-                             (pai386(hp)^._operator = A_XLAT)) then
+                          if ((pai386(hp)^.opcode = A_CMPS) or
+                             (pai386(hp)^.opcode = A_INS) or
+                             (pai386(hp)^.opcode = A_OUTS) or
+                             (pai386(hp)^.opcode = A_SCAS) or
+                             (pai386(hp)^.opcode = A_STOS) or
+                             (pai386(hp)^.opcode = A_MOVS) or
+                             (pai386(hp)^.opcode = A_LODS) or
+                             (pai386(hp)^.opcode = A_XLAT)) then
                            Begin
-                             case pai386(hp)^.size of
+                             case pai386(hp)^.opsize of
                               S_B: suffix:='b';
                               S_W: suffix:='w';
                               S_L: suffix:='d';
@@ -525,10 +673,11 @@ ait_labeled_instruction :
                            end;
                           s:='';
                         end;
-                       if pai386(hp)^._operator=A_FWAIT then
+                       if pai386(hp)^.opcode=A_FWAIT then
                         AsmWriteln(#9#9'DB'#9'09bh')
                        else
-                        AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^._operator]+suffix+s);
+                        AsmWriteLn(#9#9+prefix+int_op2str[pai386(hp)^.opcode]+suffix+s);
+{$endif AG386BIN}
                      end;
 {$ifdef GDB}
              ait_stabn,
@@ -600,7 +749,10 @@ ait_stab_function_name : ;
 end.
 {
   $Log$
-  Revision 1.19  1999-02-25 21:02:19  peter
+  Revision 1.20  1999-02-26 00:48:14  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.19  1999/02/25 21:02:19  peter
     * ag386bin updates
     + coff writer
 

+ 9 - 12
compiler/assemble.pas

@@ -27,12 +27,6 @@ interface
 uses
   dos,cobjects,globtype,globals,aasm;
 
-{$ifdef Ag386Bin}
-  {$define NoAg386Att}
-  {$define NoAg386Int}
-  {$define NoAg386Nsm}
-{$endif}
-
 const
 {$ifdef tp}
   AsmOutSize=1024;
@@ -133,10 +127,10 @@ begin
   DoPipe:=(cs_asm_pipe in aktglobalswitches) and
           not(cs_asm_leave in aktglobalswitches)
 {$ifdef i386}
-          and (aktoutputformat=as_i386_o)
+          and (aktoutputformat=as_i386_as)
 {$endif i386}
 {$ifdef m68k}
-          and (aktoutputformat=as_m68k_o);
+          and (aktoutputformat=as_m68k_as);
 {$endif m68k}
 end;
 
@@ -508,8 +502,8 @@ begin
        end;
   {$endif Ag386Bin}
   {$ifndef NoAg386Att}
-     as_i386_o,
-     as_i386_o_aout,
+     as_i386_as,
+     as_i386_as_aout,
      as_i386_asw :
        a:=new(pi386attasmlist,Init);
   {$endif NoAg386Att}
@@ -526,7 +520,7 @@ begin
 {$endif}
 {$ifdef m68k}
   {$ifndef NoAg68kGas}
-     as_m68k_o,
+     as_m68k_as,
      as_m68k_gas :
        a:=new(pm68kgasasmlist,Init);
   {$endif NoAg86KGas}
@@ -568,7 +562,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.37  1999-02-24 00:59:11  peter
+  Revision 1.38  1999-02-26 00:48:15  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.37  1999/02/24 00:59:11  peter
     * small updates for ag386bin
 
   Revision 1.36  1999/02/22 02:15:01  peter

+ 5 - 1
compiler/compiler.pas

@@ -151,6 +151,7 @@ begin
   if CompilerInited then
    DoneCompiler;
 { inits which need to be done before the arguments are parsed }
+  InitSystems;
   InitVerbose;
 {$ifdef BrowserLog}
   InitBrowserLog;
@@ -261,7 +262,10 @@ end;
 end.
 {
   $Log$
-  Revision 1.17  1999-01-12 14:25:25  peter
+  Revision 1.18  1999-02-26 00:48:16  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.17  1999/01/12 14:25:25  peter
     + BrowserLog for browser.log generation
     + BrowserCol for browser info in TCollections
     * released all other UseBrowser

+ 15 - 12
compiler/csopt386.pas

@@ -108,17 +108,17 @@ Begin {CheckSequence}
 (*              If ((Found+1) = OldNrOfMods) And
               Assigned(hp2) And
               (Pai(hp2)^.typ = ait_instruction) And
-              ((Pai386(hp2)^._operator = A_MOV) or
-               (Pai386(p1)^._operator = A_MOVZX)) And
+              ((Pai386(hp2)^.opcode = A_MOV) or
+               (Pai386(p1)^.opcode = A_MOVZX)) And
               (Pai386(hp2)^.op1t = top_ref) And
               (Pai386(hp2)^.op2t = top_reg) And
               Assigned(hp3) And
               (Pai(hp3)^.typ = ait_instruction) And
-              ((Pai386(hp3)^._operator = A_MOV) or
-               (Pai386(hp3)^._operator = A_MOVZX)) And
+              ((Pai386(hp3)^.opcode = A_MOV) or
+               (Pai386(hp3)^.opcode = A_MOVZX)) And
               (Pai386(hp3)^.op1t = top_ref) And
               (Pai386(hp3)^.op2t = top_reg) And
-               (Pai386(hp2)^._operator <> Pai386(hp3)^._operator) And
+               (Pai386(hp2)^.opcode <> Pai386(hp3)^.opcode) And
               RefsEquivalent(TReference(Pai386(hp2)^.op1^),TReference(Pai386(hp3)^.op1^), RegInfo)
              Then
 
@@ -132,17 +132,17 @@ Begin {CheckSequence}
      mov (reg), reg
      movzx (reg), reg [*]}
 
-               If (Pai386(hp2)^._operator = A_MOV)
+               If (Pai386(hp2)^.opcode = A_MOV)
                  Then
                    Begin
-                    If (Pai386(hp2)^.Size = S_B) And
+                    If (Pai386(hp2)^.opsize = S_B) And
                        RegsEquivalent(Reg8toReg32(TRegister(Pai386(hp2)^.op2)),
                                       TRegister(Pai386(hp3)^.op2), RegInfo)
                        Then
                          Begin
-                           Pai386(hp2)^._operator := A_MOVZX;
+                           Pai386(hp2)^.opcode := A_MOVZX;
                            Pai386(hp2)^.op2 := Pai386(hp3)^.op2;
-                           Pai386(hp2)^.Size := S_BL;
+                           Pai386(hp2)^.opsize := S_BL;
                            Inc(Found);
                            TmpResult := True;
                          End
@@ -155,7 +155,7 @@ Begin {CheckSequence}
                    End
                  Else
                    Begin
-                     If (Pai386(hp3)^.Size = S_B) And
+                     If (Pai386(hp3)^.opsize = S_B) And
                        RegsEquivalent(TRegister(Pai386(hp2)^.op2),
                                       Reg8toReg32(TRegister(Pai386(hp3)^.op2)),
                                       RegInfo)
@@ -247,7 +247,7 @@ Begin
       Case p^.typ Of
         ait_instruction:
           Begin
-            Case Pai386(p)^._operator Of
+            Case Pai386(p)^.opcode Of
               A_CLD: If GetLastInstruction(p, hp1) And
                         (PPaiProp(hp1^.fileinfo.line)^.DirFlag = F_NotSet) Then
                        PPaiProp(Pai(p)^.fileinfo.line)^.CanBeRemoved := True;
@@ -552,7 +552,10 @@ End.
 
 {
  $Log$
- Revision 1.18  1998-12-29 18:48:22  jonas
+ Revision 1.19  1999-02-26 00:48:17  peter
+   * assembler writers fixed for ag386bin
+
+ Revision 1.18  1998/12/29 18:48:22  jonas
    + optimize pascal code surrounding assembler blocks
 
  Revision 1.17  1998/12/17 16:37:39  jonas

+ 18 - 15
compiler/daopt386.pas

@@ -1316,9 +1316,9 @@ Begin
         (Counter <= Content.NrOfMods) Do
     Begin
       If (p^.typ = ait_instruction) and
-         ((Pai386(p)^._operator = A_MOV) or
-          (Pai386(p)^._operator = A_MOVZX) or
-          (Pai386(p)^._operator = A_MOVSX))
+         ((Pai386(p)^.opcode = A_MOV) or
+          (Pai386(p)^.opcode = A_MOVZX) or
+          (Pai386(p)^.opcode = A_MOVSX))
         Then
           If (Pai386(p)^.op1t = top_ref)
             Then
@@ -1438,16 +1438,16 @@ Begin {checks whether two Pai386 instructions are equal}
   If Assigned(p1) And Assigned(p2) And
      (Pai(p1)^.typ = ait_instruction) And
      (Pai(p1)^.typ = ait_instruction) And
-     (Pai386(p1)^._operator = Pai386(p2)^._operator) And
+     (Pai386(p1)^.opcode = Pai386(p2)^.opcode) And
      (Pai386(p1)^.op1t = Pai386(p2)^.op1t) And
      (Pai386(p1)^.op2t = Pai386(p2)^.op2t) And
      (Pai386(p1)^.op3t = Pai386(p2)^.op3t)
     Then
  {both instructions have the same structure:
   "<operator> <operand of type1>, <operand of type 2>"}
-      If ((Pai386(p1)^._operator = A_MOV) or
-          (Pai386(p1)^._operator = A_MOVZX) or
-          (Pai386(p1)^._operator = A_MOVSX)) And
+      If ((Pai386(p1)^.opcode = A_MOV) or
+          (Pai386(p1)^.opcode = A_MOVZX) or
+          (Pai386(p1)^.opcode = A_MOVSX)) And
          (Pai386(p1)^.op1t = top_ref) {then op2t = top_reg} Then
         If Not(RegInRef(TRegister(Pai386(p1)^.op2), TReference(Pai386(p1)^.op1^))) Then
  {the "old" instruction is a load of a register with a new value, not with
@@ -1544,7 +1544,7 @@ Begin {checks whether two Pai386 instructions are equal}
     Assigned(p1) And Assigned(p2) And
     ((Pai(p1)^.typ = ait_instruction) And
      (Pai(p1)^.typ = ait_instruction) And
-     (Pai386(p1)^._operator = Pai386(p2)^._operator) And
+     (Pai386(p1)^.opcode = Pai386(p2)^.opcode) And
      (Pai386(p1)^.op1t = Pai386(p2)^.op1t) And
      (Pai386(p1)^.op2t = Pai386(p2)^.op2t) And
      OpsEqual(Pai386(p1)^.op1t, Pai386(p1)^.op1, Pai386(p2)^.op1) And
@@ -1791,7 +1791,7 @@ Begin
                         If (GetLastInstruction(p, hp) And
                            Not(((hp^.typ = ait_labeled_instruction) or
                                 (hp^.typ = ait_instruction)) And
-                                (pai386_labeled(hp)^._operator = A_JMP))
+                                (pai386_labeled(hp)^.opcode = A_JMP))
                           Then
   {previous instruction not a JMP -> the contents of the registers after the
    previous intruction has been executed have to be taken into account as well}
@@ -1808,7 +1808,7 @@ Begin
   already been processed}
                       If GetLastInstruction(p, hp) And
                          Not(hp^.typ = ait_labeled_instruction) And
-                            (pai386_labeled(hp)^._operator = A_JMP))
+                            (pai386_labeled(hp)^.opcode = A_JMP))
                         Then
   {previous instruction not a jmp, so keep all the registers' contents from the
    previous instruction}
@@ -1890,7 +1890,7 @@ Begin
 {                    If (JmpsProcessed > 0) Or
                        Not(GetLastInstruction(PaiObj, hp) And
                            (hp^.typ = ait_labeled_instruction) And
-                           (pai386_labeled(hp)^._operator = A_JMP))
+                           (pai386_labeled(hp)^.opcode = A_JMP))
                       Then}
 {instruction prior to label is not a jmp, or at least one jump to the label
  has yet been processed}
@@ -1950,8 +1950,8 @@ Begin
 {$endif GDB}
         ait_instruction:
           Begin
-            InstrProp := AsmInstr[Pai386(p)^._operator];
-            Case Pai386(p)^._operator Of
+            InstrProp := AsmInstr[Pai386(p)^.opcode];
+            Case Pai386(p)^.opcode Of
               A_MOV, A_MOVZX, A_MOVSX:
                 Begin
                   Case Pai386(p)^.op1t Of
@@ -2165,7 +2165,7 @@ Begin
           End;
 {        ait_instruction:
           Begin
-           If (Pai386(p)^._operator = A_PUSH) And
+           If (Pai386(p)^.opcode = A_PUSH) And
               (Pai386(p)^.op1t = top_symbol) And
               (PCSymbol(Pai386(p)^.op1)^.offset = 0) Then
              Begin
@@ -2227,7 +2227,10 @@ End.
 
 {
  $Log$
- Revision 1.38  1999-02-25 21:02:34  peter
+ Revision 1.39  1999-02-26 00:48:18  peter
+   * assembler writers fixed for ag386bin
+
+ Revision 1.38  1999/02/25 21:02:34  peter
    * ag386bin updates
    + coff writer
 

+ 56 - 54
compiler/i386.pas

@@ -374,7 +374,7 @@ unit i386;
        pai386_labeled = ^tai386_labeled;
 
        tai386_labeled = object(tai)
-          _operator : tasmop;
+          opcode : tasmop;
           lab : plabel;
           constructor op_lab(op : tasmop; l : plabel);
           destructor done;virtual;
@@ -397,12 +397,11 @@ unit i386;
        pai386 = ^tai386;
 
        tai386 = object(tai)
-          { this isn't a proper style, but not very memory expensive }
-          op1,op2 : pointer; { op3 is also used for the csymbol offset }
-          _operator : tasmop;
-          op1ofs : longint;
+          opcode : tasmop;
+          opsize:topsize;
           opxt:word;
-          size:topsize;
+          op1,op2 : pointer;
+          op1ofs : longint;
           constructor op_none(op : tasmop;_size : topsize);
 
           constructor op_reg(op : tasmop;_size : topsize;_op1 : tregister);
@@ -1414,9 +1413,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=0;
-         size:=_size;
+         opsize:=_size;
 
          { the following isn't required ! }
          op1:=nil;
@@ -1428,9 +1427,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_reg;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
 
          op2:=nil;
@@ -1441,9 +1440,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_const;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
 
          op2:=nil;
@@ -1454,8 +1453,8 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
-         size:=_size;
+         opcode:=op;
+         opsize:=_size;
          if _op1^.is_immediate then
            begin
               opxt:=top_const;
@@ -1476,8 +1475,8 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
-         size:=_size;
+         opcode:=op;
+         opsize:=_size;
          if (_op1.loc=loc_register) or (_op1.loc=loc_cregister)  then
            begin
              opxt:=top_reg;
@@ -1503,9 +1502,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_reg shl 4+Top_reg;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op2:=pointer(_op2);
 
@@ -1521,9 +1520,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_reg shl 8+Top_reg shl 4+Top_reg;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          twowords(op2).word1:=word(_op2);
          twowords(op2).word2:=word(_op3);
@@ -1534,9 +1533,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_reg;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
 
          if _op2^.is_immediate then
@@ -1558,9 +1557,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_reg;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
 
          if (_op2.loc=loc_register) or (_op2.loc=loc_cregister)  then
@@ -1587,9 +1586,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_reg shl 4;
-         size:=_size;
+         opsize:=_size;
          op2:=pointer(_op2);
 
          if (_op1.loc=loc_register) or (_op1.loc=loc_cregister)  then
@@ -1616,9 +1615,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_const+Top_reg shl 4+Top_reg shl 8;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          twowords(op2).word1:=word(_op2);
          twowords(op2).word2:=word(_op3);
@@ -1629,7 +1628,7 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          if ((op=A_CMP) or (op=A_AND) or (op=A_ADD) or
             (op=A_ADC) or (op=A_SUB) or (op=A_SBB)) and
             ((_size=S_B) or (_size=S_BW) or (_size=S_BL)) and
@@ -1645,7 +1644,7 @@ unit i386;
                 _size:=S_L;
            end;
          opxt:=Top_const+Top_reg shl 4;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op2:=pointer(_op2);
 
@@ -1656,9 +1655,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_const+Top_const shl 4;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op2:=pointer(_op2);
 
@@ -1669,9 +1668,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_const;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
 
          if _op2^.is_immediate then
@@ -1693,9 +1692,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_const;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
 
          if (_op2.loc=loc_register) or (_op2.loc=loc_cregister)  then
@@ -1722,9 +1721,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_reg shl 4;
-         size:=_size;
+         opsize:=_size;
          op2:=pointer(_op2);
 
          if _op1^.is_immediate then
@@ -1746,8 +1745,8 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
-         size:=_size;
+         opcode:=op;
+         opsize:=_size;
 
          if _op1^.is_immediate then
            begin
@@ -1780,11 +1779,11 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          if (op=A_CALL) and (use_esp_stackframe) then
           Message(cg_e_stackframe_with_esp);
          opxt:=top_symbol;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op1ofs:=0;
          op2:=nil;
@@ -1796,11 +1795,11 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          if (op=A_CALL) and (use_esp_stackframe) then
           Message(cg_e_stackframe_with_esp);
          opxt:=top_symbol;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op1ofs:=_op1ofs;
          op2:=nil;
@@ -1811,9 +1810,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=Top_symbol+Top_reg shl 4;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op1ofs:=_op1ofs;
          op2:=pointer(_op2);
@@ -1824,9 +1823,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_symbol;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op1ofs:=_op1ofs;
 
@@ -1849,9 +1848,9 @@ unit i386;
       begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_symbol;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op1ofs:=_op1ofs;
          if (_op2.loc=loc_register) or (_op2.loc=loc_cregister)  then
@@ -1878,9 +1877,9 @@ unit i386;
     begin
          inherited init;
          typ:=ait_instruction;
-         _operator:=op;
+         opcode:=op;
          opxt:=top_reg+top_const shl 4;
-         size:=_size;
+         opsize:=_size;
          op1:=pointer(_op1);
          op2:=pointer(_op2);
     end;
@@ -1928,7 +1927,7 @@ unit i386;
       begin
          inherited init;
          typ:=ait_labeled_instruction;
-         _operator:=op;
+         opcode:=op;
          lab:=l;
          lab^.is_used:=true;
          inc(lab^.refcount);
@@ -1977,7 +1976,10 @@ Begin
 end.
 {
   $Log$
-  Revision 1.36  1999-02-25 21:02:38  peter
+  Revision 1.37  1999-02-26 00:48:20  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.36  1999/02/25 21:02:38  peter
     * ag386bin updates
     + coff writer
 

+ 153 - 150
compiler/popt386.pas

@@ -85,8 +85,8 @@ Var
         p1 := LTable^[hp^.lab^.nb-LoLab].PaiObj; {the jump's destination}
         p1 := SkipLabels(p1);
         If (pai(p1)^.typ = ait_labeled_instruction) and
-           ((pai386_labeled(p1)^._operator = A_JMP) or
-            (pai386_labeled(p1)^._operator = hp^._operator))
+           ((pai386_labeled(p1)^.opcode = A_JMP) or
+            (pai386_labeled(p1)^.opcode = hp^.opcode))
           Then
             Begin
               GetFinalDestination(pai386_labeled(p1));
@@ -110,7 +110,7 @@ Begin
           Begin
   {the following if-block removes all code between a jmp and the next label,
    because it can never be executed}
-            If (pai386_labeled(p)^._operator = A_JMP) Then
+            If (pai386_labeled(p)^.opcode = A_JMP) Then
               Begin
                 hp1 := pai(p^.next);
                 While GetNextInstruction(p, hp1) and
@@ -126,30 +126,30 @@ Begin
             If GetNextInstruction(p, hp1) then
               Begin
                 If (pai(hp1)^.typ=ait_labeled_instruction) and
-                   (pai386_labeled(hp1)^._operator=A_JMP) and
+                   (pai386_labeled(hp1)^.opcode=A_JMP) and
                    GetNextInstruction(hp1, hp2) And
                    FindLabel(pai386_labeled(p)^.lab, hp2)
                   Then
                     Begin
-                      Case pai386_labeled(p)^._operator Of
-                        A_JE : pai386_labeled(p)^._operator:=A_JNE;
-                        A_JNE : pai386_labeled(p)^._operator:=A_JE;
-                        A_JL : pai386_labeled(p)^._operator:=A_JGE;
-                        A_JG : pai386_labeled(p)^._operator:=A_JLE;
-                        A_JLE : pai386_labeled(p)^._operator:=A_JG;
-                        A_JGE : pai386_labeled(p)^._operator:=A_JL;
-                        A_JNZ : pai386_labeled(p)^._operator:=A_JZ;
-                        A_JNO : pai386_labeled(p)^._operator:=A_JO;
-                        A_JZ : pai386_labeled(p)^._operator:=A_JNZ;
-                        A_JS : pai386_labeled(p)^._operator:=A_JNS;
-                        A_JNS : pai386_labeled(p)^._operator:=A_JS;
-                        A_JO : pai386_labeled(p)^._operator:=A_JNO;
-                        A_JC : pai386_labeled(p)^._operator:=A_JNC;
-                        A_JNC : pai386_labeled(p)^._operator:=A_JC;
-                        A_JA : pai386_labeled(p)^._operator:=A_JBE;
-                        A_JAE : pai386_labeled(p)^._operator:=A_JB;
-                        A_JB : pai386_labeled(p)^._operator:=A_JAE;
-                        A_JBE : pai386_labeled(p)^._operator:=A_JA;
+                      Case pai386_labeled(p)^.opcode Of
+                        A_JE : pai386_labeled(p)^.opcode:=A_JNE;
+                        A_JNE : pai386_labeled(p)^.opcode:=A_JE;
+                        A_JL : pai386_labeled(p)^.opcode:=A_JGE;
+                        A_JG : pai386_labeled(p)^.opcode:=A_JLE;
+                        A_JLE : pai386_labeled(p)^.opcode:=A_JG;
+                        A_JGE : pai386_labeled(p)^.opcode:=A_JL;
+                        A_JNZ : pai386_labeled(p)^.opcode:=A_JZ;
+                        A_JNO : pai386_labeled(p)^.opcode:=A_JO;
+                        A_JZ : pai386_labeled(p)^.opcode:=A_JNZ;
+                        A_JS : pai386_labeled(p)^.opcode:=A_JNS;
+                        A_JNS : pai386_labeled(p)^.opcode:=A_JS;
+                        A_JO : pai386_labeled(p)^.opcode:=A_JNO;
+                        A_JC : pai386_labeled(p)^.opcode:=A_JNC;
+                        A_JNC : pai386_labeled(p)^.opcode:=A_JC;
+                        A_JA : pai386_labeled(p)^.opcode:=A_JBE;
+                        A_JAE : pai386_labeled(p)^.opcode:=A_JB;
+                        A_JB : pai386_labeled(p)^.opcode:=A_JAE;
+                        A_JBE : pai386_labeled(p)^.opcode:=A_JA;
                         Else
                           begin
                             If (LabDif <> 0) Then GetFinalDestination(pai386_labeled(p));
@@ -204,14 +204,14 @@ Begin
                         index := R_NO
                       End
                 End;
-            Case Pai386(p)^._operator Of
+            Case Pai386(p)^.opcode Of
               A_AND:
                 Begin
                   If (Pai386(p)^.op1t = top_const) And
                      (Pai386(p)^.op2t = top_reg) And
                      GetNextInstruction(p, hp1) And
                      (Pai(hp1)^.typ = ait_instruction) And
-                     (Pai386(hp1)^._operator = A_AND) And
+                     (Pai386(hp1)^.opcode = A_AND) And
                      (Pai386(hp1)^.op1t = top_const) And
                      (Pai386(hp1)^.op2t = top_reg) And
                      (Pai386(hp1)^.op2 = Pai386(hp1)^.op2)
@@ -229,7 +229,7 @@ Begin
                          GetNextInstruction(p, hp1) And
                          (hp1^.typ = ait_labeled_instruction) And
                          Not(TRegister(Pai386(p)^.op2) in UsedRegs)
-                        Then Pai386(p)^._operator := A_TEST;
+                        Then Pai386(p)^.opcode := A_TEST;
                 End;
               A_CMP:
                 Begin
@@ -238,7 +238,7 @@ Begin
                      (Pai386(p)^.op1 = Pointer(0)) Then
                  {change "cmp $0, %reg" to "test %reg, %reg"}
                     Begin
-                      Pai386(p)^._operator := A_TEST;
+                      Pai386(p)^.opcode := A_TEST;
                       Pai386(p)^.opxt := Top_reg+Top_reg shl 4;
                       Pai386(p)^.op1 := Pai386(p)^.op2;
                     End;
@@ -250,18 +250,18 @@ Begin
                      (hp2^.typ = Ait_Instruction) And
                      (Pai386(hp2)^.Op1t = top_reg) And
                      (Pai386(hp2)^.Op2t = top_reg) And
-                     (Pai386(p)^.Size in [S_FS, S_FL]) And
+                     (Pai386(p)^.opsize in [S_FS, S_FL]) And
                      (TRegister(Pai386(hp2)^.Op1) = R_ST) And
                      (TRegister(Pai386(hp2)^.Op2) = R_ST1) Then
                     If GetLastInstruction(p, hp1) And
                        (hp1^.typ = Ait_Instruction) And
-                       ((Pai386(hp1)^._operator = A_FLD) Or
-                        (Pai386(hp1)^._operator = A_FST)) And
-                       (Pai386(hp1)^.size = Pai386(p)^.size) And
+                       ((Pai386(hp1)^.opcode = A_FLD) Or
+                        (Pai386(hp1)^.opcode = A_FST)) And
+                       (Pai386(hp1)^.opsize = Pai386(p)^.opsize) And
                        (Pai386(hp1)^.op1t = top_ref) And
                        RefsEqual(TReference(Pai386(p)^.Op1^), TReference(Pai386(hp1)^.Op1^)) Then
-                      If ((Pai386(hp2)^._operator = A_FMULP) Or
-                          (Pai386(hp2)^._operator = A_FADDP)) Then
+                      If ((Pai386(hp2)^.opcode = A_FMULP) Or
+                          (Pai386(hp2)^.opcode = A_FADDP)) Then
 
                       { change                      to
                           fld/fst   mem1  (hp1)       fld/fst   mem1
@@ -272,9 +272,9 @@ Begin
                           AsmL^.Remove(p);
                           Dispose(p, Done);
                           p := hp1;
-                          If (Pai386(hp2)^._operator = A_FADDP)
-                            Then Pai386(hp2)^._operator := A_FADD
-                            Else Pai386(hp2)^._operator := A_FMUL;
+                          If (Pai386(hp2)^.opcode = A_FADDP)
+                            Then Pai386(hp2)^.opcode := A_FADD
+                            Else Pai386(hp2)^.opcode := A_FMUL;
                           Pai386(hp2)^.op2 := Pointer(R_ST);
                         End
                       Else
@@ -282,14 +282,14 @@ Begin
                           fld/fst mem1 (hp1)   fld/fst mem1
                           fld     mem1 (p)     fld      st}
                         Begin
-                          Pai386(p)^.Size := S_FL;
+                          Pai386(p)^.opsize := S_FL;
                           Clear_Reference(TReference(Pai386(p)^.Op1^));
                           Pai386(p)^.Op1 := Pointer(R_ST);
                           Pai386(p)^.Opxt := top_reg;
                         End
                     Else
                       Begin
-                        Case Pai386(hp2)^._operator Of
+                        Case Pai386(hp2)^.opcode Of
                           A_FMULP,A_FADDP,A_FSUBP,A_FDIVP,A_FSUBRP,A_FDIVRP:
                      { change                        to
                          fld/fst  mem1    (hp1)      fld/fst    mem1
@@ -297,13 +297,13 @@ Begin
                          fxxxp    st, st1 (hp2)                      }
 
                             Begin
-                              Case Pai386(hp2)^._operator Of
-                                A_FADDP: Pai386(p)^._operator := A_FADD;
-                                A_FMULP: Pai386(p)^._operator := A_FMUL;
-                                A_FSUBP: Pai386(p)^._operator := A_FSUBR;
-                                A_FSUBRP: Pai386(p)^._operator := A_FSUB;
-                                A_FDIVP: Pai386(p)^._operator := A_FDIVR;
-                                A_FDIVRP: Pai386(p)^._operator := A_FDIV;
+                              Case Pai386(hp2)^.opcode Of
+                                A_FADDP: Pai386(p)^.opcode := A_FADD;
+                                A_FMULP: Pai386(p)^.opcode := A_FMUL;
+                                A_FSUBP: Pai386(p)^.opcode := A_FSUBR;
+                                A_FSUBRP: Pai386(p)^.opcode := A_FSUB;
+                                A_FDIVP: Pai386(p)^.opcode := A_FDIVR;
+                                A_FDIVRP: Pai386(p)^.opcode := A_FDIV;
                               End;
                               AsmL^.Remove(hp2);
                               Dispose(hp2, Done)
@@ -316,19 +316,19 @@ Begin
                   If (Pai386(p)^.op1t = top_ref) And
                      GetNextInstruction(p, hp1) And
                      (Pai(hp1)^.typ = ait_instruction) And
-                     (((Pai386(hp1)^._operator = A_FLD) And
-                       (Pai386(p)^._operator = A_FSTP)) Or
-                      ((Pai386(p)^._operator = A_FISTP) And
-                       (Pai386(hp1)^._operator = A_FILD))) And
+                     (((Pai386(hp1)^.opcode = A_FLD) And
+                       (Pai386(p)^.opcode = A_FSTP)) Or
+                      ((Pai386(p)^.opcode = A_FISTP) And
+                       (Pai386(hp1)^.opcode = A_FILD))) And
                      (Pai386(hp1)^.op1t = top_ref) And
-                     (Pai386(hp1)^.Size = Pai386(p)^.Size) And
+                     (Pai386(hp1)^.opsize = Pai386(p)^.opsize) And
                      RefsEqual(TReference(Pai386(p)^.op1^), TReference(Pai386(hp1)^.op1^))
                     Then
                       Begin
                         If GetNextInstruction(hp1, hp2) And
                            (hp2^.typ = ait_instruction) And
-                           ((Pai386(hp2)^._operator = A_LEAVE) Or
-                            (Pai386(hp2)^._operator = A_RET)) And
+                           ((Pai386(hp2)^.opcode = A_LEAVE) Or
+                            (Pai386(hp2)^.opcode = A_RET)) And
                            (TReference(Pai386(p)^.op1^).Base = ProcInfo.FramePointer) And
                            (TReference(Pai386(p)^.op1^).Offset >= ProcInfo.RetOffset) And
                            (TReference(Pai386(p)^.op1^).Index = R_NO)
@@ -343,12 +343,12 @@ Begin
                             End
                           Else
                    {fst can't store an extended value!}
-                           If (Pai386(p)^.Size <> S_FX) And
-                              (Pai386(p)^.Size <> S_IQ) Then
+                           If (Pai386(p)^.opsize <> S_FX) And
+                              (Pai386(p)^.opsize <> S_IQ) Then
                              Begin
-                               If (Pai386(p)^._operator = A_FSTP) Then
-                                 Pai386(p)^._operator := A_FST
-                               Else Pai386(p)^._operator := A_FIST;
+                               If (Pai386(p)^.opcode = A_FSTP) Then
+                                 Pai386(p)^.opcode := A_FST
+                               Else Pai386(p)^.opcode := A_FIST;
                                AsmL^.Remove(hp1);
                                Dispose(hp1, done)
                              End
@@ -359,7 +359,7 @@ Begin
                 Begin
                   If (Pai386(p)^.op1t = Top_Const) And
                      (Pai386(p)^.op2t = Top_Reg) And
-                     (Pai386(p)^.Size = S_L) Then
+                     (Pai386(p)^.opsize = S_L) Then
                     If (Longint(Pai386(p)^.op1) = 1) Then
                       If (Pai386(p)^.op3t = Top_None) Then
                        {remove "imul $1, reg"}
@@ -389,8 +389,8 @@ Begin
                      (Not(GetNextInstruction(p, hp1)) Or
                        {GetNextInstruction(p, hp1) And}
                        Not((Pai(hp1)^.typ = ait_labeled_instruction) And
-                           ((pai386_labeled(hp1)^._operator = A_JO) or
-                            (pai386_labeled(hp1)^._operator = A_JNO))))
+                           ((pai386_labeled(hp1)^.opcode = A_JO) or
+                            (pai386_labeled(hp1)^.opcode = A_JNO))))
                     Then
                       Begin
                         New(TmpRef);
@@ -632,7 +632,7 @@ Begin
                      (TRegister(Pai386(p)^.op2) In [R_EAX, R_EBX, R_EDX, R_EDI]) And
                      GetNextInstruction(p, hp1) And
                      (Pai(hp1)^.typ = ait_instruction) And
-                     (Pai386(hp1)^._operator = A_MOV) And
+                     (Pai386(hp1)^.opcode = A_MOV) And
                      (Pai386(hp1)^.op1t = top_reg) And
                      (Pai386(hp1)^.op1 = Pai386(p)^.op2)
                     Then
@@ -697,8 +697,8 @@ Begin
                         Then
                   {we have "mov %reg1, %reg2; XXX %reg2, ???"}
                           Begin
-                            If ((Pai386(hp1)^._operator = A_OR) Or
-                                (Pai386(hp1)^._operator = A_TEST)) And
+                            If ((Pai386(hp1)^.opcode = A_OR) Or
+                                (Pai386(hp1)^.opcode = A_TEST)) And
                                (Pai386(hp1)^.op2t = top_reg) And
                                (Pai386(hp1)^.op1 = Pai386(hp1)^.op2)
                               Then
@@ -728,7 +728,7 @@ Begin
                                       End;
                                 End
 {                              Else
-                                If (Pai386(p^.next)^._operator
+                                If (Pai386(p^.next)^.opcode
                                    In [A_PUSH, A_OR, A_XOR, A_AND, A_TEST])}
                          {change "mov %reg1, %reg2; push/or/xor/... %reg2, ???" to
                           "mov %reg1, %reg2; push/or/xor/... %reg1, ???"}
@@ -741,8 +741,8 @@ Begin
                           If GetNextInstruction(p, hp1) And
                              (Pai(hp1)^.typ = ait_instruction)
                             Then
-                              If ((Pai386(hp1)^._operator = A_LEAVE) Or
-                                  (Pai386(hp1)^._operator = A_RET)) And
+                              If ((Pai386(hp1)^.opcode = A_LEAVE) Or
+                                  (Pai386(hp1)^.opcode = A_RET)) And
                                  (Pai386(p)^.op2t = top_ref) And
                                  (TReference(Pai386(p)^.op2^).base = ProcInfo.FramePointer) And
                                  (TReference(Pai386(p)^.op2^).offset >= ProcInfo.RetOffset) And
@@ -757,8 +757,8 @@ Begin
                                Else
                                  If (Pai386(p)^.op1t = top_reg) And
                                     (Pai386(p)^.op2t = top_ref) And
-                                    (Pai386(p)^.Size = Pai386(hp1)^.Size) And
-                                    (Pai386(hp1)^._operator = A_CMP) And
+                                    (Pai386(p)^.opsize = Pai386(hp1)^.opsize) And
+                                    (Pai386(hp1)^.opcode = A_CMP) And
                                     (Pai386(hp1)^.op2t = top_ref) And
                                     RefsEqual(TReference(Pai386(p)^.op2^),
                                               TReference(Pai386(hp1)^.op2^))
@@ -772,7 +772,7 @@ Begin
                 { Next instruction is also a MOV ? }
                   If GetNextInstruction(p, hp1) And
                      (pai(hp1)^.typ = ait_instruction) and
-                     (Pai386(hp1)^._operator = A_MOV)
+                     (Pai386(hp1)^.opcode = A_MOV)
                     Then
                       Begin
                         If (Pai386(hp1)^.op1t = Pai386(p)^.op2t) and
@@ -811,7 +811,7 @@ Begin
                                           mov mem2, reg1 }
                                          GetNextInstruction(hp1, hp2) And
                                          (hp2^.typ = ait_instruction) And
-                                         (Pai386(hp2)^._operator = A_CMP) And
+                                         (Pai386(hp2)^.opcode = A_CMP) And
                                          (Pai386(hp2)^.Op1t = TOp_Ref) And
                                          (Pai386(hp2)^.Op2t = TOp_Reg) And
                                          RefsEqual(TReference(Pai386(hp2)^.Op1^),
@@ -826,7 +826,7 @@ Begin
                                         Begin
                                           AsmL^.Remove(hp2);
                                           Dispose(hp2, Done);
-                                          Pai386(hp1)^._operator := A_CMP;
+                                          Pai386(hp1)^.opcode := A_CMP;
                                           Pai386(hp1)^.Opxt := top_reg + top_ref shl 4;
                                           Pai386(hp1)^.Op2 := Pai386(hp1)^.Op1;
                                           Pai386(hp1)^.Op1 := Pai386(p)^.Op1
@@ -842,7 +842,7 @@ Begin
                                        (Pai386(hp1)^.op1 = Pai386(p)^.op2) And
                                        (Pai386(hp1)^.op2t = top_ref) And
                                        (Pai(hp2)^.typ = ait_instruction) And
-                                       (Pai386(hp2)^._operator = A_MOV) And
+                                       (Pai386(hp2)^.opcode = A_MOV) And
                                        (Pai386(hp2)^.op2t = top_reg) And
                                        (Pai386(hp2)^.op1t = top_ref) And
                                        RefsEqual(TReference(Pai386(hp2)^.op1^),
@@ -899,7 +899,7 @@ Begin
                                (Pai386(p)^.op2t = top_reg) and
                                (Pai386(hp1)^.op1t = top_ref) and
                                (Pai386(hp1)^.op2t = top_reg) and
-                               (Pai386(p)^.size = Pai386(hp1)^.size) and
+                               (Pai386(p)^.opsize = Pai386(hp1)^.opsize) and
                                RefsEqual(TReference(Pai386(p)^.op1^),TReference(Pai386(hp1)^.op1^)) and
                                (TRegister(Pai386(p)^.op2)<>TReference(Pai386(hp1)^.op1^).base) and
                                (TRegister(Pai386(p)^.op2)<>TReference(Pai386(hp1)^.op1^).index) then
@@ -918,7 +918,7 @@ Begin
                                  (Pai386(p)^.op2t = top_ref) and
                                  (Pai386(hp1)^.op1t = top_ref) and
                                  (Pai386(hp1)^.op2t = top_reg) and
-                                 (Pai386(p)^.size = Pai386(hp1)^.size) and
+                                 (Pai386(p)^.opsize = Pai386(hp1)^.opsize) and
                                  RefsEqual(TReference(Pai386(hp1)^.op1^),TReference(Pai386(p)^.op2^)) then
                                 Begin
                                   Pai386(hp1)^.op1:=Pai386(hp1)^.op2;
@@ -934,7 +934,7 @@ Begin
                      (Pai386(p)^.op2t = Top_Reg)
                     Then
                       Begin
-                        Pai386(p)^._operator := A_XOR;
+                        Pai386(p)^.opcode := A_XOR;
                         Pai386(p)^.opxt := Top_Reg+Top_reg shl 4;
                         Pai386(p)^.op1 := Pai386(p)^.op2;
                       End;
@@ -945,12 +945,12 @@ Begin
                   If (Pai386(p)^.op2t = top_reg) And
                      GetNextInstruction(p, hp1) And
                      (Pai(hp1)^.typ = ait_instruction) And
-                     (Pai386(hp1)^._operator = A_AND) And
+                     (Pai386(hp1)^.opcode = A_AND) And
                      (Pai386(hp1)^.op1t = top_const) And
                      (Pai386(hp1)^.op2t = top_reg) And
                      (Pai386(hp1)^.op2 = Pai386(p)^.op2)
                     Then
-                      Case Pai386(p)^.Size Of
+                      Case Pai386(p)^.opsize Of
                         S_BL, S_BW:
                           If (Longint(Pai386(hp1)^.op1) = $ff)
                             Then
@@ -971,7 +971,7 @@ Begin
                   If (Pai386(p)^.op2t = top_reg) Then
                     If (Pai386(p)^.op1t = top_reg)
                       Then
-                        Case Pai386(p)^.size of
+                        Case Pai386(p)^.opsize of
                           S_BW:
                             Begin
                               If (TRegister(Pai386(p)^.op1) = Reg16ToReg8(TRegister(Pai386(p)^.op2))) And
@@ -979,15 +979,15 @@ Begin
                                 Then
                                   {Change "movzbw %al, %ax" to "andw $0x0ffh, %ax"}
                                   Begin
-                                    Pai386(p)^._operator := A_AND;
+                                    Pai386(p)^.opcode := A_AND;
                                     Pai386(p)^.opxt := top_const+Top_reg shl 4;
                                     Longint(Pai386(p)^.op1) := $ff;
-                                    Pai386(p)^.Size := S_W
+                                    Pai386(p)^.opsize := S_W
                                   End
                                 Else
                                   If GetNextInstruction(p, hp1) And
                                      (Pai(hp1)^.typ = ait_instruction) And
-                                     (Pai386(hp1)^._operator = A_AND) And
+                                     (Pai386(hp1)^.opcode = A_AND) And
                                      (Pai386(hp1)^.op1t = top_const) And
                                      (Pai386(hp1)^.op2t = top_reg) And
                                      (Pai386(hp1)^.op2 = Pai386(p)^.op2)
@@ -995,8 +995,8 @@ Begin
                                       {Change "movzbw %reg1, %reg2; andw $const, %reg2"
                                        to "movw %reg1, reg2; andw $(const1 and $ff), %reg2"}
                                       Begin
-                                        Pai386(p)^._operator := A_MOV;
-                                        Pai386(p)^.Size := S_W;
+                                        Pai386(p)^.opcode := A_MOV;
+                                        Pai386(p)^.opsize := S_W;
                                         Pai386(p)^.op1 := Pointer(Reg8ToReg16(TRegister(Pai386(p)^.op1)));
                                         Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1) And $ff);
                                       End;
@@ -1008,15 +1008,15 @@ Begin
                                 Then
                                   {Change "movzbl %al, %eax" to "andl $0x0ffh, %eax"}
                                   Begin
-                                    Pai386(p)^._operator := A_AND;
+                                    Pai386(p)^.opcode := A_AND;
                                     Pai386(p)^.opxt := top_const+Top_reg shl 4;
                                     Longint(Pai386(p)^.op1) := $ff;
-                                    Pai386(p)^.Size := S_L;
+                                    Pai386(p)^.opsize := S_L;
                                   End
                                 Else
                                   If GetNextInstruction(p, hp1) And
                                      (Pai(hp1)^.typ = ait_instruction) And
-                                     (Pai386(hp1)^._operator = A_AND) And
+                                     (Pai386(hp1)^.opcode = A_AND) And
                                      (Pai386(hp1)^.op1t = top_const) And
                                      (Pai386(hp1)^.op2t = top_reg) And
                                      (Pai386(hp1)^.op2 = Pai386(p)^.op2)
@@ -1024,8 +1024,8 @@ Begin
                                      {Change "movzbl %reg1, %reg2; andl $const, %reg2"
                                       to "movl %reg1, reg2; andl $(const1 and $ff), %reg2"}
                                       Begin
-                                        Pai386(p)^._operator := A_MOV;
-                                        Pai386(p)^.Size := S_L;
+                                        Pai386(p)^.opcode := A_MOV;
+                                        Pai386(p)^.opsize := S_L;
                                         Pai386(p)^.op1 := Pointer(Reg8ToReg32(TRegister(Pai386(p)^.op1)));
                                         Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1) And $ff);
                                       End
@@ -1037,15 +1037,15 @@ Begin
                                 Then
                                  {Change "movzwl %ax, %eax" to "andl $0x0ffffh, %eax"}
                                   Begin
-                                    Pai386(p)^._operator := A_AND;
+                                    Pai386(p)^.opcode := A_AND;
                                     Pai386(p)^.opxt := top_const+Top_reg shl 4;
                                     Longint(Pai386(p)^.op1) := $ffff;
-                                    Pai386(p)^.Size := S_L
+                                    Pai386(p)^.opsize := S_L
                                   End
                                 Else
                                   If GetNextInstruction(p, hp1) And
                                      (Pai(hp1)^.typ = ait_instruction) And
-                                     (Pai386(hp1)^._operator = A_AND) And
+                                     (Pai386(hp1)^.opcode = A_AND) And
                                      (Pai386(hp1)^.op1t = top_const) And
                                      (Pai386(hp1)^.op2t = top_reg) And
                                      (Pai386(hp1)^.op2 = Pai386(p)^.op2)
@@ -1053,8 +1053,8 @@ Begin
                                       {Change "movzwl %reg1, %reg2; andl $const, %reg2"
                                        to "movl %reg1, reg2; andl $(const1 and $ffff), %reg2"}
                                       Begin
-                                        Pai386(p)^._operator := A_MOV;
-                                        Pai386(p)^.Size := S_L;
+                                        Pai386(p)^.opcode := A_MOV;
+                                        Pai386(p)^.opsize := S_L;
                                         Pai386(p)^.op1 := Pointer(Reg16ToReg32(TRegister(Pai386(p)^.op1)));
                                         Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1) And $ffff);
                                       End;
@@ -1065,28 +1065,28 @@ Begin
                           Begin
                             If GetNextInstruction(p, hp1) And
                                (Pai(hp1)^.typ = ait_instruction) And
-                               (Pai386(hp1)^._operator = A_AND) And
+                               (Pai386(hp1)^.opcode = A_AND) And
                                (Pai386(hp1)^.op1t = Top_Const) And
                                (Pai386(hp1)^.op2t = Top_Reg) And
                                (Pai386(hp1)^.op2 = Pai386(p)^.op2) Then
                               Begin
-                                Pai386(p)^._operator := A_MOV;
-                                Case Pai386(p)^.Size Of
+                                Pai386(p)^.opcode := A_MOV;
+                                Case Pai386(p)^.opsize Of
                                   S_BL:
                                     Begin
-                                      Pai386(p)^.Size := S_L;
+                                      Pai386(p)^.opsize := S_L;
                                       Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1)
                                         And $ff);
                                     End;
                                   S_WL:
                                     Begin
-                                      Pai386(p)^.Size := S_L;
+                                      Pai386(p)^.opsize := S_L;
                                       Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1)
                                         And $ffff);
                                     End;
                                   S_BW:
                                     Begin
-                                      Pai386(p)^.Size := S_W;
+                                      Pai386(p)^.opsize := S_W;
                                       Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1)
                                         And $ff);
                                     End;
@@ -1099,7 +1099,7 @@ Begin
                    if (Pai386(p)^.op1t = top_reg) And
                       GetNextInstruction(p, hp1) And
                       (pai(hp1)^.typ=ait_instruction) and
-                      (Pai386(hp1)^._operator=A_PUSH) and
+                      (Pai386(hp1)^.opcode=A_PUSH) and
                       (Pai386(hp1)^.op1t = top_reg) And
                       (Pai386(hp1)^.op1=Pai386(p)^.op1) then
                      If (Not(cs_regalloc in aktglobalswitches)) Then
@@ -1114,7 +1114,7 @@ Begin
                        End
                      Else
                        Begin
-                         Pai386(p)^._operator := A_MOV;
+                         Pai386(p)^.opcode := A_MOV;
                          Pai386(p)^.op2 := Pai386(p)^.op1;
                          Pai386(p)^.opxt := top_ref + top_reg shl 4;
                          New(TmpRef);
@@ -1133,15 +1133,15 @@ Begin
                 end;
               A_PUSH:
                 Begin
-                  If (Pai386(p)^.size = S_W) And
+                  If (Pai386(p)^.opsize = S_W) And
                      (Pai386(p)^.op1t = Top_Const) And
                      GetNextInstruction(p, hp1) And
                      (Pai(hp1)^.typ = ait_instruction) And
-                     (Pai386(hp1)^._operator = A_PUSH) And
+                     (Pai386(hp1)^.opcode = A_PUSH) And
                      (Pai386(hp1)^.op1t = Top_Const) And
-                     (Pai386(hp1)^.size = S_W) Then
+                     (Pai386(hp1)^.opsize = S_W) Then
                     Begin
-                      Pai386(p)^.Size := S_L;
+                      Pai386(p)^.opsize := S_L;
                       Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) shl 16 + Longint(Pai386(hp1)^.op1));
                       AsmL^.Remove(hp1);
                       Dispose(hp1, Done)
@@ -1151,7 +1151,7 @@ Begin
                 Begin
                   If (Pai386(p)^.op1t = Top_Const) And
                      (Pai386(p)^.op2t = Top_Reg) And
-                     (Pai386(p)^.Size = S_L) And
+                     (Pai386(p)^.opsize = S_L) And
                      (Longint(Pai386(p)^.op1) <= 3)
                 {Changes "shl const, %reg32; add const/reg, %reg32" to one lea statement}
                     Then
@@ -1170,8 +1170,8 @@ Begin
                         While TmpBool1 And
                               GetNextInstruction(p, hp1) And
                               (Pai(hp1)^.typ = ait_instruction) And
-                              ((Pai386(hp1)^._operator = A_ADD) Or
-                               (Pai386(hp1)^._operator = A_SUB)) And
+                              ((Pai386(hp1)^.opcode = A_ADD) Or
+                               (Pai386(hp1)^.opcode = A_SUB)) And
                               (Pai386(hp1)^.op2t = Top_Reg) And
                               (Pai386(hp1)^.op2 = Pai386(p)^.op2) Do
                           Begin
@@ -1181,7 +1181,7 @@ Begin
                                 Begin
                                   TmpBool1 := True;
                                   TmpBool2 := True;
-                                  If Pai386(hp1)^._operator = A_ADD
+                                  If Pai386(hp1)^.opcode = A_ADD
                                     Then Inc(TmpRef^.offset, Longint(Pai386(hp1)^.op1))
                                     Else Dec(TmpRef^.offset, Longint(Pai386(hp1)^.op1));
                                   AsmL^.Remove(hp1);
@@ -1189,7 +1189,7 @@ Begin
                                 End
                               Else
                                 If (Pai386(hp1)^.op1t = Top_Reg) And
-                                   (Pai386(hp1)^._operator = A_ADD) And
+                                   (Pai386(hp1)^.opcode = A_ADD) And
                                    (TmpRef^.base = R_NO) Then
                                   Begin
                                     TmpBool1 := True;
@@ -1210,7 +1210,7 @@ Begin
                                 Then
                                   Begin
                                     Dispose(TmpRef);
-                                    hp1 := new(Pai386,op_reg_reg(A_ADD,Pai386(p)^.Size,
+                                    hp1 := new(Pai386,op_reg_reg(A_ADD,Pai386(p)^.opsize,
                                                TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)))
                                   End
                                 Else hp1 := New(Pai386, op_ref_reg(A_LEA, S_L, TmpRef,
@@ -1231,14 +1231,14 @@ Begin
    but faster on a 486, and pairable in both U and V pipes on the Pentium
    (unlike shl, which is only pairable in the U pipe)}
                             Begin
-                              hp1 := new(Pai386,op_reg_reg(A_ADD,Pai386(p)^.Size,
+                              hp1 := new(Pai386,op_reg_reg(A_ADD,Pai386(p)^.opsize,
                                          TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
                               hp1^.fileinfo := p^.fileinfo;
                               InsertLLItem(AsmL,p^.previous, p^.next, hp1);
                               Dispose(p, done);
                               p := hp1;
                             End
-                          Else If (Pai386(p)^.size = S_L) and
+                          Else If (Pai386(p)^.opsize = S_L) and
                                   (Longint(Pai386(p)^.op1) <= 3) Then
                     {changes "shl $2, %reg" to "lea (,%reg,4), %reg"
                              "shl $3, %reg" to "lea (,%reg,8), %reg}
@@ -1266,10 +1266,10 @@ Begin
                 Begin
                   If GetNextInstruction(p, hp1) And
                      (pai(hp1)^.typ = ait_instruction) and
-                     (Pai386(hp1)^._operator = A_SHL) and
+                     (Pai386(hp1)^.opcode = A_SHL) and
                      (Pai386(p)^.op1t = top_const) and
                      (Pai386(hp1)^.op1t = top_const) and
-                     (Pai386(hp1)^.Size = Pai386(p)^.Size) And
+                     (Pai386(hp1)^.opsize = Pai386(p)^.opsize) And
                      (Pai386(hp1)^.op2t = Pai386(p)^.op2t) And
                      OpsEqual(Pai386(hp1)^.op2t, Pai386(hp1)^.Op2, Pai386(p)^.Op2)
                     Then
@@ -1281,9 +1281,9 @@ Begin
                       with const1 > const2 }
                           Begin
                             Dec(Longint(Pai386(p)^.op1), Longint(Pai386(hp1)^.op1));
-                            Pai386(hp1)^._operator := A_And;
+                            Pai386(hp1)^.opcode := A_And;
                             Pai386(hp1)^.op1 := Pointer(1 shl Longint(Pai386(hp1)^.op1)-1);
-                            Case Pai386(p)^.Size Of
+                            Case Pai386(p)^.opsize Of
                               S_L: Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1) Xor $ffffffff);
                               S_B: Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1) Xor $ff);
                               S_W: Pai386(hp1)^.op1 := Pointer(Longint(Pai386(hp1)^.op1) Xor $ffff);
@@ -1298,9 +1298,9 @@ Begin
                       with const1 < const2 }
                               Begin
                                 Dec(Longint(Pai386(hp1)^.op1), Longint(Pai386(p)^.op1));
-                                Pai386(p)^._operator := A_And;
+                                Pai386(p)^.opcode := A_And;
                                 Pai386(p)^.op1 := Pointer(1 shl Longint(Pai386(p)^.op1)-1);
-                                Case Pai386(p)^.Size Of
+                                Case Pai386(p)^.opsize Of
                                   S_L: Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) Xor $ffffffff);
                                   S_B: Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) Xor $ff);
                                   S_W: Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) Xor $ffff);
@@ -1311,9 +1311,9 @@ Begin
                      shl     const2, %reg
                       with const1 = const2 }
                               Begin
-                                Pai386(p)^._operator := A_And;
+                                Pai386(p)^.opcode := A_And;
                                 Pai386(p)^.op1 := Pointer(1 shl Longint(Pai386(p)^.op1)-1);
-                                Case Pai386(p)^.Size Of
+                                Case Pai386(p)^.opsize Of
                                   S_B: Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) Xor $ff);
                                   S_W: Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) Xor $ffff);
                                   S_L: Pai386(p)^.op1 := Pointer(Longint(Pai386(p)^.op1) Xor $ffffffff);
@@ -1328,14 +1328,14 @@ Begin
                      GetNextInstruction(p, hp1) And
                      GetNextInstruction(hp1, hp2) And
                      (hp2^.typ = ait_instruction) And
-                     ((Pai386(hp2)^._operator = A_LEAVE) or
-                      (Pai386(hp2)^._operator = A_RET)) And
+                     ((Pai386(hp2)^.opcode = A_LEAVE) or
+                      (Pai386(hp2)^.opcode = A_RET)) And
                      (TReference(Pai386(p)^.Op1^).Base = ProcInfo.FramePointer) And
                      (TReference(Pai386(p)^.Op1^).Index = R_NO) And
                      (TReference(Pai386(p)^.Op1^).Offset >= ProcInfo.RetOffset) And
                      (hp1^.typ = ait_instruction) And
-                     (Pai386(hp1)^._operator = A_MOV) And
-                     (Pai386(hp1)^.Size = S_B) And
+                     (Pai386(hp1)^.opcode = A_MOV) And
+                     (Pai386(hp1)^.opsize = S_B) And
                      (Pai386(hp1)^.Op1t = top_ref) And
                      RefsEqual(TReference(Pai386(hp1)^.Op1^), TReference(Pai386(p)^.Op1^)) Then
                     Begin
@@ -1360,19 +1360,19 @@ Begin
                         While Assigned(hp1) And
                               (Pai(hp1)^.typ In [ait_instruction]+SkipInstr) And
                                Not((Pai(hp1)^.typ = ait_instruction) And
-                                   ((Pai386(hp1)^._operator = A_CALL) or
-                                    (Pai386(hp1)^._operator = A_PUSH) or
-                                    ((Pai386(hp1)^._operator = A_MOV) And
+                                   ((Pai386(hp1)^.opcode = A_CALL) or
+                                    (Pai386(hp1)^.opcode = A_PUSH) or
+                                    ((Pai386(hp1)^.opcode = A_MOV) And
                                      (Pai386(hp1)^.op2t = top_ref) And
                                      (TReference(Pai386(hp1)^.op2^).base = R_ESP)))) do
                           hp1 := Pai(hp1^.next);
                         If Assigned(hp1) And
                             (Pai(hp1)^.typ = ait_instruction) And
-                            (Pai386(hp1)^._operator = A_PUSH) And
-                            (Pai386(hp1)^.Size = S_W)
+                            (Pai386(hp1)^.opcode = A_PUSH) And
+                            (Pai386(hp1)^.opsize = S_W)
                           Then
                             Begin
-                              Pai386(hp1)^.size := S_L;
+                              Pai386(hp1)^.opsize := S_L;
                               If (Pai386(hp1)^.op1t = top_reg) Then
                                 Pai386(hp1)^.op1 := Pointer(Reg16ToReg32(TRegister(Pai386(hp1)^.op1)));
                               hp1 := Pai(p^.next);
@@ -1384,7 +1384,7 @@ Begin
                           Else
                             If GetLastInstruction(p, hp1) And
                                (Pai(hp1)^.typ = ait_instruction) And
-                               (Pai386(hp1)^._operator = A_SUB) And
+                               (Pai386(hp1)^.opcode = A_SUB) And
                                (Pai386(hp1)^.op1t = top_const) And
                                (Pai386(hp1)^.op2t = top_reg) And
                                (TRegister(Pai386(hp1)^.Op2) = R_ESP)
@@ -1398,8 +1398,8 @@ Begin
                     Else
                       If GetLastInstruction(p, hp1) And
                          (hp1^.typ = ait_instruction) And
-                         (Pai386(hp1)^.Size = Pai386(p)^.Size) then
-                        Case Pai386(hp1)^._operator Of
+                         (Pai386(hp1)^.opsize = Pai386(p)^.opsize) then
+                        Case Pai386(hp1)^.opcode Of
                           A_DEC:
                             If (Pai386(hp1)^.Op1t = top_reg) And
                                (Pai386(hp1)^.Op1 = Pai386(p)^.op2) Then
@@ -1438,7 +1438,7 @@ Begin
                    If (Pai386(p)^.op1 = Pai386(p)^.op2) And
                       GetLastInstruction(p, hp1) And
                       (pai(hp1)^.typ = ait_instruction) Then
-                     Case Pai386(hp1)^._operator Of
+                     Case Pai386(hp1)^.opcode Of
                        A_ADD, A_SUB, A_OR, A_XOR, A_AND, A_SHL, A_SHR:
                          Begin
                            If (Pai386(hp1)^.op2 = Pai386(p)^.op1) Then
@@ -1454,16 +1454,16 @@ Begin
                          Begin
                            If (Pai386(hp1)^.op1 = Pai386(p)^.op1) Then
                              Begin
-                               Case Pai386(hp1)^._operator Of
+                               Case Pai386(hp1)^.opcode Of
                                  A_DEC, A_INC:
  {replace inc/dec with add/sub 1, because inc/dec doesn't set the carry flag}
                                    Begin
                                      Pai386(hp1)^.opxt := Pai386(hp1)^.opxt shl 4 + top_const;
                                      Pai386(hp1)^.Op2 := Pai386(hp1)^.Op1;
                                      Pai386(hp1)^.Op1 := Pointer(1);
-                                     Case Pai386(hp1)^._operator Of
-                                       A_DEC: Pai386(hp1)^._operator := A_SUB;
-                                       A_INC: Pai386(hp1)^._operator := A_ADD;
+                                     Case Pai386(hp1)^.opcode Of
+                                       A_DEC: Pai386(hp1)^.opcode := A_SUB;
+                                       A_INC: Pai386(hp1)^.opcode := A_ADD;
                                      End
                                    End
                                  End;
@@ -1506,17 +1506,17 @@ Begin
       Case P^.Typ Of
         Ait_Instruction:
           Begin
-            Case Pai386(p)^._operator Of
+            Case Pai386(p)^.opcode Of
               A_CALL:
                 If (AktOptProcessor < ClassP6) And
                    GetNextInstruction(p, hp1) And
                    (hp1^.typ = ait_labeled_instruction) And
-                   (pai386_labeled(hp1)^._operator = A_JMP) Then
+                   (pai386_labeled(hp1)^.opcode = A_JMP) Then
                   Begin
                     hp2 := New(Pai386,op_sym(A_PUSH,S_L,NewAsmSymbol(Lab2Str(pai386_labeled(hp1)^.lab))));
                     hp2^.fileinfo := p^.fileinfo;
                     InsertLLItem(AsmL, p^.previous, p, hp2);
-                    Pai386(p)^._operator := A_JMP;
+                    Pai386(p)^.opcode := A_JMP;
                     AsmL^.Remove(hp1);
                     Dispose(hp1, Done)
                   End;
@@ -1526,7 +1526,7 @@ Begin
                      (Pai386(p)^.op2t = top_reg) And
                      GetNextInstruction(p, hp1) And
                      (hp1^.typ = ait_Instruction) And
-                     (Pai386(hp1)^._operator = A_MOV) And
+                     (Pai386(hp1)^.opcode = A_MOV) And
                      (Pai386(hp1)^.op1t = top_ref) And
                      (Pai386(hp1)^.op2t = top_reg) And
                      ((TReference(Pai386(hp1)^.op1^).Base = TRegister(Pai386(p)^.op2)) Or
@@ -1550,7 +1550,7 @@ Begin
                   If (Pai386(p)^.op2t = top_reg) Then
                     If (Pai386(p)^.op1t = top_reg)
                       Then
-                        Case Pai386(p)^.size of
+                        Case Pai386(p)^.opsize of
                           S_BL:
                             Begin
                               If IsGP32Reg(TRegister(Pai386(p)^.op2)) And
@@ -1565,8 +1565,8 @@ Begin
                                                TRegister(Pai386(p)^.op2), TRegister(Pai386(p)^.op2)));
                                     hp1^.fileinfo := p^.fileinfo;
                                     InsertLLItem(AsmL,p^.previous, p, hp1);
-                                    Pai386(p)^._operator := A_MOV;
-                                    Pai386(p)^.size := S_B;
+                                    Pai386(p)^.opcode := A_MOV;
+                                    Pai386(p)^.opsize := S_B;
                                     Pai386(p)^.op2 :=
                                       Pointer(Reg32ToReg8(TRegister(Pai386(p)^.op2)));
                                     { Jonas
@@ -1584,7 +1584,7 @@ Begin
                            Not(CS_LittleSize in aktglobalswitches) And
                            IsGP32Reg(TRegister(Pai386(p)^.op2)) And
                            (aktoptprocessor = ClassP5) And
-                           (Pai386(p)^.Size = S_BL)
+                           (Pai386(p)^.opsize = S_BL)
                           Then
                             {changes "movzbl mem, %reg" to "xorl %reg, %reg; movb mem, %reg8" for
                              Pentium and PentiumMMX}
@@ -1592,8 +1592,8 @@ Begin
                               hp1 := New(Pai386,op_reg_reg(A_XOR, S_L, TRegister(Pai386(p)^.op2),
                                          TRegister(Pai386(p)^.op2)));
                               hp1^.fileinfo := p^.fileinfo;
-                              Pai386(p)^._operator := A_MOV;
-                              Pai386(p)^.size := S_B;
+                              Pai386(p)^.opcode := A_MOV;
+                              Pai386(p)^.opsize := S_B;
                               Pai386(p)^.op2 := Pointer(Reg32ToReg8(TRegister(Pai386(p)^.op2)));
                               InsertLLItem(AsmL,p^.previous, p, hp1);
                             End;
@@ -1609,7 +1609,10 @@ End.
 
 {
  $Log$
- Revision 1.38  1999-02-25 21:02:44  peter
+ Revision 1.39  1999-02-26 00:48:22  peter
+   * assembler writers fixed for ag386bin
+
+ Revision 1.38  1999/02/25 21:02:44  peter
    * ag386bin updates
    + coff writer
 

+ 9 - 1
compiler/pstatmnt.pas

@@ -22,6 +22,11 @@
 }
 unit pstatmnt;
 
+{$ifdef Ag386Bin}
+  {$define NoRA386ATT}
+  {$define NoRA386Int}
+{$endif}
+
   interface
 
     uses tree;
@@ -1285,7 +1290,10 @@ unit pstatmnt;
 end.
 {
   $Log$
-  Revision 1.67  1999-02-22 13:07:01  pierre
+  Revision 1.68  1999-02-26 00:48:23  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.67  1999/02/22 13:07:01  pierre
     + -b and -bl options work !
     + cs_local_browser ($L+) is disabled if cs_browser ($Y+)
       is not enabled when quitting global section

+ 25 - 14
compiler/systems.pas

@@ -65,11 +65,11 @@ unit systems;
 
      type
        tasm = (as_none
-            ,as_i386_o,as_i386_o_aout,as_i386_asw,
+            ,as_i386_as,as_i386_as_aout,as_i386_asw,
             as_i386_nasmcoff,as_i386_nasmelf,as_i386_nasmobj,
             as_i386_tasm,as_i386_masm,
             as_i386_dbg,as_i386_coff,as_i386_pecoff
-            ,as_m68k_o,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
+            ,as_m68k_as,as_m68k_gas,as_m68k_mit,as_m68k_mot,as_m68k_mpw
        );
      const
        {$ifdef i386} i386asmcnt=11; {$else} i386asmcnt=0; {$endif}
@@ -224,6 +224,8 @@ unit systems;
     function set_string_asm(s : string) : boolean;
     function set_string_asmmode(s:string;var t:tasmmode):boolean;
 
+    procedure InitSystems;
+
 
 implementation
 
@@ -452,8 +454,8 @@ implementation
           )
 {$ifdef i386}
           ,(
-            id     : as_i386_o;
-            idtxt  : 'O';
+            id     : as_i386_as;
+            idtxt  : 'AS';
             asmbin : 'as';
             asmcmd : '-o $OBJ $ASM';
             externals : false;
@@ -461,8 +463,8 @@ implementation
             comment : '# '
           )
           ,(
-            id     : as_i386_o_aout;
-            idtxt  : 'O_AOUT';
+            id     : as_i386_as_aout;
+            idtxt  : 'AS_AOUT';
             asmbin : 'as';
             asmcmd : '-o $OBJ $ASM';
             externals : false;
@@ -511,7 +513,7 @@ implementation
             asmbin : 'tasm';
             asmcmd : '/m2 $ASM $OBJ';
             externals : true;
-            labelprefix : '.L';
+            labelprefix : 'L';
             comment : '; '
           )
           ,(
@@ -553,8 +555,8 @@ implementation
 {$endif i386}
 {$ifdef m68k}
           ,(
-            id     : as_m68k_o;
-            idtxt  : 'O';
+            id     : as_m68k_as;
+            idtxt  : 'AS';
             asmbin : 'as';
             asmcmd : '-o $OBJ $ASM';
             externals : false;
@@ -786,7 +788,7 @@ implementation
             exeext      : ''; { The linker produces a.out }
             os          : os_i386_GO32V1;
             link        : link_i386_ldgo32v1;
-            assem       : as_i386_o;
+            assem       : as_i386_as;
             ar          : ar_i386_ar;
             res         : res_none;
             heapsize    : 2048*1024;
@@ -813,7 +815,7 @@ implementation
 {$ifdef Ag386Bin}
             assem       : as_i386_coff;
 {$else}
-            assem       : as_i386_o;
+            assem       : as_i386_as;
 {$endif}
             ar          : ar_i386_ar;
             res         : res_none;
@@ -838,7 +840,7 @@ implementation
             exeext      : '';
             os          : os_i386_Linux;
             link        : link_i386_ld;
-            assem       : as_i386_o;
+            assem       : as_i386_as;
             ar          : ar_i386_ar;
             res         : res_none;
             heapsize    : 2048*1024;
@@ -862,7 +864,7 @@ implementation
             exeext      : ''; { The linker produces a.out }
             os          : os_i386_OS2;
             link        : link_i386_ldos2;
-            assem       : as_i386_o_aout;
+            assem       : as_i386_as_aout;
             ar          : ar_i386_ar;
             res         : res_none;
             heapsize    : 256*1024;
@@ -1257,6 +1259,7 @@ begin
 end;
 
 
+procedure InitSystems;
 begin
 { first get source OS }
   source_os.name:='';
@@ -1343,10 +1346,18 @@ begin
     {$endif atari}
   {$endif amiga}
 {$endif m68k}
+end;
+
+
+begin
+  InitSystems;
 end.
 {
   $Log$
-  Revision 1.59  1999-02-25 21:02:53  peter
+  Revision 1.60  1999-02-26 00:48:25  peter
+    * assembler writers fixed for ag386bin
+
+  Revision 1.59  1999/02/25 21:02:53  peter
     * ag386bin updates
     + coff writer