
Wanted: VB3 Timer with millisecond accuracy.
Quote:
>Can someone point me in the right direction for a routine or vbx that can
>allow me to time with millisecond accuracy?
If you want really high-resolution timing (and you have a Pentium) you can
use the semi-undocumented RDTSC instruction to get an 8-byte count that
increments at the processor's internal clock rate. For example, on a P100 the
count is in increments of 10 ns. You need a DLL to execute the instruction,
but it's very simple. Here's the procedure I use, in 16-bit Borland
Pascal:
procedure RDTSC(var t:Comp); export; {Comp is the same as VB Currency }
begin
asm
DB $0F,$31 {RDTSC}
LES BX,t {Address of 8-byte area}
DB $66 {Make next instruction 32-bit}
MOV ES:[BX],AX {Store EAX}
DB $66 {Make next instruction 32-bit}
MOV ES:[BX+4],DX {Store EDX}
end
end;