Senin, 01 April 2013

Joystick code

var regs:registers; bit:integer; ... // get joystick button values via DOS interupt request 15h regs.ah:=$84; regs.dx:=$00; // notes sub-function 0 : read the buttons intr($15,regs); gotoxy(1,8); if (regs.al and 16) <> 16 then write (' ON':6) else write('off':6); if (regs.al and 32) <> 32 then write (' ON':13) else write('off':13); if (regs.al and 64) <> 64 then write (' ON':16) else write('off':16); if (regs.al and 128) <> 128 then write (' ON':11) else write('off':11); // get joystick position via DOS interupt request 15h regs.ah:=$84; regs.dx:=$01; // notes sub-function 1 : read the positions intr($15,regs); gotoxy(1,10); writeln(regs.AX:6); writeln(regs.BX:6); writeln(regs.CX:6); writeln(regs.DX:6);