|
|
1.1 root 1: /*
1.1.1.6 root 2: Hatari - screenConvert.c
1.1 root 3:
1.1.1.6 root 4: This file is distributed under the GNU Public License, version 2 or at your
5: option any later version. Read the file gpl.txt for details.
6:
7: Screen conversion routines. We have a number of routines to convert ST screen
8: to PC format. We split these into Low, Medium and High each with 8/16-bit
9: versions. To gain extra speed, as almost half of the processing time can be
10: spent in these routines, we check for any changes from the previously
11: displayed frame. AdjustLinePaletteRemap() sets a flag to tell the routines if
12: we need to totally update a line (ie full update, or palette/res change) or if
13: we just can do a difference check.
14: We convert each screen 16 pixels at a time by use of a couple of look-up
15: tables. These tables convert from 2-plane format to bbp and then we can add
16: two of these together to get 4-planes. This keeps the tables small and thus
17: improves speed. We then look these bbp values up as an RGB/Index value to copy
18: to the screen.
1.1 root 19: */
1.1.1.7 ! root 20: char ScreenConvert_rcsid[] = "Hatari $Id: screenConvert.c,v 1.15 2004/04/19 08:53:34 thothy Exp $";
1.1 root 21:
1.1.1.2 root 22: #include <SDL.h>
1.1.1.5 root 23: #include <SDL_endian.h>
1.1.1.2 root 24:
1.1 root 25: #include "main.h"
26: #include "screen.h"
27: #include "screenConvert.h"
28: #include "spec512.h"
29: #include "vdi.h"
30: #include "video.h"
31:
32:
33: int ScrUpdateFlag; /* Bit mask of how to update screen */
34: BOOL bScrDoubleY; /* TRUE if double on Y */
1.1.1.7 ! root 35:
! 36: static int ScrX,ScrY; /* Locals */
! 37: static Uint32 PixelWorkspace[4]; /* Workspace to store pixels to so can print in right order for Spec512 */
1.1 root 38:
39: /* Remap tables to convert from plane format to byte-per-pixel (Upper is for 4-Planes so if shifted by 2) */
1.1.1.7 ! root 40: static Uint32 Remap_2_Planes[256] = {
1.1 root 41: 0x00000000, 0x01000000, 0x00010000, 0x01010000, 0x00000100, 0x01000100, 0x00010100, 0x01010100,
42: 0x00000001, 0x01000001, 0x00010001, 0x01010001, 0x00000101, 0x01000101, 0x00010101, 0x01010101,
43: 0x02000000, 0x03000000, 0x02010000, 0x03010000, 0x02000100, 0x03000100, 0x02010100, 0x03010100,
44: 0x02000001, 0x03000001, 0x02010001, 0x03010001, 0x02000101, 0x03000101, 0x02010101, 0x03010101,
45: 0x00020000, 0x01020000, 0x00030000, 0x01030000, 0x00020100, 0x01020100, 0x00030100, 0x01030100,
46: 0x00020001, 0x01020001, 0x00030001, 0x01030001, 0x00020101, 0x01020101, 0x00030101, 0x01030101,
47: 0x02020000, 0x03020000, 0x02030000, 0x03030000, 0x02020100, 0x03020100, 0x02030100, 0x03030100,
48: 0x02020001, 0x03020001, 0x02030001, 0x03030001, 0x02020101, 0x03020101, 0x02030101, 0x03030101,
49: 0x00000200, 0x01000200, 0x00010200, 0x01010200, 0x00000300, 0x01000300, 0x00010300, 0x01010300,
50: 0x00000201, 0x01000201, 0x00010201, 0x01010201, 0x00000301, 0x01000301, 0x00010301, 0x01010301,
51: 0x02000200, 0x03000200, 0x02010200, 0x03010200, 0x02000300, 0x03000300, 0x02010300, 0x03010300,
52: 0x02000201, 0x03000201, 0x02010201, 0x03010201, 0x02000301, 0x03000301, 0x02010301, 0x03010301,
53: 0x00020200, 0x01020200, 0x00030200, 0x01030200, 0x00020300, 0x01020300, 0x00030300, 0x01030300,
54: 0x00020201, 0x01020201, 0x00030201, 0x01030201, 0x00020301, 0x01020301, 0x00030301, 0x01030301,
55: 0x02020200, 0x03020200, 0x02030200, 0x03030200, 0x02020300, 0x03020300, 0x02030300, 0x03030300,
56: 0x02020201, 0x03020201, 0x02030201, 0x03030201, 0x02020301, 0x03020301, 0x02030301, 0x03030301,
57: 0x00000002, 0x01000002, 0x00010002, 0x01010002, 0x00000102, 0x01000102, 0x00010102, 0x01010102,
58: 0x00000003, 0x01000003, 0x00010003, 0x01010003, 0x00000103, 0x01000103, 0x00010103, 0x01010103,
59: 0x02000002, 0x03000002, 0x02010002, 0x03010002, 0x02000102, 0x03000102, 0x02010102, 0x03010102,
60: 0x02000003, 0x03000003, 0x02010003, 0x03010003, 0x02000103, 0x03000103, 0x02010103, 0x03010103,
61: 0x00020002, 0x01020002, 0x00030002, 0x01030002, 0x00020102, 0x01020102, 0x00030102, 0x01030102,
62: 0x00020003, 0x01020003, 0x00030003, 0x01030003, 0x00020103, 0x01020103, 0x00030103, 0x01030103,
63: 0x02020002, 0x03020002, 0x02030002, 0x03030002, 0x02020102, 0x03020102, 0x02030102, 0x03030102,
64: 0x02020003, 0x03020003, 0x02030003, 0x03030003, 0x02020103, 0x03020103, 0x02030103, 0x03030103,
65: 0x00000202, 0x01000202, 0x00010202, 0x01010202, 0x00000302, 0x01000302, 0x00010302, 0x01010302,
66: 0x00000203, 0x01000203, 0x00010203, 0x01010203, 0x00000303, 0x01000303, 0x00010303, 0x01010303,
67: 0x02000202, 0x03000202, 0x02010202, 0x03010202, 0x02000302, 0x03000302, 0x02010302, 0x03010302,
68: 0x02000203, 0x03000203, 0x02010203, 0x03010203, 0x02000303, 0x03000303, 0x02010303, 0x03010303,
69: 0x00020202, 0x01020202, 0x00030202, 0x01030202, 0x00020302, 0x01020302, 0x00030302, 0x01030302,
70: 0x00020203, 0x01020203, 0x00030203, 0x01030203, 0x00020303, 0x01020303, 0x00030303, 0x01030303,
71: 0x02020202, 0x03020202, 0x02030202, 0x03030202, 0x02020302, 0x03020302, 0x02030302, 0x03030302,
72: 0x02020203, 0x03020203, 0x02030203, 0x03030203, 0x02020303, 0x03020303, 0x02030303, 0x03030303,
73: };
1.1.1.3 root 74:
1.1.1.7 ! root 75: static Uint32 Remap_2_Planes_Upper[256] = {
1.1 root 76: 0x00000000, 0x04000000, 0x00040000, 0x04040000, 0x00000400, 0x04000400, 0x00040400, 0x04040400,
77: 0x00000004, 0x04000004, 0x00040004, 0x04040004, 0x00000404, 0x04000404, 0x00040404, 0x04040404,
78: 0x08000000, 0x0C000000, 0x08040000, 0x0C040000, 0x08000400, 0x0C000400, 0x08040400, 0x0C040400,
79: 0x08000004, 0x0C000004, 0x08040004, 0x0C040004, 0x08000404, 0x0C000404, 0x08040404, 0x0C040404,
80: 0x00080000, 0x04080000, 0x000C0000, 0x040C0000, 0x00080400, 0x04080400, 0x000C0400, 0x040C0400,
81: 0x00080004, 0x04080004, 0x000C0004, 0x040C0004, 0x00080404, 0x04080404, 0x000C0404, 0x040C0404,
82: 0x08080000, 0x0C080000, 0x080C0000, 0x0C0C0000, 0x08080400, 0x0C080400, 0x080C0400, 0x0C0C0400,
83: 0x08080004, 0x0C080004, 0x080C0004, 0x0C0C0004, 0x08080404, 0x0C080404, 0x080C0404, 0x0C0C0404,
84: 0x00000800, 0x04000800, 0x00040800, 0x04040800, 0x00000C00, 0x04000C00, 0x00040C00, 0x04040C00,
85: 0x00000804, 0x04000804, 0x00040804, 0x04040804, 0x00000C04, 0x04000C04, 0x00040C04, 0x04040C04,
86: 0x08000800, 0x0C000800, 0x08040800, 0x0C040800, 0x08000C00, 0x0C000C00, 0x08040C00, 0x0C040C00,
87: 0x08000804, 0x0C000804, 0x08040804, 0x0C040804, 0x08000C04, 0x0C000C04, 0x08040C04, 0x0C040C04,
88: 0x00080800, 0x04080800, 0x000C0800, 0x040C0800, 0x00080C00, 0x04080C00, 0x000C0C00, 0x040C0C00,
89: 0x00080804, 0x04080804, 0x000C0804, 0x040C0804, 0x00080C04, 0x04080C04, 0x000C0C04, 0x040C0C04,
90: 0x08080800, 0x0C080800, 0x080C0800, 0x0C0C0800, 0x08080C00, 0x0C080C00, 0x080C0C00, 0x0C0C0C00,
91: 0x08080804, 0x0C080804, 0x080C0804, 0x0C0C0804, 0x08080C04, 0x0C080C04, 0x080C0C04, 0x0C0C0C04,
92: 0x00000008, 0x04000008, 0x00040008, 0x04040008, 0x00000408, 0x04000408, 0x00040408, 0x04040408,
93: 0x0000000C, 0x0400000C, 0x0004000C, 0x0404000C, 0x0000040C, 0x0400040C, 0x0004040C, 0x0404040C,
94: 0x08000008, 0x0C000008, 0x08040008, 0x0C040008, 0x08000408, 0x0C000408, 0x08040408, 0x0C040408,
95: 0x0800000C, 0x0C00000C, 0x0804000C, 0x0C04000C, 0x0800040C, 0x0C00040C, 0x0804040C, 0x0C04040C,
96: 0x00080008, 0x04080008, 0x000C0008, 0x040C0008, 0x00080408, 0x04080408, 0x000C0408, 0x040C0408,
97: 0x0008000C, 0x0408000C, 0x000C000C, 0x040C000C, 0x0008040C, 0x0408040C, 0x000C040C, 0x040C040C,
98: 0x08080008, 0x0C080008, 0x080C0008, 0x0C0C0008, 0x08080408, 0x0C080408, 0x080C0408, 0x0C0C0408,
99: 0x0808000C, 0x0C08000C, 0x080C000C, 0x0C0C000C, 0x0808040C, 0x0C08040C, 0x080C040C, 0x0C0C040C,
100: 0x00000808, 0x04000808, 0x00040808, 0x04040808, 0x00000C08, 0x04000C08, 0x00040C08, 0x04040C08,
101: 0x0000080C, 0x0400080C, 0x0004080C, 0x0404080C, 0x00000C0C, 0x04000C0C, 0x00040C0C, 0x04040C0C,
102: 0x08000808, 0x0C000808, 0x08040808, 0x0C040808, 0x08000C08, 0x0C000C08, 0x08040C08, 0x0C040C08,
103: 0x0800080C, 0x0C00080C, 0x0804080C, 0x0C04080C, 0x08000C0C, 0x0C000C0C, 0x08040C0C, 0x0C040C0C,
104: 0x00080808, 0x04080808, 0x000C0808, 0x040C0808, 0x00080C08, 0x04080C08, 0x000C0C08, 0x040C0C08,
105: 0x0008080C, 0x0408080C, 0x000C080C, 0x040C080C, 0x00080C0C, 0x04080C0C, 0x000C0C0C, 0x040C0C0C,
106: 0x08080808, 0x0C080808, 0x080C0808, 0x0C0C0808, 0x08080C08, 0x0C080C08, 0x080C0C08, 0x0C0C0C08,
107: 0x0808080C, 0x0C08080C, 0x080C080C, 0x0C0C080C, 0x08080C0C, 0x0C080C0C, 0x080C0C0C, 0x0C0C0C0C,
108: };
1.1.1.3 root 109:
1.1.1.7 ! root 110: static Uint32 Remap_1_Plane[16] = {
1.1 root 111: 0x00000000+BASECOLOUR_LONG, 0x01000000+BASECOLOUR_LONG, 0x00010000+BASECOLOUR_LONG, 0x01010000+BASECOLOUR_LONG, 0x00000100+BASECOLOUR_LONG, 0x01000100+BASECOLOUR_LONG, 0x00010100+BASECOLOUR_LONG, 0x01010100+BASECOLOUR_LONG,
112: 0x00000001+BASECOLOUR_LONG, 0x01000001+BASECOLOUR_LONG, 0x00010001+BASECOLOUR_LONG, 0x01010001+BASECOLOUR_LONG, 0x00000101+BASECOLOUR_LONG, 0x01000101+BASECOLOUR_LONG, 0x00010101+BASECOLOUR_LONG, 0x01010101+BASECOLOUR_LONG,
113: };
114:
1.1.1.2 root 115: /*-----------------------------------------------------------------------*/
1.1 root 116: /*
117: Update the STRGBPalette[] array with current colours for this raster line.
118:
1.1.1.2 root 119: Return 'ScrUpdateFlag', 0x80000000=Full update, 0x40000000=Update as palette changed
1.1 root 120: */
1.1.1.7 ! root 121: static int AdjustLinePaletteRemap(void)
1.1 root 122: {
1.1.1.5 root 123: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
124: static const int endiantable[16] = {0,2,1,3,8,10,9,11,4,6,5,7,12,14,13,15};
125: #endif
1.1.1.2 root 126: unsigned short *actHBLPal;
127: int i;
128: int v;
1.1.1.5 root 129:
1.1.1.2 root 130: /* Copy palette and convert to RGB in display format */
131: actHBLPal = pHBLPalettes + (ScrY<<4); /* offset in palette */
132: for(i=0; i<16; i++)
133: {
134: v=*actHBLPal;
135: actHBLPal+=1;
136: v=v&0x777;
1.1.1.3 root 137: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
1.1.1.2 root 138: STRGBPalette[endiantable[i]] = ST2RGB[v];
139: #else
140: STRGBPalette[i] = ST2RGB[v];
141: #endif
142: }
1.1.1.3 root 143: ScrUpdateFlag = HBLPaletteMasks[ScrY];
1.1.1.2 root 144: return ScrUpdateFlag;
1.1 root 145: }
146:
1.1.1.2 root 147:
148: /*-----------------------------------------------------------------------*/
1.1 root 149: /*
150: Run updates to palette(STRGBPalette[]) until get to screen line we are to convert from
151: */
1.1.1.7 ! root 152: static void Convert_StartFrame(void)
1.1 root 153: {
154: int ecx;
155: ecx=STScreenStartHorizLine; /* Get #lines before conversion starts */
156: if( ecx==0 ) return;
157: ScrY=0;
158: do
159: {
160: AdjustLinePaletteRemap(); /* Update palette */
161: ++ScrY;
162: --ecx;
163: }
164: while( ecx );
165: }
166:
167:
168:
169:
170:
171: #define LOW_BUILD_PIXELS_0 \
172: { \
173: ebx &= 0x0f0f0f0f; \
174: ecx &= 0x0f0f0f0f; \
175: eax = ebx >> 12; \
176: eax |= ebx; \
177: edx = ecx >> 12; \
178: edx |= ecx; \
179: ebx = edx; \
180: ebx &= 0x00ff; \
181: ecx = Remap_2_Planes_Upper[ebx]; \
182: ebx = eax; \
183: ebx &= 0x00ff; \
184: ecx += Remap_2_Planes[ebx]; \
185: }
186:
187: #define LOW_BUILD_PIXELS_1 \
188: { \
189: ebx = edx; \
190: ebx = ebx >> 8; \
191: ebx &= 0x00ff; \
192: ecx = Remap_2_Planes_Upper[ebx]; \
193: ebx = eax; \
194: ebx = ebx >> 8; \
195: ebx &= 0x00ff; \
196: ecx += Remap_2_Planes[ebx]; \
197: }
198:
199: #define LOW_BUILD_PIXELS_2 \
200: { \
201: ebx = *edi; \
202: ecx = *(edi+1); \
203: ebx &= 0xf0f0f0f0; \
204: ecx &= 0xf0f0f0f0; \
205: ebx = ebx >> 4; \
206: eax = ebx; \
207: ebx = ebx >> 12; \
208: eax |= ebx; \
209: ecx = ecx >> 4; \
210: edx = ecx; \
211: ecx = ecx >> 12; \
212: edx |= ecx; \
213: ebx = edx; \
214: ebx &= 0x00ff; \
215: ecx = Remap_2_Planes_Upper[ebx]; \
216: ebx = eax; \
217: ebx &= 0x00ff; \
218: ecx += Remap_2_Planes[ebx]; \
219: }
220:
221: #define LOW_BUILD_PIXELS_3 \
222: { \
223: ebx = edx; \
224: ebx = ebx >> 8; \
225: ebx &= 0x00ff; \
226: ecx = Remap_2_Planes_Upper[ebx]; \
227: ebx = eax; \
228: ebx = ebx >> 8; \
229: ebx &= 0x00ff; \
230: ecx += Remap_2_Planes[ebx]; \
231: }
232:
1.1.1.2 root 233:
234: #define MED_BUILD_PIXELS_0 \
235: { \
236: ebx &= 0x0f0f0f0f; \
237: eax = ebx; \
238: eax >>= 12; \
239: eax |= ebx; \
240: ebx = eax; \
241: ebx &= 0x000000ff; \
242: ecx = Remap_2_Planes[ebx]; \
243: }
244:
245: #define MED_BUILD_PIXELS_1 \
246: { \
247: ebx = eax; \
248: ebx >>=8; \
249: ebx &= 0x000000ff; \
250: ecx = Remap_2_Planes[ebx]; \
251: }
252:
253: #define MED_BUILD_PIXELS_2 \
254: { \
255: ebx = *edi; \
256: ebx &= 0xf0f0f0f0; \
257: ebx >>= 4; \
258: eax = ebx; \
259: ebx >>= 12; \
260: eax |= ebx; \
261: ebx = eax; \
262: ebx &= 0x000000ff; \
263: ecx = Remap_2_Planes[ebx]; \
264: }
265:
266: #define MED_BUILD_PIXELS_3 \
267: { \
268: ebx = eax; \
269: ebx >>= 8; \
270: ebx &= 0x000000ff; \
271: ecx = Remap_2_Planes[ebx]; \
272: }
273:
1.1.1.3 root 274:
275: /* Routines to create 'ecx' pixels - MUST be called in this order */
276: #define HIGH_BUILD_PIXELS_0 \
277: { \
278: eax = ebx; \
279: eax &= 0x0000000f; \
280: }
281:
282: #define HIGH_BUILD_PIXELS_1 \
283: { \
284: eax = ebx; \
285: eax >>= 4; \
286: eax &= 0x0000000f;\
287: }
288:
289: #define HIGH_BUILD_PIXELS_2 \
290: { \
291: eax = ebx; \
292: eax >>= 8; \
293: eax &= 0x0000000f;\
294: }
295:
296: #define HIGH_BUILD_PIXELS_3 \
297: { \
298: eax = ebx; \
299: eax >>= 12; \
300: eax &= 0x0000000f;\
301: }
302:
303:
304: /* Plot Low Resolution (320xH) 16-Bit pixels */
305: #define PLOT_LOW_320_16BIT(offset) \
306: { \
307: ebx = ecx; \
308: ebx &= 0x00ff; \
309: ecx = ecx >> 8; \
310: ebx = STRGBPalette[ebx]; \
311: esi[offset] = (unsigned short) ebx; \
312: ebx = ecx; \
313: ebx &= 0x00ff; \
314: ecx = ecx >> 8; \
315: ebx = STRGBPalette[ebx]; \
316: esi[offset+1] = (unsigned short) ebx; \
317: ebx = ecx; \
318: ebx &= 0x00ff; \
319: ecx = ecx >> 8; \
320: ebx = STRGBPalette[ebx]; \
321: esi[offset+2] = (unsigned short) ebx; \
322: ebx = ecx; \
323: ebx &= 0x00ff; \
324: ebx = STRGBPalette[ebx]; \
325: esi[offset+3] = (unsigned short) ebx; \
326: }
327:
1.1.1.5 root 328: /* Plot Low Resolution (320xH) 8-Bit pixels */
329: #define PLOT_LOW_320_8BIT(offset) \
330: { \
331: ecx += BASECOLOUR_LONG; \
332: esi[offset] = SDL_SwapLE32(ecx); \
333: }
334:
1.1.1.6 root 335: /* Plot Low Resolution (640xH) 8-Bit pixels */
336: #define PLOT_LOW_640_8BIT(offset) \
337: { \
338: ecx += BASECOLOUR_LONG; \
339: ebpp = ecx; \
340: ebx = ebpp; \
341: ecx &= 0x000000ff; \
342: ebx &= 0x0000ff00; \
343: ebx <<= 8; \
344: ecx |= ebx; \
345: ebx = ecx; \
346: ebx <<= 8; \
347: ecx |= ebx; \
348: esi[offset] = SDL_SwapLE32(ecx); \
349: ecx = ebpp; \
350: ebx = ebpp; \
351: ecx &= 0xff000000; \
352: ebx &= 0x00ff0000; \
353: ebx >>= 8; \
354: ecx |= ebx; \
355: ebx = ecx; \
356: ebx >>= 8; \
357: ecx |= ebx; \
358: esi[offset+1] = SDL_SwapLE32(ecx); \
359: }
360:
361: /* Plot Low Resolution (640xH) 8-Bit pixels (double on Y) */
362: #define PLOT_LOW_640_8BIT_DOUBLE_Y(offset) \
363: { \
364: ecx += BASECOLOUR_LONG; \
365: ebpp = ecx; \
366: ebx = ebpp; \
367: ecx &= 0x000000ff; \
368: ebx &= 0x0000ff00; \
369: ebx <<= 8; \
370: ecx |= ebx; \
371: ebx = ecx; \
372: ebx <<= 8; \
373: ecx |= ebx; \
374: esi[offset] = esi[offset+PCScreenBytesPerLine/4] = SDL_SwapLE32(ecx); \
375: ecx = ebpp; \
376: ebx = ebpp; \
377: ecx &= 0xff000000; \
378: ebx &= 0x00ff0000; \
379: ebx >>= 8; \
380: ecx |= ebx; \
381: ebx = ecx; \
382: ebx >>= 8; \
383: ecx |= ebx; \
384: esi[offset+1] = esi[offset+1+PCScreenBytesPerLine/4] = SDL_SwapLE32(ecx); \
385: }
386:
1.1.1.3 root 387: /* Plot Low Resolution (640xH) 16-Bit pixels */
388: #define PLOT_LOW_640_16BIT(offset) \
389: { \
390: ebx = ecx; \
391: ebx &= 0x000000ff; \
392: ecx >>= 8; \
393: ebx = STRGBPalette[ebx]; \
394: esi[offset] = ebx; \
395: ebx = ecx; \
396: ebx &= 0x000000ff; \
397: ecx >>= 8; \
398: ebx = STRGBPalette[ebx]; \
399: esi[offset+1] = ebx; \
400: ebx = ecx; \
401: ebx &= 0x000000ff; \
402: ecx >>= 8; \
403: ebx = STRGBPalette[ebx]; \
404: esi[offset+2] = ebx; \
405: ebx = ecx; \
406: ebx &= 0x000000ff; \
407: ebx = STRGBPalette[ebx]; \
408: esi[offset+3] = ebx; \
409: }
410:
411: /* Plot Low Resolution (640xH) 16-Bit pixels (Double on Y) */
412: #define PLOT_LOW_640_16BIT_DOUBLE_Y(offset) \
413: { \
414: ebx = ecx; \
415: ebx &= 0x000000ff; \
416: ecx >>= 8; \
417: ebx = STRGBPalette[ebx]; \
418: esi[offset] = ebx; \
419: esi[offset+PCScreenBytesPerLine/4] = ebx; \
420: ebx = ecx; \
421: ebx &= 0x000000ff; \
422: ecx >>= 8; \
423: ebx = STRGBPalette[ebx]; \
424: esi[offset+1] = ebx; \
425: esi[offset+1+PCScreenBytesPerLine/4] = ebx; \
426: ebx = ecx; \
427: ebx &= 0x000000ff; \
428: ecx >>= 8; \
429: ebx = STRGBPalette[ebx]; \
430: esi[offset+2] = ebx; \
431: esi[offset+2+PCScreenBytesPerLine/4] = ebx; \
432: ebx = ecx; \
433: ebx &= 0x000000ff; \
434: ebx = STRGBPalette[ebx]; \
435: esi[offset+3] = ebx; \
436: esi[offset+3+PCScreenBytesPerLine/4] = ebx; \
437: }
438:
439:
1.1.1.5 root 440: /* Plot Medium Resolution (640xH) 8-Bit pixels */
441: #define PLOT_MED_640_8BIT(offset) \
442: { \
443: ecx += BASECOLOUR_LONG; \
444: esi[offset] = SDL_SwapLE32(ecx); \
445: }
446:
1.1.1.6 root 447: /* Plot Medium Resolution (640xH) 8-Bit pixels (Double on Y) */
448: #define PLOT_MED_640_8BIT_DOUBLE_Y(offset) \
449: { \
450: ecx += BASECOLOUR_LONG; \
451: esi[offset] = esi[offset+PCScreenBytesPerLine/4] = SDL_SwapLE32(ecx); \
452: }
453:
1.1.1.2 root 454: /* Plot Medium Resolution(640xH) 16-Bit pixels */
455: #define PLOT_MED_640_16BIT(offset) \
456: { \
457: ebx = ecx; \
458: ebx &= 0x000000ff; \
459: ecx >>= 8; \
460: ebx = STRGBPalette[ebx]; \
461: esi[offset] = (Uint16)ebx; \
462: ebx = ecx; \
463: ebx &= 0x000000ff; \
464: ecx >>= 8; \
465: ebx = STRGBPalette[ebx]; \
466: esi[offset+1] = (Uint16)ebx; \
467: ebx = ecx; \
468: ebx &= 0x000000ff; \
469: ecx >>= 8; \
470: ebx = STRGBPalette[ebx]; \
471: esi[offset+2] = (Uint16)ebx; \
472: ebx = ecx; \
473: ebx &= 0x000000ff; \
474: ebx = STRGBPalette[ebx]; \
475: esi[offset+3] = (Uint16)ebx; \
476: }
477:
478: /* Plot Medium Resolution(640xH) 16-Bit pixels (Double on Y) */
479: #define PLOT_MED_640_16BIT_DOUBLE_Y(offset) \
480: { \
481: ebx = ecx; \
482: ebx &= 0x000000ff; \
483: ecx >>= 8; \
484: ebx = STRGBPalette[ebx]; \
485: esi[offset] = (Uint16)ebx; \
1.1.1.3 root 486: esi[offset+PCScreenBytesPerLine/2] = (Uint16)ebx; \
1.1.1.2 root 487: ebx = ecx; \
488: ebx &= 0x000000ff; \
489: ecx >>= 8; \
490: ebx = STRGBPalette[ebx]; \
491: esi[offset+1] = (Uint16)ebx; \
1.1.1.3 root 492: esi[offset+1+PCScreenBytesPerLine/2] = (Uint16)ebx; \
1.1.1.2 root 493: ebx = ecx; \
494: ebx &= 0x000000ff; \
495: ecx >>= 8; \
496: ebx = STRGBPalette[ebx]; \
497: esi[offset+2] = (Uint16)ebx; \
1.1.1.3 root 498: esi[offset+2+PCScreenBytesPerLine/2] = (Uint16)ebx; \
1.1.1.2 root 499: ebx = ecx; \
500: ebx &= 0x000000ff; \
501: ebx = STRGBPalette[ebx]; \
502: esi[offset+3] = (Uint16)ebx; \
1.1.1.3 root 503: esi[offset+3+PCScreenBytesPerLine/2] = (Uint16)ebx; \
504: }
505:
506:
507: /* Plot High Resolution (640xH) 8-Bit pixels */
508: #define PLOT_HIGH_640_8BIT(offset) \
509: { \
1.1.1.5 root 510: esi[offset] = SDL_SwapLE32(Remap_1_Plane[eax]); \
1.1.1.2 root 511: }
512:
513:
514: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
515: #define PLOT_SPEC512_LEFT_LOW_320_16BIT(offset) \
516: { \
517: ecx &= 0x000000ff; \
518: ebx = STRGBPalette[ecx]; \
519: esi[offset] = (Uint16)ebx; \
520: }
521:
522: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
523: #define PLOT_SPEC512_MID_320_16BIT(offset) \
524: { \
525: ebx = ecx; \
526: ebx &= 0x000000ff; \
527: ecx >>= 8; \
528: ebx = STRGBPalette[ebx]; \
529: esi[offset] = (Uint16)ebx; \
530: ebx = ecx; \
531: ebx &= 0x000000ff; \
532: ecx >>= 8; \
533: ebx = STRGBPalette[ebx]; \
534: esi[offset+1] = (Uint16)ebx; \
535: ebx = ecx; \
536: ebx &= 0x000000ff; \
537: ecx >>= 8; \
538: ebx = STRGBPalette[ebx]; \
539: esi[offset+2] = (Uint16)ebx; \
540: ebx = ecx; \
541: ebx &= 0x000000ff; \
542: ebx = STRGBPalette[ebx]; \
543: esi[offset+3] = (Uint16)ebx; \
544: }
545:
546: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
547: #define PLOT_SPEC512_END_LOW_320_16BIT(offset) \
548: { \
549: ebx = ecx; \
550: ebx &= 0x000000ff; \
551: ecx >>= 8; \
552: ebx = STRGBPalette[ebx]; \
553: esi[offset] = (Uint16)ebx; \
554: ebx = ecx; \
555: ebx &= 0x000000ff; \
556: ecx >>= 8; \
557: ebx = STRGBPalette[ebx]; \
558: esi[offset+1] = (Uint16)ebx; \
559: ebx = ecx; \
560: ebx &= 0x000000ff; \
561: ecx >>= 8; \
562: ebx = STRGBPalette[ebx]; \
563: esi[offset+2] = (Uint16)ebx; \
564: }
1.1 root 565:
566:
1.1.1.6 root 567: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
568: #define PLOT_SPEC512_LEFT_LOW_640_16BIT(offset) \
569: { \
570: ecx &= 0x000000ff; \
571: ebx = STRGBPalette[ecx]; \
572: esi[offset] = ebx; \
573: }
574:
575: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
576: #define PLOT_SPEC512_MID_640_16BIT(offset) \
577: { \
578: ebx = ecx; \
579: ebx &= 0x000000ff; \
580: ecx >>= 8; \
581: ebx = STRGBPalette[ebx]; \
582: esi[offset] = ebx; \
583: ebx = ecx; \
584: ebx &= 0x000000ff; \
585: ecx >>= 8; \
586: ebx = STRGBPalette[ebx]; \
587: esi[offset+1] = ebx; \
588: ebx = ecx; \
589: ebx &= 0x000000ff; \
590: ecx >>= 8; \
591: ebx = STRGBPalette[ebx]; \
592: esi[offset+2] = ebx; \
593: ebx = ecx; \
594: ebx &= 0x000000ff; \
595: ebx = STRGBPalette[ebx]; \
596: esi[offset+3] = ebx; \
597: }
598:
599: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
600: #define PLOT_SPEC512_END_LOW_640_16BIT(offset) \
601: { \
602: ebx = ecx; \
603: ebx &= 0x000000ff; \
604: ecx >>= 8; \
605: ebx = STRGBPalette[ebx]; \
606: esi[offset] = ebx; \
607: ebx = ecx; \
608: ebx &= 0x000000ff; \
609: ecx >>= 8; \
610: ebx = STRGBPalette[ebx]; \
611: esi[offset+1] = ebx; \
612: ebx = ecx; \
613: ebx &= 0x000000ff; \
614: ecx >>= 8; \
615: ebx = STRGBPalette[ebx]; \
616: esi[offset+2] = ebx; \
617: }
618:
619: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
620: #define PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(offset) \
621: { \
622: ecx &= 0x000000ff; \
623: ebx = STRGBPalette[ecx]; \
624: esi[offset] = ebx; \
625: esi[offset+PCScreenBytesPerLine/4] = ebx; \
626: }
627:
628: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
629: #define PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(offset) \
630: { \
631: ebx = ecx; \
632: ebx &= 0x000000ff; \
633: ecx >>= 8; \
634: ebx = STRGBPalette[ebx]; \
635: esi[offset] = ebx; \
636: esi[offset+PCScreenBytesPerLine/4] = ebx; \
637: ebx = ecx; \
638: ebx &= 0x000000ff; \
639: ecx >>= 8; \
640: ebx = STRGBPalette[ebx]; \
641: esi[offset+1] = ebx; \
642: esi[offset+1+PCScreenBytesPerLine/4] = ebx; \
643: ebx = ecx; \
644: ebx &= 0x000000ff; \
645: ecx >>= 8; \
646: ebx = STRGBPalette[ebx]; \
647: esi[offset+2] = ebx; \
648: esi[offset+2+PCScreenBytesPerLine/4] = ebx; \
649: ebx = ecx; \
650: ebx &= 0x000000ff; \
651: ebx = STRGBPalette[ebx]; \
652: esi[offset+3] = ebx; \
653: esi[offset+3+PCScreenBytesPerLine/4] = ebx; \
654: }
655:
656: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
657: #define PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(offset) \
658: { \
659: ebx = ecx; \
660: ebx &= 0x000000ff; \
661: ecx >>= 8; \
662: ebx = STRGBPalette[ebx]; \
663: esi[offset] = ebx; \
664: esi[offset+PCScreenBytesPerLine/4] = ebx; \
665: ebx = ecx; \
666: ebx &= 0x000000ff; \
667: ecx >>= 8; \
668: ebx = STRGBPalette[ebx]; \
669: esi[offset+1] = ebx; \
670: esi[offset+1+PCScreenBytesPerLine/4] = ebx; \
671: ebx = ecx; \
672: ebx &= 0x000000ff; \
673: ecx >>= 8; \
674: ebx = STRGBPalette[ebx]; \
675: esi[offset+2] = ebx; \
676: esi[offset+2+PCScreenBytesPerLine/4] = ebx; \
677: }
678:
679:
1.1 root 680:
681: /* Conversion routines */
682: #include "convert/low320x16.c" /* LowRes To 320xH x 16-bit colour */
683: #include "convert/low640x16.c" /* LowRes To 640xH x 16-bit colour */
684: #include "convert/med640x16.c" /* MediumRes To 640xH x 16-bit colour */
685: #include "convert/low320x8.c" /* LowRes To 320xH x 8-bit colour */
686: #include "convert/low640x8.c" /* LowRes To 640xH x 8-bit colour */
687: #include "convert/med640x8.c" /* MediumRes To 640xH x 8-bit colour */
688: #include "convert/high640x8.c" /* HighRes To 640xH x 8-bit colour */
689: #include "convert/high640x1.c" /* HighRes To 640xH x 1-bit colour */
690: #include "convert/spec320x16.c" /* Spectrum 512 To 320xH x 16-bit colour */
691: #include "convert/spec640x16.c" /* Spectrum 512 To 640xH x 16-bit colour */
692:
693: #include "convert/vdi16.c" /* VDI x 16 colour */
694: #include "convert/vdi4.c" /* VDI x 4 colour */
695: #include "convert/vdi2.c" /* VDI x 2 colour */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.