Hi,
That piece of code wont work because in the kernel, you are in protected mode so all interrupts cause triple fault (sounds like what you are getting with bochs) until you write your own interrupt table and handlers.
Also, it seems that you are trying to use a DOS interrupt not a BIOS one (cant remember where the split is so this might not be accurate). This means that it will not work unless you are using DOS as an OS (which you arnt).
My suggestions are either:
1) write interrupt handlers and learn how to use the Programmable Interrupt Timer to signal when a certain time has elapsed.
2) If you have a Pentium Processor or later, you can use the RDTSC (ReaD TimeStamp Counter) instruction. There is information about its complete use in the Intel Reference manuals (253666 and 253667). Basically, it is a counter that is incremented on every clock tick.
e.g.
Code: Select all
wait_time: dq 0;reserve 64bits for value
...
rdtsc ;loads edx:eax with timestamp
add eax,0x3b9aca00 ;add 1billion to tsc value (1 second on a 1Ghz processor - you will have to alter this value to get a decent time)
adc edx,0 ;make sure any carry is accounted for
mov dword [wait_time],edx
mov dword [wait_time+4],eax ;store values
wait_loop:
rdtsc
cmp edx,dword [wait_time]
jl wait_loop
cmp eax,dword [wait_time+4]
jl wait_loop
;Your specified time has now elapsed
Note: This is untested code but its meaning should be clear.
Hope this helps,
Andrew