1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
/* $XConsortium$ */
/*
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name of Thomas Roell not be used in
* advertising or publicity pertaining to distribution of the software without
* specific, written prior permission. Thomas Roell makes no representations
* about the suitability of this software for any purpose. It is provided
* "as is" without express or implied warranty.
*
* THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*
* Author: Thomas Roell, roell@informatik.tu-muenchen.de
*
*/
#ifndef VGA_BANK_H
#define VGA_BANK_H
extern void *vgaReadBottom;
extern void *vgaReadTop;
extern void *vgaWriteBottom;
extern void *vgaWriteTop;
extern Bool vgaReadFlag, vgaWriteFlag;
extern void *writeseg;
extern void * vgaSetReadWrite();
extern void * vgaReadWriteNext();
extern void * vgaReadWritePrev();
extern void * vgaSetRead();
extern void * vgaReadNext();
extern void * vgaReadPrev();
extern void * vgaSetWrite();
extern void * vgaWriteNext();
extern void * vgaWritePrev();
extern void vgaSaveBank();
extern void vgaRestoreBank();
extern void vgaPushRead();
extern void vgaPopRead();
extern int vgaSegmentMask;
extern void SpeedUpComputeNext(
#if NeedFunctionPrototypes
unsigned,
unsigned
#endif
);
extern void SpeedUpComputePrev(
#if NeedFunctionPrototypes
unsigned,
unsigned
#endif
);
extern unsigned SpeedUpRowsNext[];
extern unsigned SpeedUpRowsPrev[];
#if defined(__386BSD__) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__bsdi__)
#define VGABASE 0xFF000000
#else
#define VGABASE 0xF0000000
#endif
/* Clear these first -- since they are defined in mfbcustom.h */
#undef CHECKSCREEN
#undef SETRWF
#undef CHECKRWOF
#undef CHECKRWUF
#undef BANK_FLAG
#undef BANK_FLAG_BOTH
#undef SETR
#undef SETW
#undef SETRW
#undef CHECKRO
#undef CHECKWO
#undef CHECKRWO
#undef CHECKRU
#undef CHECKWU
#undef CHECKRWU
#undef NEXTR
#undef NEXTW
#undef PREVR
#undef PREVW
#undef SAVE_BANK
#undef RESTORE_BANK
#undef PUSHR
#undef POPR
#define CHECKSCREEN(x) (((unsigned long)x >= VGABASE) ? TRUE : FALSE)
#define SETRWF(f,x) { if(f) x = vgaSetReadWrite(x); }
#define CHECKRWOF(f,x) { if(f && ((void *)x >= vgaWriteTop)) \
x = vgaReadWriteNext(x); }
#define CHECKRWUF(f,x) { if(f && ((void *)x < vgaWriteBottom)) \
x = vgaReadWritePrev(x); }
#define BANK_FLAG(a) \
vgaWriteFlag = (((unsigned long)a >= VGABASE) ? TRUE : FALSE); \
vgaReadFlag = FALSE;
#define BANK_FLAG_BOTH(a,b) \
vgaReadFlag = (((unsigned long)a >= VGABASE) ? TRUE : FALSE); \
vgaWriteFlag = (((unsigned long)b >= VGABASE) ? TRUE : FALSE);
#define SETR(x) { if(vgaReadFlag) x = vgaSetRead(x); }
#define SETW(x) { if(vgaWriteFlag) x = vgaSetWrite(x); }
#define SETRW(x) { if(vgaWriteFlag) x = vgaSetReadWrite(x); }
#define CHECKRO(x) { if(vgaReadFlag && ((void *)x >= vgaReadTop)) \
x = vgaReadNext(x); }
#define CHECKRU(x) { if(vgaReadFlag && ((void *)x < vgaReadBottom)) \
x = vgaReadPrev(x); }
#define CHECKWO(x) { if(vgaWriteFlag && ((void *)x >= vgaWriteTop)) \
x = vgaWriteNext(x); }
#define CHECKWU(x) { if(vgaWriteFlag && ((void *)x < vgaWriteBottom)) \
x = vgaWritePrev(x); }
#define CHECKRWO(x) { if(vgaWriteFlag && ((void *)x >= vgaWriteTop)) \
x = vgaReadWriteNext(x); }
#define CHECKRWU(x) { if(vgaWriteFlag && ((void *)x < vgaWriteBottom)) \
x = vgaReadWritePrev(x); }
#define NEXTR(x) { x = vgaReadNext(x);}
#define NEXTW(x) { x = vgaWriteNext(x); }
#define PREVR(x) { x = vgaReadPrev(x); }
#define PREVW(x) { x = vgaWritePrev(x); }
#define SAVE_BANK() { if (vgaWriteFlag) vgaSaveBank(); }
#define RESTORE_BANK() { if (vgaWriteFlag) vgaRestoreBank(); }
#define PUSHR() { if(vgaWriteFlag) vgaPushRead(); }
#define POPR() { if(vgaWriteFlag) vgaPopRead(); }
#endif /* VGA_BANK_H */
|