2 * Functions for handling modex and doing other basic graphics stuff.
\r
10 /* -========================== Types & Macros ==========================- */
\r
11 #define PAGE_OFFSET(x,y) (((y)<<6)+((y)<<4)+((x)>>2))
\r
12 #define PLANE(x) (1<< (x&3))
\r
13 #define SELECT_ALL_PLANES() outpw(0x03c4, 0xff02)
\r
16 byte far* data; /* the data for the page */
\r
17 word dx; /* col we are viewing on the virtual screen */
\r
18 word dy; /* row we are viewing on the virtual screen */
\r
19 word width; /* virtual width of the page */
\r
20 word height; /* virtual height of the page */
\r
23 /* -============================ Functions =============================- */
\r
24 /* mode switching, page, and plane functions */
\r
27 page_t modexDefaultPage();
\r
28 page_t modexNextPage(page_t *p);
\r
29 void modexShowPage(page_t *page);
\r
30 void modexPanPage(page_t *page, int dx, int dy);
\r
31 void modexSelectPlane(byte plane);
\r
32 void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color);
\r
33 void modexDrawBmp(page_t *page, int x, int y, bitmap_t *bmp);
\r
34 void modexDrawBmpRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);
\r
35 void modexDrawSprite(page_t *page, int x, int y, bitmap_t *bmp);
\r
36 void modexDrawSpriteRegion(page_t *page, int x, int y, int rx, int ry, int rw, int rh, bitmap_t *bmp);
\r
37 void modexCopyPageRegion(page_t *dest, page_t *src, word sx, word sy, word dx, word dy, word width, word height);
\r
39 /* Palette fade and flash effects */
\r
40 void modexFadeOn(word fade, byte *palette);
\r
41 void modexFadeOff(word fade, byte *palette);
\r
42 void modexFlashOn(word fade, byte *palette);
\r
43 void modexFlashOff(word fade, byte *palette);
\r
45 /* palette loading and saving */
\r
46 void modexPalSave(byte *palette);
\r
47 byte *modexNewPal();
\r
48 void modexLoadPalFile(char *filename, byte **palette);
\r
49 void modexSavePalFile(char *filename, byte *palette);
\r
51 /* fixed palette functions */
\r
52 void modexPalBlack();
\r
53 void modexPalWhite();
\r
55 /* utility functions */
\r
56 void modexPalUpdate(byte *p);
\r
57 void modexWaitBorder();
\r
59 /* -======================= Constants & Vars ==========================- */
\r
60 extern byte far* VGA; /* The VGA Memory */
\r
61 #define SCREEN_SEG 0xa000
\r
62 #define VIDEO_INT 0x10
\r
63 #define SET_MODE 0x00
\r
64 #define VGA_256_COLOR_MODE 0x13
\r
65 #define TEXT_MODE 0x03
\r
66 #define SCREEN_WIDTH 320
\r
67 #define SCREEN_HEIGHT 240
\r
68 #define PAGE_SIZE (word)(SCREEN_WIDTH/4 * SCREEN_HEIGHT)
\r
70 #define AC_INDEX 0x03c0
\r
71 #define SC_INDEX 0x03c4
\r
72 #define SC_DATA 0x03c5
\r
73 #define CRTC_INDEX 0x03d4
\r
74 #define CRTC_DATA 0x03d5
\r
75 #define GC_INDEX 0x03ce
\r
76 #define MISC_OUTPUT 0x03c2
\r
77 #define HIGH_ADDRESS 0x0C
\r
78 #define LOW_ADDRESS 0x0D
\r
79 #define VRETRACE 0x08
\r
80 #define INPUT_STATUS_1 0x03da
\r
81 #define DISPLAY_ENABLE 0x01
\r
82 #define MAP_MASK 0x02
\r
83 #define PAL_READ_REG 0x03C7 /* Color register, read address */
\r
84 #define PAL_WRITE_REG 0x03C8 /* Color register, write address */
\r
85 #define PAL_DATA_REG 0x03C9 /* Color register, data port */
\r
86 #define PAL_SIZE (256 * 3)
\r