tommath/timer.asm

34 lines
536 B
NASM
Raw Normal View History

2003-02-28 11:02:06 -05:00
; Simple RDTSC reader for NASM
;
; build with "nasm -f ___ timer.asm" where ___ is coff or elf [or whatever]
;
; Most *nix installs use elf so it would be "nasm -f elf timer.asm"
;
; Tom St Denis
[bits 32]
[section .data]
timer dd 0, 0
[section .text]
2003-02-28 11:06:22 -05:00
[global _gettsc]
_gettsc:
rdtsc
ret
2003-02-28 11:02:06 -05:00
[global _rdtsc]
_rdtsc:
rdtsc
sub eax,[timer]
sbb edx,[timer+4]
ret
[global _reset]
_reset:
push eax
push edx
rdtsc
mov [timer],eax
mov [timer+4],edx
pop edx
pop eax
ret