org 0x100     ; com program
mov bx,0xb800 ; vi skal skrive tiden .....
mov si,i64 ; vores integer
xor di,di
mov ax,0x0003
mov es,bx  ; skærm placering ..
int 0x10 ; skift skærm tilstand
xor eax,eax
cpuid
;----------------------------------------
call timing
;----------------------------------------


;----------------------------------------
mov si,i64.e
call timing
mov si,i64
call time.print
add di,0xa0-16*2
mov si,i64.e
call time.print

;----------------------------------------
mov ax,0x0000
int 0x16
hlt
jmp $
;----------------------------------------
timing:
rdtsc ; hent "clocks"

mov [si],eax
mov [si+2],edx

ret
;----------------------------------------
time.print:
mov cx,0x10
time.loop:
lodsb
call num.make
push ax
mov ah,0x0f
stosw
pop ax
mov al,ah
mov ah,0x0f
dec cx
jnz time.loop
ret
;----------------------------------------
num.make:
     xor ah,ah	; insuure no errors.
     shl ax,0x4 ; split the number in 2, 1 in ah, and 1 in al.
     shr al,0x4; shift the number back to the lower part of al
     add ah,0x30 ; now ah is ready.
     add al,0x30; now al is also a valiad number
     ret













;---------------------------------------- label
i64: dq 0x0000000000000000	  ; start
i64.e: dq 0x0000000000000000	  ; end