... or any other DOS programs. Any ideas why?
Printable View
... or any other DOS programs. Any ideas why?
Oh because I don't know maybe cause it is like 20 years old and people are using windows now.
If prog man's right, get a new compiler, and then look at the last post in this thread.
The old DOS drivers don't work in a "DOS Window". It's not really DOS, it's the (32-bit) Windows console.
If you boot to true 16-bit DOS, if you have the original DOS drivers for your mouse, and if you have a serial mouse, it should work. I don't really remember if you could use a PS2 mouse (round connector) with DOS.
And BTW - Get a new compiler! :D Microsoft Visual C++ Express is free. So is Bloodshed. Then, leave the mouse out of console applications. Wait 'till you're ready to learn GUI programming,
Not true.Quote:
The old DOS drivers don't work in a "DOS Window". It's not really DOS, it's the (32-bit) Windows console.
Console apps run in a console window. DOS apps made with Turbo C++ will use a DOS session under emulated 16-bit DOS.
Mouse code does work with Turbo C++ 3.0. Almost all mouse drivers work with interrupt 33h and if you want to know the truth I believe MS Windows installs a rudimentary one on this interrupt at boot. So there is no need for DOS drivers to use the mouse if Windows has already hooked the interrupt.
This rudimentary driver supports most of the common operations.
This will get you started with the mouse in Turbo C++. Note that if you have TASM you can use inline assembly for TC 1.0 -> 4.52.
TASM 5.0 is readily available on the web on many academic/uni/fan websites.
AFAIK MASM is readily available through the MVC Express d/l.
Simple mouse functions for TC 3.0
Sample code:Code:#ifndef Mouse_h
#define Mouse_h
#include <dos.h>
#define MOUSE_LMB 0x01
#define MOUSE_RMB 0x02
#define MOUSE_MMB 0x03
#define MOUSE_SHOW 0x01
#define MOUSE_HIDE 0x02
struct MouseInfo
{
int iX;
int iY;
int iButtonDown;
};
class CMouse
{
MouseInfo MouseProps;
public:
CMouse(void) { }
virtual ~CMouse(void) { }
void ResetDriver(void)
{
union REGS regs;
regs.x.ax=0x00;
int86(0x33,®s,®s);
}
void Show(int iMode)
{
union REGS regs;
regs.x.ax=iMode;
int86(0x33,®s,®s);
}
void Update(void);
{
union REGS regs;
regs.x.ax=0x05;
int86(0x33,®s,®s);
MouseProps.iX=regs.x.cx;
MouseProps.iY=regs.x.dx;
MouseProps.iButtonDown=regs.x.bx;
}
MouseInfo GetProps(void) {return MouseProps;}
//Add other functions here
};
#endif
I leave it to you to add more functions. Get Ralph Brown's Interrupt List for more mouse functions residing on int 33h.Code:CMouse MyMouse;
//Show mouse cursor
MyMouse.Show(MOUSE_SHOW);
//Hide mouse cursor
MyMouse.Show(MOUSE_HIDE);
//Get coords and button info
MyMouse.Update();
MouseInfo info=MyMouse.GetProps();
//Call user supplied function to draw cursor at current position
DrawCursor(info.iX,info.iY);
switch (info.iButtonDown)
{
case MOUSE_LMB:
//Left mouse button down
case MOUSE_MMB:
//Middle button down
case MOUSE_RMB
//Right button down
}
http://www.ctyme.com/intr/int-33.htmQuote:
Originally Posted by Bubba