According to what you wanted, here is some bootloader code that performs a kind of test that can probably be used to measure MIPS in some way. The main goal here was low-level, and I believe that this is the lowest level at which you can really program on a PC, unless you want to replace your BIOS or something like that.
, -, ( add s, sub ) . ITERS. , , .
rdtsc, , 64- edx eax. , , . , BIOS 10h . , , , .
. NASM -f bin, , - , dd. . USB-, BIOS. , , .
bits 16
org 0x7c00
ITERS equ 1000000
jmp 0x0000:start
start:
cli
xor ax, ax
mov ds, ax
mov ss, ax
mov sp, stack_end
rdtsc
mov [old_rdtsc], eax
mov [old_rdtsc+4], edx
mov eax, ITERS
.loop:
add ebx, ecx
add ecx, edx
sub eax, 1
jnz .loop
rdtsc
sub eax, [old_rdtsc]
sbb edx, [old_rdtsc+4]
mov si, 15
.fillbuf_eax:
mov edi, eax
shr eax, 4
and di, 0xf
mov bl, [hex_chars+di]
mov [str_buf+si], bl
sub si, 1
cmp si, 7
ja .fillbuf_eax
.fillbuf_edx:
mov edi, edx
shr edx, 4
and di, 0xf
mov bl, [hex_chars+di]
mov [str_buf+si], bl
sub si, 1
jns .fillbuf_edx
mov ah, 0xe
xor bx, bx
.bios_write:
pusha
mov al, [str_buf+bx]
int 10h
popa
add bx, 1
cmp bx, 16
jb .bios_write
sti
.halt:
hlt
jmp .halt
hex_chars db "0123456789ABCDEF"
old_rdtsc resq 1
str_buf resb 16
STACK_SIZE equ 200
stack resb STACK_SIZE
stack_end equ $
times 510-($-$$) db 0x90
db 0x55, 0xaa
AMD Athlon XP 1700+ 0x1e8596 , 2000278 . 1466 , 1,36 .