I want to trigger and handle a timer interrupt (INT 08H) in DOS real mode. I need an example how can I achieve it using INT 21h with the functions 25h and 35h. I am using NASM for assembly programming and gcc for c programming.
My algorithm should be like
main()
{
...
...
intialize 8259 pic;
program 8253 for desired time interval (interrupt for every 10 ms);
while(1);/* infinite loop */
}
---assembly code---
timer_isr_hook:
Hook the user defined timer interrupt isr to the timer interrupt(08).
timer_isr:
save the registers
call timer_hand /* this should be a c function in which I want to call
the scheduler module */
restore the registers
iret
Can anyone come with a good solution for this???
Timer interrupt handling in DOS real mode using gcc and NASM
-
- Member
- Posts: 132
- Joined: Wed Nov 03, 2004 12:00 am
- Location: Austria
- Contact:
my advice is, to read the Intel manuals for programming the 8259 but you will find enough code if you search on google.
as you said that you want to use int 21h in DOS mode so here is an little example how to install an ISR:
mov dx, your_isr ; offset of your timer int, don't forget to load ds with the right segment
mov ax, 2505h ; interrupt vector 5 and function 25
CLI ; disable all ints
INT 21h
STI ;enable all ints
hope this will help ya
as you said that you want to use int 21h in DOS mode so here is an little example how to install an ISR:
mov dx, your_isr ; offset of your timer int, don't forget to load ds with the right segment
mov ax, 2505h ; interrupt vector 5 and function 25
CLI ; disable all ints
INT 21h
STI ;enable all ints
hope this will help ya