¿Cómo implementar interrupciones de dispositivos simuladas en lenguaje C? Por ejemplo, ¿simular los movimientos del mouse y las pulsaciones del teclado?
#include lt;stdio.hgt;
#include lt;dos.hgt;
#include lt;graphics.hgt;
unión REGS regs;
int init();
int read();
cursor vacío(), newxy(), draw();
int xmin, xmax, ymin, ymax, x_max=639, y_max=479
main()
{
int; botones, xm, ym, x0, y0, x, y;
char str[100]
int driver=VGA
int mode=VGAHI; ;
initgraph(amp;driver,amp;mode, "D. (\tc\\tc");
rectángulo (0, 0, x_max, y_max); p>
p>
setfillstyle(SOLID_FILL, BLUE);
bar(1, 1, x_ max-1, y_max-1);
outtextxy(3); , 15, "Usar cualquier botón mueve el mouse.
");
setfillstyle(1, RED);
bar(280, 12, 330, 33);
outtextxy(285, 15, "salir ");
bar(340, 12, 390, 33);
setfillstyle(SOLID_FILL, AZUL);
outtextxy(345, 15, "borrar ");
xmin=2;
xmax=x_max-1;
ymin=8;
ymax=y_max-2 ;
setwritemode(XOR_PUT);
if(init(xmin, xmax, ymin, ymax)==0)
{ p>
printf("Ratón o controlador de ratón ausente, ¡por favor instálelo!");
delay(5000);
exit(1); > }
x=320;
y= 240;
cursor(x, y
para(;;)
{
newxy(amp;x,amp;y,amp;botones
if(xgt;=280amp;xlt;=330); amp; amp; ygt;=12amp;amp;ylt;=33amp;amp;botones)
{
cleardevice();
}
if(xgt;=340 amp;amp; x lt;=390 amp;amp; ygt;=12 amp;amp; ylt;=33 amp;amp; ; botones)
{
rectángulo(0, 0, x_max, y_max
setfillstyle(SOLID_ FILL, BLUE
bar(1, 1, x_max-1, y_max-1);
outtextxy(3, 15, "Usa cualquier botón para mover el mouse.
");
setfillstyle(1, RED);
bar (280, 12, 330, 33);
outtextxy(285, 15, "salir ");
bar(340, 12, 390, 33);
outtextxy(345, 15, "claro");
setfillstyle( SOLID_FILL, AZUL);
xmin=2
xmax=x_max-1
ymin=8
ymax=y_max-2; ;
setwritemode(XOR_PUT);
if(init(xmin, xmax, ymin, ymax)==0)
{
printf("Ratón o controlador de ratón ausente, ¡por favor instálelo!");
delay(5000);
exit(1); p>
x=320;
y=240;
cursor(x, y
}
}
}
}
}
}
}