Jspice3
msinterf.c File Reference
#include "mfb.h"
#include "mfbP.h"
#include <dos.h>
Include dependency graph for msinterf.c:

Go to the source code of this file.

Functions

void ms_start ()
 
void ms_end ()
 
int ms_hreset ()
 
void ms_pointer_on ()
 
void ms_pointer_off ()
 
void ms_status (int *x, int *y, int *b)
 
void ms_point (int *x, int *y, int *k, int *b)
 

Function Documentation

void ms_end ( )

Definition at line 62 of file msinterf.c.

65 {
66  (void)ms_hreset();
67 }
int ms_hreset()
Definition: msinterf.c:71
int ms_hreset ( )

Definition at line 71 of file msinterf.c.

73 {
74  union REGS r;
75 
76  r.x.ax = 0x0;
77  int86(0x33,&r,&r);
78  if (r.x.ax == 0xffff)
79  return (r.x.bx);
80  return (0);
81 }
Definition: cddefs.h:162
void ms_point ( int *  x,
int *  y,
int *  k,
int *  b 
)

Definition at line 126 of file msinterf.c.

129 {
130  int xx, yy, bb;
131  int xlst, ylst;
132 
133  ms_status(&xx,&yy,&bb);
134  yy = pc.ysize - yy - 1;
135  MFBDrawCursor(xx-8,yy+7);
136  for (;;) {
137  if (kbhit()) {
138  *k = 0xff & getch();
139  if (!*k)
140  *k = 256 + getch();
141  *b = 0;
142  break;
143  }
144  if (bb) {
145  *k = 0;
146  *b = bb;
147  break;
148  }
149  xlst = xx;
150  ylst = yy;
151  ms_status(&xx,&yy,&bb);
152  yy = pc.ysize - yy - 1;
153  if (xx == xlst && yy == ylst)
154  continue;
155  MFBEraseCursor(xlst-8,ylst+7);
156  MFBDrawCursor(xx-8,yy+7);
157  }
158  *x = xx;
159  *y = yy;
160  MFBEraseCursor(xx-8,yy+7);
161 }
void MFBDrawCursor(int x, int y)
Definition: mfbmark.c:26
void ms_status(int *x, int *y, int *b)
Definition: msinterf.c:109
int ysize
Definition: mfbp.h:54
struct mfbpc pc
Definition: mfbopen.c:14
void MFBEraseCursor(int x, int y)
Definition: mfbmark.c:48
void ms_pointer_off ( )

Definition at line 98 of file msinterf.c.

100 {
101  union REGS r;
102 
103  r.x.ax = 0x2;
104  int86(0x33,&r,&r);
105 }
Definition: cddefs.h:162
void ms_pointer_on ( )

Definition at line 85 of file msinterf.c.

87 {
88  union REGS r;
89 
90  /* don't use!
91  r.x.ax = 0x1;
92  int86(0x33,&r,&r);
93  */
94 }
Definition: cddefs.h:162
void ms_start ( )

Definition at line 15 of file msinterf.c.

18 {
19  union REGS r;
20 
21  if (!ms_hreset()) {
22  fprintf(stderr,"Error: Mouse driver not loaded.\n");
23  fprintf(stderr,"Using keyboard arrow keys. Hit any key to continue.\n");
24  (void)MFBGetchar();
26  MFBSetColor(0);
27  MFBFlood();
29  }
30  /* This driver is designed to work in "strange" super-VGA modes.
31  * The mouse driver thinks these are text mode, and quantizes the
32  * returned mouse position in units of 8. To avoid this, the logical
33  * screen size is multiplied by 8, and the return coordinates
34  * ( in ms_status() ) are divided by 8.
35  */
36 
37  /* set logical screen size */
38  r.x.ax = 7;
39  r.x.cx = 0;
40  r.x.dx = (pc.xsize-1) << 3;
41  int86(0x33,&r,&r);
42  r.x.ax = 8;
43  r.x.cx = 0;
44  r.x.dx = (pc.ysize-1) << 3;
45  int86(0x33,&r,&r);
46 
47  /* set mickeys/pixels ratio (1/8 default) */
48  r.x.ax = 0xf;
49  r.x.cx = 1;
50  r.x.dx = 2;
51 
52  /* move pointer to center of logical screen */
53  int86(0x33,&r,&r);
54  r.x.ax = 0x4;
55  r.x.cx = (pc.xsize-1) << 2;
56  r.x.dx = (pc.ysize-1) << 2;
57  int86(0x33,&r,&r);
58 }
int pointertype
Definition: mfbp.h:60
int ms_hreset()
Definition: msinterf.c:71
#define KBRD
Definition: mfbp.h:90
int ysize
Definition: mfbp.h:54
int MFBGetchar()
Definition: mfbopen.c:259
void MFBPointerInit()
Definition: mfbcursr.c:440
int MFBSetColor()
void MFBFlood()
Definition: mfbflood.c:21
int xsize
Definition: mfbp.h:53
Definition: cddefs.h:162
struct mfbpc pc
Definition: mfbopen.c:14
void ms_status ( int *  x,
int *  y,
int *  b 
)

Definition at line 109 of file msinterf.c.

113 {
114  union REGS r;
115 
116  r.x.ax = 0x3;
117  int86(0x33,&r,&r);
118  /* physical screen = 1/8 logical screen */
119  *x = r.x.cx >> 3;
120  *y = r.x.dx >> 3;
121  *b = r.x.bx;
122 }
Definition: cddefs.h:162