hello
i want to make a prog(16 bits, real mode) which will count from 5 mins backwards to 0.

i want to make is smallest as possible.
the problem i have is how to measure a second...
i thought using something like:
mov cx, 18
hlt
loop $-1

int 0x1a
or maybe dos get time

what you say??

thanks
Posted on 2002-05-24 11:51:36 by arkon
They used to do this:

time per loop = cycles per loop * time per cycle

total time = # of loops * time per loop
Posted on 2002-05-24 15:41:26 by bdjames
errr, what do you want a timer for?
Posted on 2002-05-24 15:50:12 by bdjames
i want to count.....

in c i would do
time t;
gettime(&t);

long current_sec = t.ti_sec + t.ti_min * 60 + t.ti_hour * 3600;

but that would be a lot of code in asm

i thought using the cmos clock
Posted on 2002-05-24 17:53:51 by arkon
Hi Arkon,

This pack included all dos timers - 8254 - Day and time counters examples. May be help you. :)

have nice days!
Posted on 2002-05-24 19:20:54 by CYDONIA
you say using the PIT? ;
thanks for the file
Posted on 2002-05-25 02:40:20 by arkon
Hi!

I use long time ago PIT ( Programmable Interval Timer)



countdown equ 8000h ; approx 36 interrupts per second

cli
mov al,00110110b ; bit 7,6 = (00) timer counter 0
; bit 5,4 = (11) write LSB then MSB
; bit 3-1 = (011) generate square wave
; bit 0 = (0) binary counter
out 43h,al ; prep PIT, counter 0, square wave&init count
jmp $+2
mov cx,countdown ; default is 0x0000 (65536) (18.2 per sec)
; interrupts when counter decrements to 0
mov al,cl ; send LSB of timer count
out 40h,al
jmp $+2
mov al,ch ; send MSB of timer count
out 40h,al
jmp $+2
sti


(code from pchelp 2.1)

have nice days,
Posted on 2002-05-25 18:56:04 by CYDONIA