From: sparky4 Date: Tue, 23 Jun 2015 17:37:08 +0000 (-0500) Subject: wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=5b889622a45277ce2b6ac5870b02c02ff1068b1f;p=16.git wwww Signed-off-by: sparky4 --- 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); diff --git a/16/cawat/16_in.h b/16/cawat/16_in.h index ba1e1386..92c9fdd7 100644 --- a/16/cawat/16_in.h +++ b/16/cawat/16_in.h @@ -22,16 +22,16 @@ // v1.0d1 // By Jason Blochowiak // - -#include "lib_head.h" + +#ifndef __16_IN__ +#define __16_IN__ + +#include "lib_head.h" #ifndef __TYPES__ //#include "ID_Types.h" #endif -#ifndef __ID_IN__ -#define __ID_IN__ - #ifdef __DEBUG__ #define __DEBUG_InputMgr__ #endif @@ -120,7 +120,6 @@ typedef byte ScanCode; #define MDelta 11 #define MouseInt 0x33 -#define Mouse(x) _AX = x,_dos_geninterrupt(MouseInt) typedef enum { demo_Off,demo_Record,demo_Playback,demo_PlayDone diff --git a/16/cawat/lib_head.h b/16/cawat/lib_head.h index 90f69d14..d77af4da 100644 --- a/16/cawat/lib_head.h +++ b/16/cawat/lib_head.h @@ -1,38 +1,42 @@ -/* - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ +/* + * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ /* * Just some handy typedefs that make it easier to think about the low * level code - */ - -#ifndef _LIB_HEAD_H_ -#define _LIB_HEAD_H_ - -#include -#include -//#include "" -//#include "" -//#include "ID_CA.H" -//#include "AUDIOARM.H" + */ + +#ifndef _LIB_HEAD_H_ +#define _LIB_HEAD_H_ +#include +#include +#include +//#include "" +//#include "" +//#include "ID_CA.H" +//#include "AUDIOARM.H" #include "types.h" - -#endif/*_LIB_HEAD_H_*/ + +#ifndef REGS +struct REGS CPURegs; +#endif + +#endif/*_LIB_HEAD_H_*/