Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //**IMPORTANT** please read
- //This is old C++ code, runs on turbo C++, not recommended to learn anything from this, you can try and run this
- #include <iostream>
- #include <conio.h>
- #include <dos.h>
- #include <bios.h>
- union REGS in,out;
- class MOUSE{
- int x,y;
- unsigned short state;
- public:
- int Update();
- int SetLimits(int MAX, int MIN,char AXIS);
- };
- class KEYBRD{
- short isKeyDown;
- unsigned short keyCode;
- unsigned short splStatus;
- public:
- int Update();
- unsigned short GetKey();
- };
- class PAGE{
- public:
- MOUSE mouse;
- KEYBRD keybrd;
- int Update();
- };
- int MOUSE::Update()
- {
- in.x.ax = 3;
- int86(0x33,&in,&out);
- x = out.x.cx;
- y = out.x.dx;
- state = out.x.bx;
- return 0;
- }
- int MOUSE::SetLimits(int MAX,int MIN, char AXIS)
- {
- switch(AXIS)
- {
- case 'x': in.x.ax = 7;
- break;
- case 'y': in.x.ax = 8;
- }
- in.x.cx = MAX;
- in.x.dx = MIN;
- int86(0x33,&in.&out);
- }
- int KEYBRD::Update()
- {
- keyCode = _bios_keybrd(_KEYBRD_READ) & 0xFF;
- return 0;
- }
- unsigned short KEYBRD::GetKey()
- {
- return (keyCode);
- }
- int PAGE::Update()
- {
- keybrd.Update();
- mouse.Update();
- return 0;
- }
- int main()
- {
- PAGE page;
- clrscr();
- do
- {
- page.Update();
- delay(0.15);
- }while(page.keybrd.GetKey() != 'q');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement