29 #define HGA_HEIGHT 348 30 #define HGA_BASE_SEG 0xB000 31 #define HGA_PAGE2_SEG 0xB800 32 #define HGA_NEXT_LINES_OFS 0x2000 33 #define HGA_BITS_PER_PIXEL 1 34 #define HGA_PIXELS_PER_BYTE (8 / HGA_BITS_PER_PIXEL) 35 #define HGA_BYTES_PER_LINE (HGA_WIDTH / HGA_PIXELS_PER_BYTE) 36 #define HGA_CALCXY_RAW(x, y) ( ((y) % 4) * HGA_NEXT_LINES_OFS + ((y) / 4) * HGA_BYTES_PER_LINE + (x) / HGA_PIXELS_PER_BYTE ) 37 #define HGA_CENTERED_BASE_OFS HGA_CALCXY_RAW(-76, 8) 39 #define HGA_SCREENBUFFER ((byte*)(HGA_BASE_SEG * 16)) 40 #define HGA_BACKBUFFER ((byte*)(HGA_PAGE2_SEG * 16)) 43 #define HGA_SCREENBUFFER ((byte*)MK_FP(HGA_BASE_SEG, 0)) 44 #define HGA_BACKBUFFER ((byte*)MK_FP(HGA_PAGE2_SEG, 0)) 47 #define HGA_FONT_HEIGHT 6 48 #define frontbuffer HGA_SCREENBUFFER 49 #define backbuffer HGA_BACKBUFFER 55 #define CGA_HEIGHT 200 56 #define CGA_BASE_SEG 0xB800 57 #define CGA_ODD_LINES_OFS 0x2000 58 #define CGA_BITS_PER_PIXEL 2 59 #define CGA_PIXELS_PER_BYTE (8 / CGA_BITS_PER_PIXEL) 60 #define CGA_BYTES_PER_LINE (CGA_WIDTH / CGA_PIXELS_PER_BYTE) 62 extern byte CGA_SCREENBUFFER[0xB800];
64 #define CGA_FONT_HEIGHT 6 66 #define CGA_NEXT_LINE(offs) ((CGA_ODD_LINES_OFS ^ (offs)) + (((offs) & CGA_ODD_LINES_OFS) ? 0 : CGA_BYTES_PER_LINE)) 67 #define CGA_PREV_LINE(offs) ((CGA_ODD_LINES_OFS ^ (offs)) - (((offs) & CGA_ODD_LINES_OFS) ? CGA_BYTES_PER_LINE : 0)) 69 #define frontbuffer CGA_SCREENBUFFER 70 extern byte backbuffer[0xB800];
72 extern byte sprit_load_buffer[1290];
74 extern byte cga_pixel_flip[256];
76 extern byte char_draw_coords_x;
77 extern byte char_draw_coords_y;
78 extern byte *char_xlat_table;
79 extern byte string_ended;
80 extern byte char_draw_max_width;
81 extern byte char_draw_max_height;
83 void switchToGraphicsMode(
void);
84 void switchToTextMode(
void);
86 void waitVBlank(
void);
87 void cga_blitToScreen(int16 dx, int16 dy, int16 w, int16 h);
88 void cga_blitToScreen(int16 ofs, int16 w, int16 h);
90 void cga_ColorSelect(byte csel);
91 void cga_BackBufferToRealFull(
void);
92 void cga_RealBufferToBackFull(
void);
93 void cga_SwapRealBackBuffer(
void);
95 void cga_SwapScreenRect(byte *pixels, uint16 w, uint16 h, byte *screen, uint16 ofs);
97 uint16 CalcXY(uint16 x, uint16 y);
98 uint16 CalcXY_p(uint16 x, uint16 y);
100 uint16 HGA_CalcXY(uint16 x, uint16 y);
101 uint16 HGA_CalcXY_p(uint16 x, uint16 y);
102 uint16 cga_CalcXY(uint16 x, uint16 y);
103 uint16 cga_CalcXY_p(uint16 x, uint16 y);
105 void cga_CopyScreenBlock(byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
107 byte *cga_BackupImage(byte *source, uint16 ofs, uint16 w, uint16 h, byte *buffer);
108 byte *cga_BackupImageReal(uint16 ofs, uint16 w, uint16 h);
110 void cga_RestoreImage(byte *buffer, byte *target);
111 void cga_RefreshImageData(byte *buffer);
112 void cga_RestoreBackupImage(byte *target);
114 void cga_Blit(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
115 void cga_BlitAndWait(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
116 void cga_FillAndWait(byte pixel, uint16 w, uint16 h, byte *screen, uint16 ofs);
118 void cga_DrawVLine(uint16 x, uint16 y, uint16 l, byte color, byte *target);
119 void cga_DrawHLine(uint16 x, uint16 y, uint16 l, byte color, byte *target);
120 uint16 cga_DrawHLineWithEnds(uint16 bmask, uint16 bpix, byte color, uint16 l, byte *target, uint16 ofs);
122 void cga_PrintChar(byte c, byte *target);
124 void cga_BlitScratchBackSprite(uint16 sprofs, uint16 w, uint16 h, byte *screen, uint16 ofs);
125 void cga_BlitFromBackBuffer(byte w, byte h, byte *screen, uint16 ofs);
127 void cga_BlitSprite(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
128 void cga_BlitSpriteFlip(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
130 void cga_BlitSpriteBak(byte *pixels, int16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs, byte *backup, byte mask);
132 void drawSprite(byte *sprite, byte *screen, uint16 ofs);
133 void drawSpriteFlip(byte *sprite, byte *screen, uint16 ofs);
135 void drawSpriteN(byte index, uint16 x, uint16 y, byte *target);
136 void drawSpriteNFlip(byte index, uint16 x, uint16 y, byte *target);
138 void backupAndShowSprite(byte index, byte x, byte y);
140 byte *loadSprite(byte index, byte *bank, byte *buffer, byte header_only);
142 byte *loadSprit(byte index);
143 byte *loadPersSprit(byte index);
145 void cga_AnimLiftToUp(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 x, uint16 y);
146 void cga_AnimLiftToDown(byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
147 void cga_AnimLiftToLeft(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
148 void cga_AnimLiftToRight(uint16 n, byte *pixels, uint16 pw, uint16 w, uint16 h, byte *screen, uint16 ofs);
150 void cga_HideScreenBlockLiftToUp(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
151 void cga_HideScreenBlockLiftToDown(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
152 void cga_HideScreenBlockLiftToLeft(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
153 void cga_HideScreenBlockLiftToRight(uint16 n, byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
155 void cga_HideShatterFall(byte *screen, byte *source, uint16 w, uint16 h, byte *target, uint16 ofs);
157 void cga_TraceLine(uint16 sx, uint16 ex, uint16 sy, uint16 ey, byte *source, byte *target);
159 void cga_ZoomImage(byte *pixels, byte w, byte h, byte nw, byte nh, byte *target, uint16 ofs);
160 void cga_AnimZoomIn(byte *pixels, byte w, byte h, byte *target, uint16 ofs);
162 void cga_ZoomInplaceXY(byte *pixels, byte w, byte h, byte nw, byte nh, uint16 x, uint16 y, byte *target);