ISR problem

hi all , :confused:
this code is a sample of simple ISR programming. I cant undrestand 3 lines of this code.
1) void interrupt(*old)(); : where is the codes of this function ? should I write it or it predefined ?

First, you should read the intro threads, and learn about [code][/code] tags before posting any more code.

Next, you might want to ask your tutors about the "wisdom" of learning obsolete technology. Outside of museums and some very niche applications, nobody has programmed seriously in DOS for the last 20 years.

1) void interrupt(*old)(); : where is the codes of this function ? should I write it or it predefined ?
It's a pointer to a function. You initialise it by calling getvect()

2) what does keep(0,1000) exacly do ?
No idea - is it declared in dos.h?

3) (*old)(); ----> what does this line do ?
This calls the old interrupt vector.
Since you only trap "if (inportb(0x60)==0x1F)", all other INT9 interrupts will be handled by the original function.

Wow!!!! This brings back memories of writing code on a old IBM XT pc using DOS 3.3.

But anyway, if memory serves me correctly, the zero is returned to the "outside world" to indicate the successful installation of your Terminate and Stay Resident (TSR) app. It also keeps allocated a 1000 bytes of memory for use by your TSR.

but I still have one problem that is, void interrupt(*old)();
we wrote the code of "void interrupt newint9() " function, but what does we do in the " void interrupt(*old)(); " ? if this function is only for setvect(0x09,old ); so can i change my program to this ?

Interesting things happen if you forget that line :). It basically tells the 8259 priority interrupt controller chip that you're handling the current interrupt and that it is OK to receive further interrupts of equal or lower priority from other peripherals.

Writing TSRs is fun. I learned a lot about the internals of DOS and hardware when I was poking around as a kid.