; Print the computer's clock speed once each second .686 .mmx .model flat public _main extern _printf: near extern _time: near .data ticks dq 0 ; previous time in clock cycles fmt db "%u %u",10,0 .code _main: add esp, -12 ; Wait until clock advances 1 second L1: xor eax, eax mov [esp], eax call _time mov ebx, eax L2: ; loop while time(0) == previous time(0) in ebx call _time cmp eax, ebx je L2 ; Print clock count minus count from 1 second ago rdtsc mov ebx, eax mov ecx, edx sub eax, dword ptr [ticks] sbb edx, dword ptr [ticks+4] mov dword ptr [ticks], ebx mov dword ptr [ticks+4], ecx mov [esp], offset fmt mov [esp+4], edx mov [esp+8], eax call _printf jmp L1 end