File: modexlib.h

package info (click to toggle)
rott 1.0%2Bdfsg-2
  • links: PTS
  • area: contrib
  • in suites: lenny
  • size: 3,640 kB
  • ctags: 11,676
  • sloc: ansic: 76,379; sh: 4,983; asm: 1,300; makefile: 88
file content (164 lines) | stat: -rw-r--r-- 5,000 bytes parent folder | download
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
/*
Copyright (C) 1994-1995 Apogee Software, Ltd.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

*/
//***************************************************************************
//
//    MODEXLIB.C - various utils palette funcs and modex stuff
//
//***************************************************************************

#ifndef _modexlib_public
#define _modexlib_public

#include "rt_def.h"

#define MAXSCREENHEIGHT         200
#define MAXSCREENWIDTH          320
#define SCREENBWIDE             96
#define MAXVIEWWIDTH            320
#define SCREENWIDTH             96              // default screen width in bytes

//***************************************************************************
//
//    Video (ModeX) Constants
//
//***************************************************************************

#define SC_INDEX                0x3C4
#define SC_DATA                 0x3C5
#define SC_RESET                0
#define SC_CLOCK                1
#define SC_MAPMASK              2
#define SC_CHARMAP              3
#define SC_MEMMODE              4

#define CRTC_INDEX              0x3D4
#define CRTC_DATA               0x3D5
#define CRTC_H_TOTAL            0
#define CRTC_H_DISPEND          1
#define CRTC_H_BLANK            2
#define CRTC_H_ENDBLANK         3
#define CRTC_H_RETRACE          4
#define CRTC_H_ENDRETRACE       5
#define CRTC_V_TOTAL            6
#define CRTC_OVERFLOW           7
#define CRTC_ROWSCAN            8
#define CRTC_MAXSCANLINE        9
#define CRTC_CURSORSTART        10
#define CRTC_CURSOREND          11
#define CRTC_STARTHIGH          12
#define CRTC_STARTLOW           13
#define CRTC_CURSORHIGH         14
#define CRTC_CURSORLOW          15
#define CRTC_V_RETRACE          16
#define CRTC_V_ENDRETRACE       17
#define CRTC_V_DISPEND          18
#define CRTC_OFFSET             19
#define CRTC_UNDERLINE          20
#define CRTC_V_BLANK            21
#define CRTC_V_ENDBLANK         22
#define CRTC_MODE               23
#define CRTC_LINECOMPARE        24

#define GC_INDEX                0x3CE
#define GC_DATA                 0x3CF
#define GC_SETRESET             0
#define GC_ENABLESETRESET       1
#define GC_COLORCOMPARE         2
#define GC_DATAROTATE           3
#define GC_READMAP              4
#define GC_MODE                 5
#define GC_MISCELLANEOUS        6
#define GC_COLORDONTCARE        7
#define GC_BITMASK              8

#define ATR_INDEX               0x3c0
#define ATR_MODE                16
#define ATR_OVERSCAN            17
#define ATR_COLORPLANEENABLE      18
#define ATR_PELPAN              19
#define ATR_COLORSELECT         20

#define STATUS_REGISTER_1       0x3da

#define PEL_WRITE_ADR           0x3c8
#define PEL_READ_ADR            0x3c7
#define PEL_DATA                0x3c9


extern  int      ylookup[MAXSCREENHEIGHT];      // Table of row offsets
extern  int      linewidth;
extern  int      page1start;
extern  int      page2start;
extern  int      page3start;
extern  int      screensize;
extern  unsigned bufferofs;
extern  unsigned displayofs;
extern  boolean  graphicsmode;


void  GraphicsMode ( void );
void  SetTextMode ( void );
void  VL_SetVGAPlaneMode ( void );
void  VL_ClearBuffer (unsigned buf, byte color);
void  VL_ClearVideo (byte color);
void  VL_DePlaneVGA (void);
void  VL_CopyDisplayToHidden ( void );
void  VL_CopyBufferToAll ( unsigned buffer );
void  VL_CopyPlanarPage ( byte * src, byte * dest );
void  VL_CopyPlanarPageToMemory ( byte * src, byte * dest );
void  XFlipPage ( void );
void  WaitVBL( void );
void  TurnOffTextCursor ( void );

#ifdef __WATCOMC__
#pragma aux VGAWRITEMAP =      \
        "mov    eax,01H"       \
        "mov    edx,03c5h"     \
        "shl    eax,cl"        \
        "out    dx,al"         \
        parm    [ecx]          \
        modify exact [eax edx]

#pragma aux VGAMAPMASK =       \
        "mov    edx,03c5h"     \
        "out    dx,al"         \
        parm    [eax]          \
        modify exact [edx]

#pragma aux VGAREADMAP =      \
        "shl    eax,08H"      \
        "mov    edx,03ceh"    \
        "add    eax,04H"      \
        "out    dx,ax"        \
        parm    [eax]         \
        modify exact [eax edx]
#endif

#ifdef DOS
void  VGAMAPMASK (int x);
void  VGAREADMAP (int x);
void  VGAWRITEMAP(int x);
#else
#define VGAMAPMASK(a)
#define VGAREADMAP(a)
#define VGAWRITEMAP(a)
#endif

#endif