Making a timer with the 8H interrupt...

GeSuN

Senior member
Feb 4, 2002
317
0
0
In our assembly class, we have to do a timer in assembler where you will put a value in seconds and the computer will display the count-down.

We're supposed to use the interrupt 8H wich provides a signal every 54.9254 milliseconds. This interrupt calls the software interrupt 1CH, wich is an "empty" function where we can put what we want.

Our teacher told us not to use the " INT 8H" call in our program... He says we don't need it... Why??? Usually when we use interrupts we always called the INT <interrupt number>, but now we can't... How can you do this? I'm sorry if I'm not clear, I'm pretty mixed up myself.

Can someone tell me what the program would look like? It's assembler for x86 architecture...

 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
IIRC, int 8 is a hardware interrupt. every ~55ms, it gets executed. you said it calls a software interrupt 1C. you aren't really using int 8 to accomplish something... normally, if you want to display a string on the screen, you might set some registers and call int 21 (for DOS ;)). Int 21 is doing something for you.

however, in this case, you want to do something whenever somebody else (hardware clock) calls int 8. the effect is that your code gets run once every ~55ms.

if you were to call int 8 yourself (I dont know why you would), it would call int 1c, which would run your code, calling int 8 again, and crashing the system (unless you did some checking to see if you'd already been called).

the code you want to write could compare the current time to the start time, and based on that figure out how many seconds to display, and then display it. I'm not sure where you would store the start time and the number of seconds remaining though.