Board index » delphi » delay() on new computers

delay() on new computers

Hi,

I used the delay()-function in a game to slow it down.
The function should delay the programm a 1/1000
second. It works very fine on old comuters; the new
ones are faster - too fast!!

Is there a possibility to make the function work on
new comps? Or does anybody have another function
to slow down the programm exactly on old and new
comps??

Thanks!

thommy.schu...@planet-interkom.de

 

Re:delay() on new computers


Quote
Thommy Schuetz wrote:

> I used the delay()-function in a game to slow it down.
> The function should delay the programm a 1/1000
> second. It works very fine on old comuters; the new
> ones are faster - too fast!!

> Is there a possibility to make the function work on
> new comps? Or does anybody have another function
> to slow down the programm exactly on old and new
> comps??

This question is related very narrow to the famous CRT RTE200
FAQ. Look for NewDelay.PAS and similar approaches here:
http://www.geocities.com/SiliconValley/2926/tpf.html
chapter "patches".

You should consider that the primitive Delay(nnn) procedure
of TP is totally outperformed in days of multitasking. Why
waste CPU power when it could be used by concurrently running
tasks! Well, you mentioned few milliseconds, but anyway.
--
Franz Glaser, Glasau 3, A-4191 Vorderweissenbach Austria +43-7219-7035-0
Muehlviertler Elektronik Glaser.  Industrial control and instrumentation
------------------------------------------------------------------------
http://members.eunet.at/meg-glaser/           mailto:meg-gla...@eunet.at
http://www.geocities.com/~franzglaser/ http://members.xoom.com/f_glaser/

Re:delay() on new computers


  The following waits for about the same on different speed computers (this
isn't the fix or anything for the CRT RTE200 bug)  I'm not exactly sure how
this procedure reacts at midnight, and perhaps someone has better, but here
this is...

VAR
  TicksSinceMidNight : LongInt ABSOLUTE $0040:$006c;

PROCEDURE Wait(TimeDelay : LongInt);
VAR
  Counter : LongInt;
BEGIN
  TimeDelay := Round(TimeDelay/54.925529502);
  Counter := TimeDelay + TicksSinceMidnight;
  IF Counter > (1573039) THEN BEGIN
    Counter := Counter - (1573039);
    WHILE NOT (TicksSinceMidnight <= Counter) DO {nata};
  END;
  WHILE (Counter > TicksSinceMidnight) DO {nata};
END;

--
- MidSpeck ( MidSpeck_REMO...@netscape.net )
Return address is messed to deter spam.
Before replying, take out _REMOVE_

Quote
Thommy Schuetz wrote in message ...
>Hi,

>I used the delay()-function in a game to slow it down.
>The function should delay the programm a 1/1000
>second. It works very fine on old comuters; the new
>ones are faster - too fast!!

>Is there a possibility to make the function work on
>new comps? Or does anybody have another function
>to slow down the programm exactly on old and new
>comps??
>Thanks!

>thommy.schu...@planet-interkom.de

Re:delay() on new computers


Quote
MidSpeck (MidSpeck_REMO...@netscape.net) wrote:

: VAR
:   TicksSinceMidNight : LongInt ABSOLUTE $0040:$006c;

This clock ticks only 18.2 times per second,
so it can not be used for high resolution delay or timing.
See htimers in the pascal sources on my web home page
for how to increase the resolution of this clock
without reprogramming the interrupt frequency.
There's also a list of solutions for the
run time error 200 problem there.

Klaus
--
Klaus Hartnegg, Institut fuer Biophysik, Hansa-Strasse 9a, D-79104 Freiburg
hartn...@uni-freiburg.de   http://www.brain.uni-freiburg.de/~klaus/

Re:delay() on new computers


On Thu, 15 Apr 1999 20:48:20 +0200, "Thommy Schuetz"

Quote
<thommy.schu...@planet-interkom.de> wrote:
>Hi,

>I used the delay()-function in a game to slow it down.
>The function should delay the programm a 1/1000
>second. It works very fine on old comuters; the new
>ones are faster - too fast!!

>Is there a possibility to make the function work on
>new comps? Or does anybody have another function
>to slow down the programm exactly on old and new
>comps??

>Thanks!

>thommy.schu...@planet-interkom.de

Hi

Use this procedure instead of Delay():

Procedure NewDelay(ms: Word); Assembler;
Asm
        MOV     AX,1000
        MUL     ms
        MOV     CX,DX
        MOV     DX,AX
        MOV     AH,$86
        INT     $15
End;

The delay is in miliseconds (actualy you can make 1 mikrosecond long
delay. Just replace the 1000 with 1)

Bye, Conrad
-----------------------------------------------
TomySoftware's home page:

Pascal & 80x86 Assembler programming page with
some downloads, sources and links.

http://www.geocities.com/SiliconValley/Lab/2503
-----------------------------------------------

Re:delay() on new computers


Quote
Conrad (u...@host.com) wrote:

: Use this procedure instead of Delay():

: Procedure NewDelay(ms: Word); Assembler;
: Asm
:       MOV     AX,1000
:       MUL     ms
:       MOV     CX,DX
:       MOV     DX,AX
:       MOV     AH,$86
:       INT     $15
: End;

: The delay is in miliseconds (actualy you can make 1 mikrosecond long
: delay. Just replace the 1000 with 1)

Please read the note contained in Ralf Brown's interrupt listing:

--------B-1586-------------------------------
INT 15 - BIOS - WAIT (AT,PS)
        AH = 86h
        CX:DX = interval in microseconds
Return: CF clear if successful (wait interval elapsed)
        CF set on error or AH=83h wait already in progress
            AH = status (see #00496)
Note:   the resolution of the wait period is 977 microseconds on many systems
          because many BIOSes use the 1/1024 second fast interrupt from the AT
          real-time clock chip which is available on INT 70; because newer
          BIOSes may have much more precise timers available, it is not
          possible to use this function accurately for very short delays unless
          the precise behavior of the BIOS is known (or found through testing)
SeeAlso: AH=41h,AH=83h,INT 1A/AX=FF01h,INT 70

--
Klaus Hartnegg, Institut fuer Biophysik, Hansa-Strasse 9a, D-79104 Freiburg
hartn...@uni-freiburg.de   http://www.brain.uni-freiburg.de/~klaus/

Re:delay() on new computers


On 3 May 1999 18:48:51 GMT, hartn...@sun2.ruf.uni-freiburg.de (Klaus

Quote
Hartnegg) wrote:
>Please read the note contained in Ralf Brown's interrupt listing:

>--------B-1586-------------------------------
>INT 15 - BIOS - WAIT (AT,PS)
>        AH = 86h
>        CX:DX = interval in microseconds
>Return: CF clear if successful (wait interval elapsed)
>        CF set on error or AH=83h wait already in progress
>            AH = status (see #00496)
>Note:   the resolution of the wait period is 977 microseconds on many systems
>          because many BIOSes use the 1/1024 second fast interrupt from the AT
>          real-time clock chip which is available on INT 70; because newer
>          BIOSes may have much more precise timers available, it is not
>          possible to use this function accurately for very short delays unless
>          the precise behavior of the BIOS is known (or found through testing)
>SeeAlso: AH=41h,AH=83h,INT 1A/AX=FF01h,INT 70

>--
>Klaus Hartnegg, Institut fuer Biophysik, Hansa-Strasse 9a, D-79104 Freiburg
>hartn...@uni-freiburg.de   http://www.brain.uni-freiburg.de/~klaus/

Thanks. I didn't know that.

-----------------------------------------------
TomySoftware's home page:

Pascal & 80x86 Assembler programming page with
some downloads, sources and links.

http://www.geocities.com/SiliconValley/Lab/2503
-----------------------------------------------

Other Threads