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

Go to the source code of this file.

Macros

#define NAME_OFF   18
 

Functions

static int pointer_on ()
 
void dp_start (int irq, int addr)
 
void dp_end ()
 
void dp_pointer_on ()
 
void dp_pointer_off ()
 
void dp_status (int *x, int *y, int *b)
 
void dp_point (int *x, int *y, int *k, int *b)
 

Macro Definition Documentation

#define NAME_OFF   18

Function Documentation

void dp_end ( )

Definition at line 62 of file dpinterf.c.

65 {
66  union REGS r;
67 
68  r.x.ax = 6;
69  int86(0x62,&r,&r);
70 }
Definition: cddefs.h:162
void dp_point ( int *  x,
int *  y,
int *  k,
int *  b 
)

Definition at line 152 of file dpinterf.c.

155 {
156  int xx, yy, bb;
157  int xlst, ylst;
158 
159  dp_status(&xx,&yy,&bb);
160  yy = pc.ysize - yy - 1;
161  MFBDrawCursor(xx-8,yy+7);
162  for (;;) {
163  if (kbhit()) {
164  *k = 0xff & getch();
165  if (!*k)
166  *k = 256 + getch();
167  *b = 0;
168  break;
169  }
170  if (bb) {
171  *k = 0;
172  *b = bb;
173  break;
174  }
175  xlst = xx;
176  ylst = yy;
177  dp_status(&xx,&yy,&bb);
178  yy = pc.ysize - yy - 1;
179  if (xx == xlst && yy == ylst)
180  continue;
181  MFBEraseCursor(xlst-8,ylst+7);
182  MFBDrawCursor(xx-8,yy+7);
183  }
184  *x = xx;
185  *y = yy;
186  MFBEraseCursor(xx-8,yy+7);
187 }
void MFBDrawCursor(int x, int y)
Definition: mfbmark.c:26
int ysize
Definition: mfbp.h:54
struct mfbpc pc
Definition: mfbopen.c:14
void MFBEraseCursor(int x, int y)
Definition: mfbmark.c:48
void dp_status(int *x, int *y, int *b)
Definition: dpinterf.c:99
void dp_pointer_off ( )

Definition at line 87 of file dpinterf.c.

90 {
91  union REGS r;
92 
93  r.x.ax = 1;
94  int86(0x62,&r,&r);
95 }
Definition: cddefs.h:162
void dp_pointer_on ( )

Definition at line 74 of file dpinterf.c.

77 {
78  union REGS r;
79 
80  r.x.ax = 0;
81  r.x.bx = pc.cursor_color;
82  int86(0x62,&r,&r);
83 }
Definition: cddefs.h:162
int cursor_color
Definition: mfbp.h:50
struct mfbpc pc
Definition: mfbopen.c:14
void dp_start ( int  irq,
int  addr 
)

Definition at line 28 of file dpinterf.c.

32 {
33  union REGS r;
34 
35  /* presence test */
36  if (!pointer_on()) {
37  fprintf(stderr,"Error: \"pointer\" TSR not loaded.\n");
38  fprintf(stderr,"Hit any key to exit.\n");
39  (void)MFBGetchar();
42  MFBClose();
43  exit(0);
44  }
45  r.x.ax = 5;
46  /* in real mode, pass irq,irq+8 */
47 #if __NDPC__
48  /* Phar Lap */
49  r.x.bx = (irq << 8) | get_hwvec(irq);
50 #else
51  r.x.bx = (irq << 8) | irq + 8;
52 #endif
53  r.x.cx = addr;
54  r.x.dx = pc.xsize;
55  r.x.di = pc.ysize;
56  r.x.si = pc.mfbMODE;
57  int86(0x62,&r,&r);
58 }
int pointertype
Definition: mfbp.h:60
static int pointer_on()
Definition: dpinterf.c:115
int MFBClose()
Definition: mfbopen.c:193
int mfbMODE
Definition: mfbp.h:41
#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 xsize
Definition: mfbp.h:53
Definition: cddefs.h:162
struct mfbpc pc
Definition: mfbopen.c:14
void dp_status ( int *  x,
int *  y,
int *  b 
)

Definition at line 99 of file dpinterf.c.

103 {
104  union REGS r;
105 
106  r.x.ax = 4;
107  int86(0x62,&r,&r);
108  *x = r.x.bx;
109  *y = r.x.cx;
110  *b = r.x.dx;
111 }
Definition: cddefs.h:162
static int pointer_on ( )
static

Definition at line 115 of file dpinterf.c.

118 {
119 #define NAME_OFF 18
120 
121 #if __NDPC__
122 #define RP_OFF(rp) ((rp) & 0xFFFF)
123 #define RP_SEG(rp) ((rp) >> 16)
124  unsigned long r;
125  char c[8];
126 
127  blk_mb(&r,0x34,0,0x62*4,4); /* getvect(0x62) */
128  blk_mb(c,0x34,(RP_SEG(r) << 4) + RP_OFF(r) + NAME_OFF,8);
129 #else
130 #if __GNUC__
131  char *c;
132 
133  c = (char*)(0xe0000000 + 0x62);
134  c = (char*)(16*(*(short*)(c+2)) + *(short*)c + NAME_OFF);
135 #else
136  return (I_cant_convert_real_address);
137 #endif
138 #endif
139 
140  if (c[0] != 'p') return (0);
141  if (c[1] != 'o') return (0);
142  if (c[2] != 'i') return (0);
143  if (c[3] != 'n') return (0);
144  if (c[4] != 't') return (0);
145  if (c[5] != 'e') return (0);
146  if (c[6] != 'r') return (0);
147  return (1);
148 }
static double c
Definition: vectors.c:16
Definition: cddefs.h:177
Definition: cddefs.h:162
#define NAME_OFF