Board index » delphi » Diffrent CPU Speeds

Diffrent CPU Speeds

Hi out there !

I need help with these diffrent CPU speeds !!
I don't know how to fix tht problem, but all my programs, (usually
graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
Former i used a 486 DX 40 MHz for programming.
Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is
to fast. If i use DELAY
it's too slow on 486 and less systems.

Thanx for help - Roger (rbi...@centralnet.ch)

 

Re:Diffrent CPU Speeds


Quote
On Wed, 29 Oct 1997, Roger Bieri wrote:
}Hi out there !
}
}I need help with these diffrent CPU speeds !!
}I don't know how to fix tht problem, but all my programs, (usually
}graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
}Former i used a 486 DX 40 MHz for programming.
}Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is
}to fast. If i use DELAY
}it's too slow on 486 and less systems.
}
}Thanx for help - Roger (rbi...@centralnet.ch)
}

The simple solution is to tie the program running speed to the timer tick
interrupt, or to tie it to the screen refresh rate.  The timer tick is
probably better, as you could miss a refresh, and get jerky action. The
timer tick is interrupt 0, so just hook int 0, and remember to call the
original int after you finish setting a next-turn flag.  Normally the
timer ticks about 18.2 times/sec, but it is possible to speed it up
(making sure the original int is still called at the same 18.2 times/sec.)

Another solution, which is a bit of a kludge but workable, is to get
the system time, do something, and get the system time again, and
calculate what length delay the computer needs based on this, and
just use delay(delay_len).

-Somebody mhm 17x2

filter bait:    He will assassinate the president, but needs the password.
  -export-a-crypto-system-sig-    RC4 in 3 lines of PERL
 #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
 $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
 lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)

Re:Diffrent CPU Speeds


Quote
Roger Bieri wrote:
> Hi out there !

> I need help with these diffrent CPU speeds !!
> I don't know how to fix tht problem, but all my programs, (usually
> graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
> Former i used a 486 DX 40 MHz for programming.
> Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is

> to fast. If i use DELAY
> it's too slow on 486 and less systems.

> Thanx for help - Roger (rbi...@centralnet.ch)

The most simple thing to do here, is use a VerticalRetrace timer... this
can be used to time your graphics to the  VGA-card retrace scanning,
wich is on most graphic cards (all?) about 70mHz.Use this:

PROCEDURE Retrace; Assembler;
ASM
    MOV DX,$3DA
 @WaitEnd:
    IN AL,DX
    TEST AL,8
    JNZ @WaitEnd
 @WaitStart:
    IN AL,DX
    TEST AL,8
    JZ @WaitStart
END;

I know there are other techniques (using ints), but this is the easiest
and most often used.

Greets,
--
Pascal Bestebroer
Just4Fun Productions
internet: http://people.zeelandnet.nl/rpb/
e-mail  : just4...@zeelandnet.nl
ICQ : 2309110

Re:Diffrent CPU Speeds


Quote
On Wed, 29 Oct 1997, Roger Bieri wrote:
> Hi out there !

> I need help with these diffrent CPU speeds !!
> I don't know how to fix tht problem, but all my programs, (usually
> graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
> Former i used a 486 DX 40 MHz for programming.
> Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is
> to fast. If i use DELAY
> it's too slow on 486 and less systems.

> Thanx for help - Roger (rbi...@centralnet.ch)

You can use GetTime to implement a different version of delay that work
well on all machines.

Bye, Piero.

Re:Diffrent CPU Speeds


In <3456AC82.F00E3...@centralnet.ch>,

Quote
Roger Bieri <rbi...@centralnet.ch> wrote:
> I need help with these diffrent CPU speeds !!
> I don't know how to fix tht problem, but all my programs, (usually
> graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
> Former i used a 486 DX 40 MHz for programming.
> Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is
> to fast. If i use DELAY
> it's too slow on 486 and less systems.

Actually, Delay works correctly on slower systems and too fast on somewhat
faster systems. On even faster systems (the limit seems to be somewhere
around 200 MHz), it causes a runtime error 200 at startup. You can find
a solution on my page.

Somebody <pstol...@shrike.depaul.edu.flonk.flonk.flonk> replied:

Quote
> Another solution, which is a bit of a kludge but workable, is to get
> the system time, do something, and get the system time again, and
> calculate what length delay the computer needs based on this, and
> just use delay(delay_len).

Actually, that's (almost) what Delay already does -- except that the code
is broken...

--
Frank Heckenbach, Erlangen, Germany
heckenb@[NOSPAM.REMOVE.THIS]mi.uni-erlangen.de
Internet links:        http://home.pages.de/~fjf/links.htm
Turbo Pascal programs: http://home.pages.de/~fjf/programs.htm

Re:Diffrent CPU Speeds


Quote
> > I need help with these diffrent CPU speeds !!
> > I don't know how to fix tht problem, but all my programs, (usually
> > graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
> > Former i used a 486 DX 40 MHz for programming.
> > Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is
> > to fast. If i use DELAY it's too slow on 486 and less systems.

> > Thanx for help - Roger (rbi...@centralnet.ch)

> The most simple thing to do here, is use a VerticalRetrace timer... this
> can be used to time your graphics to the  VGA-card retrace scanning,
> wich is on most graphic cards (all?) about 70mHz.Use this:

> PROCEDURE Retrace; Assembler;
> ASM
>     MOV DX,$3DA
>  @WaitEnd:
>     IN AL,DX
>     TEST AL,8
>     JNZ @WaitEnd
>  @WaitStart:
>     IN AL,DX
>     TEST AL,8
>     JZ @WaitStart
> END;

Another way to do things: At $0040:$006C (or Seg0040:$6C for BP7 and DMPI)
the BIOS tick counter is stored. This counter is counted up about 18.2
times per second. Use code like this (real mode only, for protected mode
you'll have to use a pointer to the Timer):

 var
   Timer: LongInt absolute $0040:$006C;

 procedure Wait;
 var
   X: LongInt;
 begin
   X:=Timer;
   while X=Timer do;
 end;

 begin
   repeat
     {Do you GFX here}
     Wait;
   until {Abort condition};
 end.

Arsne von Wyss
avonwyss @ beaulieu-software.ch

Visit my homepage: http://www.beaulieu-software.ch/avonwyss

******************************************************
*    I removed my reply address to avoid spamming.   *
* Please use the address above to reply or write me. *
******************************************************

Re:Diffrent CPU Speeds


In article <01bce57c$60858600$0101a8c0@lemming> of Fri, 31 Oct 1997
20:21:19 in comp.lang.pascal.borland, =?ISO-8859-1?Q?Ars=E8ne_von_Wyss_=
5BAntispam_-_email_address_in_messag?=  =?ISO-8859-1?Q?e=5D?=

Quote
<avonw...@beaulieu-software.nospam.ch> wrote:
>Another way to do things: At $0040:$006C (or Seg0040:$6C for BP7 and DMPI)
>the BIOS tick counter is stored. This counter is counted up about 18.2
>times per second. Use code like this (real mode only, for protected mode
>you'll have to use a pointer to the Timer):

> var
>   Timer: LongInt absolute $0040:$006C;

> procedure Wait;
> var
>   X: LongInt;
> begin
>   X:=Timer;
>   while X=Timer do;
> end;

To be safe, access to this Timer has to be atomic - see
Web URL: http://www.merlyn.demon.co.uk/pas-time.htm#Atom

--
John Stockton, Surrey, UK.    j...@merlyn.demon.co.uk    Turnpike v1.12    MIME.
  Web URL: http://www.merlyn.demon.co.uk/ - TP/BP/&c. FAQqish topics and links.
  Timo's TurboPascal <A HREF="ftp://garbo.uwasa.fi/pc/link/tsfaqp.zip">FAQ</A>.
  <A HREF="http://www.merlyn.demon.co.uk/clpb-faq.txt">Mini-FAQ</A> of c.l.p.b.

Re:Diffrent CPU Speeds


In article: <01bce57c$60858600$0101a8c0@lemming>  
"=?ISO-8859-1?Q?Ars=E8ne_von_Wyss_=5BAntispam_-_email_address_in_messag?=
writes:

Quote

>> > I need help with these diffrent CPU speeds !!
>> > I don't know how to fix tht problem, but all my programs, (usually
>> > graphics) do run too fast on new Pentium or Cyrix CPU's 100 MHz up.
>> > Former i used a 486 DX 40 MHz for programming.
>> > Now i use a Cyrix 200 Mhz. Sound is aways ok. But the program stuff is
>> > to fast. If i use DELAY it's too slow on 486 and less systems.

>> > Thanx for help - Roger (rbi...@centralnet.ch)

>> The most simple thing to do here, is use a VerticalRetrace timer... this
>> can be used to time your graphics to the  VGA-card retrace scanning,

That's not what the guy ask for. Basically what he wants is a "System (CPU)
Speed" figure.

Quote
>> wich is on most graphic cards (all?) about 70mHz.Use this:

The vertical sync is definately not a good way to determine CPU speed because
the VR time is totally non-standard and could be anything from 60Hz to ~82Hz.
The high end of this range could go higher in the future.

What's wrong with using the system timer to determine the "System Power Factor"?

-- Jay

 --------------------------------------------------------------------------
| Jason Burgon - author of Graphic Vision, TV-Like GUI for 256 Colour SVGA |
| g...@jayman.demon.co.uk   ftp://SimTel/msdos/turbopas/gv4svga1.zip         |
| ***NEW VERSION OF GV AVAILABLE FROM*** -> http://www.jayman.demon.co.uk  |
 --------------------------------------------------------------------------

Other Threads