flat assembler
Message board for the users of flat assembler.
Index
> Windows > frequency counter Goto page Previous 1, 2 |
Author |
|
Jmac 28 May 2010, 13:45
Hi...
Nope did not change a thing... I might try his other version which was for a earlier chip....I think. Its either the PIT chip....or something happening when talking to the dos window... anyway...dont put anymore of your time into my problem....I thank you for your help so far.. |
|||
28 May 2010, 13:45 |
|
Jmac 28 May 2010, 14:26
Hi....
Just for trying things...I tried another 2 pieces of code for finding cpu freq.. out of 3.....1 worked on the XP......2 did not... all 3 failed on my win95 computer.....and 1 has totally frozen the computer...cant reset...cant turn it off...nothing.....hahaha......jst waiting for the power to run down....hahah |
|||
28 May 2010, 14:26 |
|
baldr 28 May 2010, 18:10
Jmac,
I wrote simple program that uses rdtsc but doesn't reprogram PIT. Try it: Code: org 0x100 include "Macro\If.Inc" macro .repeat [args] { common .repeat args } xor ax, ax mov es, ax bios_ticks equ es:0x046C mov ah, 0x0F int 0x10 ; get active page into bh mov eax, [bios_ticks] .repeat mov esi, [bios_ticks] .until esi<>eax ; wait for tick count to change cpuid rdtsc mov [start.l], eax mov [start.h], edx .repeat .until esi<>[bios_ticks] ; wait for next tick cpuid rdtsc sub eax, [start.l] sbb edx, [start.h] ; edx:eax == TSC delta for ~55 ms mov ecx, 54925 ; 54925.4 or 54924.6 µs, depends on PIT initial count div ecx ; convert TSC delta to MHz cmp dx, (54925+1)/2 ; can use dx because division is unsigned sbb eax, -1 ; round to nearest xor edx, edx ; unsigned cdq xor bl, bl ; no significant digits yet mov si, _MHz mov ecx, 1'000'000'000 conv: div ecx test al, al jnz non_0 test bl, bl ; have significant digits already? jz next non_0: or al, '0' mov bl, 0x07 ; for graphics mode (significant digits flag too) output: mov ah, 0x0E int 0x10 next: mov eax, ecx mov ecx, edx xor edx, edx idiv [_10] test eax, eax xchg eax, ecx ; eax == remainder, ecx == divisor jnz conv ; divisor nonzero, repeat lodsb ; output "MHz" trailer test al, al jnz output ret _MHz db "MHz", 13, 10, 0 label _10 dword at $-2 ; uses 10 from _MHz dw 0 align 4 start.l rd 1 start.h rd 1 |
|||
28 May 2010, 18:10 |
|
edfed 28 May 2010, 19:40
pit don't bring problems to be reprogrammed, even under xp.
i use pit in v86 mode, then, maybe it is not really pit... |
|||
28 May 2010, 19:40 |
|
baldr 28 May 2010, 23:48
edfed wrote: i use pit in v86 mode The problem is in different approach to emulation in NT and 9x. When NT simply dumps bothering application in trash can, 9x tries to do its best for compatibility (often at a price of stability). VTD.VXD, virtual timer device driver that performs system-wide (i.e. scheduler uses it too) virtualization of PIT, in Win98SE is barely 14 KiB. And when it drops the ball (probably due to some program fiddling with ports)… well, IRQ0 has highest priority, without its proper handling all other IRQs wither and die. |
|||
28 May 2010, 23:48 |
|
Jmac 29 May 2010, 01:32
Hi all..
well I tried that code you provided....it does not work on my XP...DOS window comes up but nothing displays in it....then closes very quick On the win95 it gives the same error as the other one.. ok....its looking like the win95 computer may not have a PIT....is that at all possible as its used for other system timing as far as I know... is there a simple test to see if there is one.....something similar to test the eax register to check rdtsc and others... john |
|||
29 May 2010, 01:32 |
|
bitshifter 29 May 2010, 01:38
Either run it on console (to pause) or add this code to wait 4 key...
Code: mov ah,0 int 0x16 ret I got a speedy 3181mhz single core |
|||
29 May 2010, 01:38 |
|
baldr 29 May 2010, 07:22
Jmac wrote: On the win95 it gives the same error as the other one. bitshifter wrote: I got a speedy 3181mhz single core |
|||
29 May 2010, 07:22 |
|
Jmac 29 May 2010, 11:30
hi...
ahh....the GPF was at location 0A11:011A |
|||
29 May 2010, 11:30 |
|
baldr 29 May 2010, 12:45
Jmac,
It's rdtsc again. Reboot to safe mode command prompt and try again. Post chkcpu /v output here. |
|||
29 May 2010, 12:45 |
|
bitshifter 29 May 2010, 12:49
baldr wrote: Is this result stable? Yep, it is within around 5% accuracy when i ran it a few times on XP2 _________________ Coding a 3D game engine with fasm is like trying to eat an elephant, you just have to keep focused and take it one 'byte' at a time. |
|||
29 May 2010, 12:49 |
|
baldr 29 May 2010, 16:14
bitshifter,
And what is the real frequency? Or you're telling about 5% difference from it? |
|||
29 May 2010, 16:14 |
|
bitshifter 30 May 2010, 00:16
Its rated at 2.66ghz.
|
|||
30 May 2010, 00:16 |
|
Jmac 31 May 2010, 09:19
Hi all...
Just an update.....I tried a simpler code just using the rdtsc and Sleep function......also I went with opening a MessageBox to display the speed and it comes up with the right speed...well close enough to say its working...not accurate..but cant expect much using the Sleep......it was just a test of the rdtsc function more than anything.... So it would seem it does work.....and the DOS window maybe the problem. John |
|||
31 May 2010, 09:19 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.