Jspice3
mfbpixel.c
Go to the documentation of this file.
1 /*************************************************************************
2  MFB graphics and miscellaneous library
3  Copyright (c) Stephen R. Whiteley 1992
4  Author: Stephen R. Whiteley
5  *************************************************************************/
6 
7 #include "mfb.h"
8 #include "mfbP.h"
9 #include <dos.h>
10 
11 #ifdef __STDC__
12 static void mode_1_pixel(int,int);
13 static void mode_2_pixel(int,int);
14 #else
15 static void mode_1_pixel();
16 static void mode_2_pixel();
17 #endif
18 
19 
20 void
22 
23 int x,y;
24 {
25  if (pc.mfbMODE & 2)
26  mode_2_pixel(x,y);
27  else
28  mode_1_pixel(x,y);
29 }
30 
31 
32 static void
34 
35 int x, y;
36 {
37  outpw(0x3ce,pc.curcolor << 8);
38  outpw(0x3ce,0x0f01);
39  outpw(0x3ce,pc.alumode); /* set alu mode */
40  outpw(0x3ce,(0x80 >> (x & 7)) << 8 | 8);
41 
42  *(pc.base + ((x >> 3) + (pc.ysize-1-y)*pc.bytpline)) |= 1;
43 
44  outp(0x3cf,0xff);
45  outpw(0x3ce,0x1);
46 }
47 
48 
49 #ifndef __GNUC__
50 
51 
52 static void
54 
55 int x, y;
56 {
57  union { unsigned short o[2]; long l; } p;
58 
59  outpw(0x3ce,0xff08); /* set bit mask */
60  outpw(0x3ce,pc.alumode); /* set alu mode */
61  p.l = x + (long) (pc.ysize-1-y)*pc.xsize;
62  outp(0x3cd,p.o[1]);
63  if (pc.alumode != 3)
64  mfb_trash = *(pc.base + p.o[0]);
65  *(pc.base + p.o[0]) = pc.curcolor;
66 }
67 
68 
69 #else
70 
71 
72 static void
73 mode_2_pixel(x,y)
74 
75 int x, y;
76 {
77  vidmptr rgen;
78 
79  rgen = pc.base + x + (long) (pc.ysize-1-y)*pc.xsize;
80  if (rgen < pc.base)
81  return;
82  outpw(0x3ce,0xff08); /* set bit mask */
83  outpw(0x3ce,pc.alumode); /* set alu mode */
84  if (pc.alumode != 3)
85  mfb_trash = *rgen;
86  *rgen = pc.curcolor;
87 }
88 
89 #endif
static void mode_1_pixel()
int mfbMODE
Definition: mfbp.h:41
FILE * p
Definition: proc2mod.c:48
char mfb_trash
Definition: mfbopen.c:15
Definition: cddefs.h:312
Definition: cddefs.h:215
char * vidmptr
Definition: mfbp.h:17
int ysize
Definition: mfbp.h:54
vidmptr base
Definition: mfbp.h:38
int alumode
Definition: mfbp.h:56
void MFBPixel(int x, int y)
Definition: mfbpixel.c:21
Definition: cddefs.h:142
int xsize
Definition: mfbp.h:53
static void mode_2_pixel()
int bytpline
Definition: mfbp.h:39
int curcolor
Definition: mfbp.h:46
struct mfbpc pc
Definition: mfbopen.c:14