Saturday, April 18, 2009

Integrate Assembly Interrupt in C

As described in previous post, an interrupt is our way of telling our OS to stop its normal operation and perform what we ask it to do.

The code below is adopted from the works of Niloy Mondal, another Assembly/C programmer.

[+/-] show/hide

#include stdio.h /*enclose the libraries between < > */
#include dos.h

void main()
_AX=0; //file register with 0
geninterupt(0x33); //generate 33h interrupt
//check the return values now
if (_AX == 0)
printf("Mouse is not installed. ");
printf ("Mouse is installed. ");

After typing this program in C, compile and run this. It will determine if your mouse is physically connected to your PC or not.

No comments: