Browse Source

* NOATTCDQ define

peter 27 years ago
parent
commit
842c6be313
2 changed files with 22 additions and 75 deletions
  1. 14 74
      rtl/dos/crt.pp
  2. 8 1
      rtl/i386/i386.inc

+ 14 - 74
rtl/dos/crt.pp

@@ -99,10 +99,6 @@ implementation
 uses
 uses
   go32;
   go32;
 
 
-{$ifdef VER0_99_5}
-  {$I386_DIRECT} {due to a bug in the assembler reader using a  }
-                 { call to a symbol will crash under FPC 0.99.5 }
-{$endif}
 
 
 {$ASMMODE ATT}
 {$ASMMODE ATT}
 
 
@@ -499,77 +495,19 @@ end;
                                    Delay
                                    Delay
 *************************************************************************}
 *************************************************************************}
 
 
-{$ifdef VER0_99_5}
-
-{ Workaround for ATT reader with CALL }
-procedure Delayloop;
-begin
-  asm
+procedure Delayloop;assembler;
+asm
 .LDelayLoop1:
 .LDelayLoop1:
         subl    $1,%eax
         subl    $1,%eax
         jc      .LDelayLoop2
         jc      .LDelayLoop2
         cmpl    %fs:(%edi),%ebx
         cmpl    %fs:(%edi),%ebx
         je      .LDelayLoop1
         je      .LDelayLoop1
 .LDelayLoop2:
 .LDelayLoop2:
-  end;
 end;
 end;
 
 
 
 
-procedure initdelay;
-begin
-  asm
-        movl    $0x46c,%edi
-        movl    $-28,%edx
-        movl    %fs:(%edi),%ebx
-.LInitDel1:
-        cmpl    %fs:(%edi),%ebx
-        je      .LInitDel1
-        movl    %fs:(%edi),%ebx
-        movl    %edx,%eax
-        call    _CRT$$_DELAYLOOP
-
-        notl    %eax
-        xorl    %edx,%edx
-        movl    $55,%ecx
-        divl    %ecx
-        movl    %eax,_DELAYCNT
-  end;
-end;
-
-
-procedure Delay(MS: Word);
-begin
-  asm
-        movzwl  MS,%ecx
-        jecxz   .LDelay2
-        movl    $0x400,%edi
-        movl    _DELAYCNT,%edx
-        movl    %fs:(%edi),%ebx
-.LDelay1:
-        movl    %edx,%eax
-        call    _CRT$$_DELAYLOOP
-        loop    .LDelay1
-.LDelay2:
-  end;
-end;
-
-{$else}
-procedure Delayloop;
-begin
-  asm
-.LDelayLoop1:
-        subl    $1,%eax
-        jc      .LDelayLoop2
-        cmpl    %fs:(%edi),%ebx
-        je      .LDelayLoop1
-.LDelayLoop2:
-  end;
-end;
-
-
-procedure initdelay;
-begin
-  asm
+procedure initdelay;assembler;
+asm
         movl    $0x46c,%edi
         movl    $0x46c,%edi
         movl    $-28,%edx
         movl    $-28,%edx
         movl    %fs:(%edi),%ebx
         movl    %fs:(%edi),%ebx
@@ -585,13 +523,11 @@ begin
         movl    $55,%ecx
         movl    $55,%ecx
         divl    %ecx
         divl    %ecx
         movl    %eax,DelayCnt
         movl    %eax,DelayCnt
-  end;
 end;
 end;
 
 
 
 
-procedure Delay(MS: Word);
-begin
-  asm
+procedure Delay(MS: Word);assembler;
+asm
         movzwl  MS,%ecx
         movzwl  MS,%ecx
         jecxz   .LDelay2
         jecxz   .LDelay2
         movl    $0x400,%edi
         movl    $0x400,%edi
@@ -602,11 +538,8 @@ begin
         call    DelayLoop
         call    DelayLoop
         loop    .LDelay1
         loop    .LDelay1
 .LDelay2:
 .LDelay2:
-  end;
 end;
 end;
 
 
-{$endif VER0_99_5}
-
 
 
 procedure sound(hz : word);
 procedure sound(hz : word);
 begin
 begin
@@ -618,7 +551,11 @@ begin
   asm
   asm
         movzwl  hz,%ecx
         movzwl  hz,%ecx
         movl    $1193046,%eax
         movl    $1193046,%eax
+{$ifdef NOATTCDQ}	
         cltd
         cltd
+{$else}
+	cdq
+{$endif}		
         divl    %ecx
         divl    %ecx
         movl    %eax,%ecx
         movl    %eax,%ecx
         movb    $0xb6,%al
         movb    $0xb6,%al
@@ -983,7 +920,10 @@ end.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.14  1998-11-26 23:14:52  jonas
+  Revision 1.15  1998-11-28 14:09:48  peter
+    * NOATTCDQ define
+
+  Revision 1.14  1998/11/26 23:14:52  jonas
     * changed cdq to cltd in AT&T assembler block
     * changed cdq to cltd in AT&T assembler block
 
 
   Revision 1.13  1998/08/26 10:01:54  peter
   Revision 1.13  1998/08/26 10:01:54  peter

+ 8 - 1
rtl/i386/i386.inc

@@ -616,7 +616,11 @@ begin
         movb    $0x2d,1(%edi)   // put '-' in String
         movb    $0x2d,1(%edi)   // put '-' in String
         incl    %ecx
         incl    %ecx
 .LM2:
 .LM2:
+{$ifdef NOATTCDQ}
         cltd
         cltd
+{$else}
+        cdq
+{$endif}
         idivl   %esi,%eax
         idivl   %esi,%eax
         addb    $0x30,%dl       // convert Rest to ASCII.
         addb    $0x30,%dl       // convert Rest to ASCII.
         movb    %dl,-12(%ebp,%ebx)
         movb    %dl,-12(%ebp,%ebx)
@@ -718,7 +722,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.32  1998-11-26 23:15:08  jonas
+  Revision 1.33  1998-11-28 14:09:49  peter
+    * NOATTCDQ define
+
+  Revision 1.32  1998/11/26 23:15:08  jonas
     * changed cdq to cltd in AT&T assembler block
     * changed cdq to cltd in AT&T assembler block
 
 
   Revision 1.31  1998/11/26 21:33:58  peter
   Revision 1.31  1998/11/26 21:33:58  peter