X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;ds=inline;f=16%2Fcawat%2F16_in.c;h=4d3598d736da6767fdb8ad82e38fba6b41044123;hb=5b889622a45277ce2b6ac5870b02c02ff1068b1f;hp=67e02e29f9ea347bbafcf455856742b9c5456015;hpb=232403017807bf116f933dec1ce816e6cbada38a;p=16.git diff --git a/16/cawat/16_in.c b/16/cawat/16_in.c index 67e02e29..4d3598d7 100644 --- a/16/cawat/16_in.c +++ b/16/cawat/16_in.c @@ -35,7 +35,7 @@ // DEBUG - there are more globals // -//#include "ID_HEADS.H" +//#include "ID_HEADS.H" #include "16_in.h" //#pragma hdrstop @@ -222,6 +222,13 @@ static boolean special; outp(0x20,0x20); } +static void +Mouse(int x) +{ + x = CPURegs.x.ax; + int86(MouseInt,&CPURegs,&CPURegs); +} + /////////////////////////////////////////////////////////////////////////// // // INL_GetMouseDelta() - Gets the amount that the mouse has moved from the @@ -232,8 +239,8 @@ static void INL_GetMouseDelta(int *x,int *y) { Mouse(MDelta); - *x = _CX; - *y = _DX; + *x = CPURegs.x.cx; + *y = CPURegs.x.dx; } /////////////////////////////////////////////////////////////////////////// @@ -248,7 +255,7 @@ INL_GetMouseButtons(void) word buttons; Mouse(MButtons); - buttons = _BX; + buttons = CPURegs.x.bx; return(buttons); } @@ -270,8 +277,8 @@ IN_GetJoyAbs(word joy,word *xp,word *yp) ys = joy? 3 : 1; // Do the same for y axis yb = 1 << ys; -// Read the absolute joystick values - __asm +// Read the absolute joystick values + __asm { pushf // Save some registers push si @@ -289,7 +296,7 @@ IN_GetJoyAbs(word joy,word *xp,word *yp) xor si,si // Clear count registers xor di,di xor bh,bh // Clear high byte of bx for later - + push bp // Don't mess up stack frame mov bp,MaxJoyValue @@ -313,7 +320,7 @@ loop: done: pop bp - + mov cl,[xs] // Get the number of bits to shift shr si,cl // and shift the count that many times @@ -322,10 +329,10 @@ done: mov [x],si // Store the values into the variables mov [y],di - + pop di pop si - popf // Restore the registers + popf // Restore the registers } *xp = x; @@ -443,10 +450,10 @@ IN_GetJoyButtonsDB(word joy) { result1 = INL_GetJoyButtons(joy); lasttime = TimeCount; - while (TimeCount == lasttime) + while(TimeCount == lasttime) ; result2 = INL_GetJoyButtons(joy); - } while (result1 != result2); + } while(result1 != result2); return(result1); } @@ -462,8 +469,8 @@ INL_StartKbd(void) IN_ClearKeysDown(); - OldKeyVect = getvect(KeyInt); - setvect(KeyInt,INL_KeyService); + OldKeyVect = _dos_getvect(KeyInt); + _dos_setvect(KeyInt,INL_KeyService); } /////////////////////////////////////////////////////////////////////////// @@ -476,7 +483,7 @@ INL_ShutKbd(void) { poke(0x40,0x17,peek(0x40,0x17) & 0xfaf0); // Clear ctrl/alt/shift flags - setvect(KeyInt,OldKeyVect); + _dos_setvect(KeyInt,OldKeyVect); } /////////////////////////////////////////////////////////////////////////// @@ -487,10 +494,10 @@ INL_ShutKbd(void) static boolean INL_StartMouse(void) { - if (getvect(MouseInt)) + if(_dos_getvect(MouseInt)) { Mouse(MReset); - if (_AX == 0xffff) + if(CPURegs.x.ax == 0xffff) return(true); } return(false);