Jspice3
Main Page
Data Structures
Files
File List
Globals
mfbgetpx.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
12
int
13
MFBGetPixel
(x,y)
14
15
/* return color at x,y (0,0 is upper left) */
16
int x, y;
17
{
18
int
color = 0, latch;
19
vidmptr
rgen;
20
union
{
unsigned
short
o
[2];
long
l
; }
p
;
21
int
plane;
22
int
bit_number = (x & 7)^7;
23
int
bit_mask = (1 << bit_number);
24
25
if
(
pc
.
mfbMODE
& 2) {
26
p
.l = x + (long) (
pc
.
ysize
-1-y)*
pc
.
xsize
;
27
#ifndef __GNUC__
28
outp(0x3cd,
p
.o[1]);
29
return
(*(
pc
.
base
+
p
.o[0]));
30
#else
31
return
(*(
pc
.
base
+
p
.l));
32
#endif
33
}
34
else
{
35
rgen =
pc
.
base
+ (x >> 3) + y*
pc
.
bytpline
;
36
for (plane = 3; plane >= 0; plane--) {
37
outpw(0x3ce,plane << 8 | 4);
38
latch = *rgen & bit_mask;
39
latch >>= bit_number;
40
color <<= 1;
41
color |= latch;
42
}
43
return
(color);
44
}
45
}
46
47
48
MFBGetPixel
int MFBGetPixel(int x, int y)
Definition:
mfbgetpx.c:13
mfbpc::mfbMODE
int mfbMODE
Definition:
mfbp.h:41
p
FILE * p
Definition:
proc2mod.c:48
l
Definition:
cddefs.h:312
p
Definition:
cddefs.h:215
vidmptr
char * vidmptr
Definition:
mfbp.h:17
mfbpc::ysize
int ysize
Definition:
mfbp.h:54
mfbpc::base
vidmptr base
Definition:
mfbp.h:38
o
Definition:
cddefs.h:142
mfbpc::xsize
int xsize
Definition:
mfbp.h:53
mfbpc::bytpline
int bytpline
Definition:
mfbp.h:39
pc
struct mfbpc pc
Definition:
mfbopen.c:14
mfb.h
src
lib
dosmfb
mfbgetpx.c
Generated by
1.8.11