2 * Functions for handling modex and doing other basic graphics stuff.
\r
9 /* -========================== Types & Macros ==========================- */
\r
10 #define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2))
\r
11 #define PLANE(x) (1<< (x&3))
\r
12 typedef byte far* page_t;
\r
13 #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02)
\r
21 /* -============================ Functions =============================- */
\r
22 /* mode switching, page, and plane functions */
\r
25 void modexShowPage(page_t page);
\r
26 void modexPanPage(page_t *page, int dx, int dy);
\r
27 void modexSelectPlane(byte plane);
\r
28 void modexClearRegion(page_t page, int x, int y, int w, int h, byte color);
\r
29 void modexDrawBmp(page_t page, int x, int y, bitmap_t *bmp, byte sprite);
\r
31 /* Palette fade and flash effects */
\r
32 void modexFadeOn(word fade, byte *palette);
\r
33 void modexFadeOff(word fade, byte *palette);
\r
34 void modexFlashOn(word fade, byte *palette);
\r
35 void modexFlashOff(word fade, byte *palette);
\r
37 /* palette loading and saving */
\r
38 void modexPalSave(byte *palette);
\r
39 byte *modexNewPal();
\r
40 void modexLoadPalFile(char *filename, byte **palette);
\r
41 void modexSavePalFile(char *filename, byte *palette);
\r
43 /* fixed palette functions */
\r
44 void modexPalBlack();
\r
45 void modexPalWhite();
\r
47 /* utility functions */
\r
48 void modexPalUpdate(byte *p);
\r
49 void modexWaitBorder();
\r
51 /* bitmap functions */
\r
52 bitmap_t modexLoadPcx(char *filename);
\r
54 /* -======================= Constants & Vars ==========================- */
\r
55 extern byte far* VGA; /* The VGA Memory */
\r
56 #define VIDEO_INT 0x10
\r
57 #define SET_MODE 0x00
\r
58 #define VGA_256_COLOR_MODE 0x13
\r
59 #define TEXT_MODE 0x03
\r
60 #define SCREEN_WIDTH 320
\r
61 #define SCREEN_HEIGHT 240
\r
62 #define PAGE_SIZE (word)(SCREEN_WIDTH/4 * SCREEN_HEIGHT)
\r
64 #define SC_INDEX 0x03c4
\r
65 #define SC_DATA 0x03c5
\r
66 #define CRTC_INDEX 0x03d4
\r
67 #define CRTC_DATA 0x03d5
\r
68 #define MISC_OUTPUT 0x03c2
\r
69 #define HIGH_ADDRESS 0x0C
\r
70 #define LOW_ADDRESS 0x0D
\r
71 #define VRETRACE 0x08
\r
72 #define INPUT_STATUS_1 0x03da
\r
73 #define DISPLAY_ENABLE 0x01
\r
74 #define MAP_MASK 0x02
\r
75 #define PAL_READ_REG 0x03C7 /* Color register, read address */
\r
76 #define PAL_WRITE_REG 0x03C8 /* Color register, write address */
\r
77 #define PAL_DATA_REG 0x03C9 /* Color register, data port */
\r
78 #define PAL_SIZE (256 * 3)
\r