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 #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02)
\r
21 byte far* data; /* the data for the page */
\r
22 word dx; /* col we are viewing on the virtual screen */
\r
23 word dy; /* row we are viewing on the virtual screen */
\r
24 word width; /* virtual width of the page */
\r
25 word height; /* virtual height of the page */
\r
28 /* -============================ Functions =============================- */
\r
29 /* mode switching, page, and plane functions */
\r
31 void setvideo(/*byte mode, */short vq);
\r
32 page_t modexDefaultPage();
\r
33 page_t modexNextPage(page_t *p);
\r
34 void modexShowPage(page_t *page);
\r
35 void modexPanPage(page_t *page, int dx, int dy);
\r
36 void modexSelectPlane(byte plane);
\r
37 void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color);
\r
38 void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp);
\r
39 void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);
\r
40 void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp);
\r
41 void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);
\r
43 /* Palette fade and flash effects */
\r
44 void modexFadeOn(word fade, byte *palette);
\r
45 void modexFadeOff(word fade, byte *palette);
\r
46 void modexFlashOn(word fade, byte *palette);
\r
47 void modexFlashOff(word fade, byte *palette);
\r
49 /* palette loading and saving */
\r
50 void modexPalSave(byte *palette);
\r
51 byte *modexNewPal();
\r
52 void modexLoadPalFile(char *filename, byte **palette);
\r
53 void modexSavePalFile(char *filename, byte *palette);
\r
55 /* fixed palette functions */
\r
56 void modexPalBlack();
\r
57 void modexPalWhite();
\r
59 /* utility functions */
\r
60 void modexPalUpdate(byte *p);
\r
61 void modexWaitBorder();
\r
63 /* bitmap functions */
\r
64 bitmap_t modexLoadPcx(char *filename);
66 /* -======================= Constants & Vars ==========================- */
\r
67 extern byte far* VGA; /* The VGA Memory */
\r
68 #define SCREEN_SEG 0xa000
\r
69 #define VIDEO_INT 0x10
\r
70 #define SET_MODE 0x00
\r
71 #define VGA_256_COLOR_MODE 0x13
\r
72 #define TEXT_MODE 0x03
\r
73 #define SCREEN_WIDTH 320
\r
74 #define SCREEN_HEIGHT 240
\r
75 #define PAGE_SIZE (word)(SCREEN_WIDTH/4 * SCREEN_HEIGHT)
\r
77 #define AC_INDEX 0x03c0
\r
78 #define SC_INDEX 0x03c4
\r
79 #define SC_DATA 0x03c5
\r
80 #define CRTC_INDEX 0x03d4
\r
81 #define CRTC_DATA 0x03d5
\r
82 #define MISC_OUTPUT 0x03c2
\r
83 #define HIGH_ADDRESS 0x0C
\r
84 #define LOW_ADDRESS 0x0D
\r
85 #define VRETRACE 0x08
\r
86 #define INPUT_STATUS_1 0x03da
\r
87 #define DISPLAY_ENABLE 0x01
\r
88 #define MAP_MASK 0x02
\r
89 #define PAL_READ_REG 0x03C7 /* Color register, read address */
\r
90 #define PAL_WRITE_REG 0x03C8 /* Color register, write address */
\r
91 #define PAL_DATA_REG 0x03C9 /* Color register, data port */
\r
92 #define PAL_SIZE (256 * 3)
94 #define NUM_COLORS 256 // number of colors in vga mode
\r
99 #define QUADWH TILEWH/2
100 #define VW (SCREEN_WIDTH+32)
\r
101 #define VH (SCREEN_HEIGHT+32)
\r