|
|
1.1 root 1: /*
2: Hatari - macros.h
3:
4: Lookup tables and macros for screen conversion routines.
5:
1.1.1.7 root 6: This file is distributed under the GNU General Public License, version 2
7: or at your option any later version. Read the file gpl.txt for details.
1.1 root 8: */
9:
10: #ifndef HATARI_CONVERTMACROS_H
11: #define HATARI_CONVERTMACROS_H
12:
13: /* Remap tables to convert from plane format to byte-per-pixel
14: * (Upper is for 4-Planes so if shifted by 2)
15: */
1.1.1.2 root 16: static const Uint32 Remap_2_Planes[256] = {
1.1 root 17: 0x00000000, 0x01000000, 0x00010000, 0x01010000, 0x00000100, 0x01000100, 0x00010100, 0x01010100,
18: 0x00000001, 0x01000001, 0x00010001, 0x01010001, 0x00000101, 0x01000101, 0x00010101, 0x01010101,
19: 0x02000000, 0x03000000, 0x02010000, 0x03010000, 0x02000100, 0x03000100, 0x02010100, 0x03010100,
20: 0x02000001, 0x03000001, 0x02010001, 0x03010001, 0x02000101, 0x03000101, 0x02010101, 0x03010101,
21: 0x00020000, 0x01020000, 0x00030000, 0x01030000, 0x00020100, 0x01020100, 0x00030100, 0x01030100,
22: 0x00020001, 0x01020001, 0x00030001, 0x01030001, 0x00020101, 0x01020101, 0x00030101, 0x01030101,
23: 0x02020000, 0x03020000, 0x02030000, 0x03030000, 0x02020100, 0x03020100, 0x02030100, 0x03030100,
24: 0x02020001, 0x03020001, 0x02030001, 0x03030001, 0x02020101, 0x03020101, 0x02030101, 0x03030101,
25: 0x00000200, 0x01000200, 0x00010200, 0x01010200, 0x00000300, 0x01000300, 0x00010300, 0x01010300,
26: 0x00000201, 0x01000201, 0x00010201, 0x01010201, 0x00000301, 0x01000301, 0x00010301, 0x01010301,
27: 0x02000200, 0x03000200, 0x02010200, 0x03010200, 0x02000300, 0x03000300, 0x02010300, 0x03010300,
28: 0x02000201, 0x03000201, 0x02010201, 0x03010201, 0x02000301, 0x03000301, 0x02010301, 0x03010301,
29: 0x00020200, 0x01020200, 0x00030200, 0x01030200, 0x00020300, 0x01020300, 0x00030300, 0x01030300,
30: 0x00020201, 0x01020201, 0x00030201, 0x01030201, 0x00020301, 0x01020301, 0x00030301, 0x01030301,
31: 0x02020200, 0x03020200, 0x02030200, 0x03030200, 0x02020300, 0x03020300, 0x02030300, 0x03030300,
32: 0x02020201, 0x03020201, 0x02030201, 0x03030201, 0x02020301, 0x03020301, 0x02030301, 0x03030301,
33: 0x00000002, 0x01000002, 0x00010002, 0x01010002, 0x00000102, 0x01000102, 0x00010102, 0x01010102,
34: 0x00000003, 0x01000003, 0x00010003, 0x01010003, 0x00000103, 0x01000103, 0x00010103, 0x01010103,
35: 0x02000002, 0x03000002, 0x02010002, 0x03010002, 0x02000102, 0x03000102, 0x02010102, 0x03010102,
36: 0x02000003, 0x03000003, 0x02010003, 0x03010003, 0x02000103, 0x03000103, 0x02010103, 0x03010103,
37: 0x00020002, 0x01020002, 0x00030002, 0x01030002, 0x00020102, 0x01020102, 0x00030102, 0x01030102,
38: 0x00020003, 0x01020003, 0x00030003, 0x01030003, 0x00020103, 0x01020103, 0x00030103, 0x01030103,
39: 0x02020002, 0x03020002, 0x02030002, 0x03030002, 0x02020102, 0x03020102, 0x02030102, 0x03030102,
40: 0x02020003, 0x03020003, 0x02030003, 0x03030003, 0x02020103, 0x03020103, 0x02030103, 0x03030103,
41: 0x00000202, 0x01000202, 0x00010202, 0x01010202, 0x00000302, 0x01000302, 0x00010302, 0x01010302,
42: 0x00000203, 0x01000203, 0x00010203, 0x01010203, 0x00000303, 0x01000303, 0x00010303, 0x01010303,
43: 0x02000202, 0x03000202, 0x02010202, 0x03010202, 0x02000302, 0x03000302, 0x02010302, 0x03010302,
44: 0x02000203, 0x03000203, 0x02010203, 0x03010203, 0x02000303, 0x03000303, 0x02010303, 0x03010303,
45: 0x00020202, 0x01020202, 0x00030202, 0x01030202, 0x00020302, 0x01020302, 0x00030302, 0x01030302,
46: 0x00020203, 0x01020203, 0x00030203, 0x01030203, 0x00020303, 0x01020303, 0x00030303, 0x01030303,
47: 0x02020202, 0x03020202, 0x02030202, 0x03030202, 0x02020302, 0x03020302, 0x02030302, 0x03030302,
48: 0x02020203, 0x03020203, 0x02030203, 0x03030203, 0x02020303, 0x03020303, 0x02030303, 0x03030303,
49: };
50:
1.1.1.2 root 51: static const Uint32 Remap_2_Planes_Upper[256] = {
1.1 root 52: 0x00000000, 0x04000000, 0x00040000, 0x04040000, 0x00000400, 0x04000400, 0x00040400, 0x04040400,
53: 0x00000004, 0x04000004, 0x00040004, 0x04040004, 0x00000404, 0x04000404, 0x00040404, 0x04040404,
54: 0x08000000, 0x0C000000, 0x08040000, 0x0C040000, 0x08000400, 0x0C000400, 0x08040400, 0x0C040400,
55: 0x08000004, 0x0C000004, 0x08040004, 0x0C040004, 0x08000404, 0x0C000404, 0x08040404, 0x0C040404,
56: 0x00080000, 0x04080000, 0x000C0000, 0x040C0000, 0x00080400, 0x04080400, 0x000C0400, 0x040C0400,
57: 0x00080004, 0x04080004, 0x000C0004, 0x040C0004, 0x00080404, 0x04080404, 0x000C0404, 0x040C0404,
58: 0x08080000, 0x0C080000, 0x080C0000, 0x0C0C0000, 0x08080400, 0x0C080400, 0x080C0400, 0x0C0C0400,
59: 0x08080004, 0x0C080004, 0x080C0004, 0x0C0C0004, 0x08080404, 0x0C080404, 0x080C0404, 0x0C0C0404,
60: 0x00000800, 0x04000800, 0x00040800, 0x04040800, 0x00000C00, 0x04000C00, 0x00040C00, 0x04040C00,
61: 0x00000804, 0x04000804, 0x00040804, 0x04040804, 0x00000C04, 0x04000C04, 0x00040C04, 0x04040C04,
62: 0x08000800, 0x0C000800, 0x08040800, 0x0C040800, 0x08000C00, 0x0C000C00, 0x08040C00, 0x0C040C00,
63: 0x08000804, 0x0C000804, 0x08040804, 0x0C040804, 0x08000C04, 0x0C000C04, 0x08040C04, 0x0C040C04,
64: 0x00080800, 0x04080800, 0x000C0800, 0x040C0800, 0x00080C00, 0x04080C00, 0x000C0C00, 0x040C0C00,
65: 0x00080804, 0x04080804, 0x000C0804, 0x040C0804, 0x00080C04, 0x04080C04, 0x000C0C04, 0x040C0C04,
66: 0x08080800, 0x0C080800, 0x080C0800, 0x0C0C0800, 0x08080C00, 0x0C080C00, 0x080C0C00, 0x0C0C0C00,
67: 0x08080804, 0x0C080804, 0x080C0804, 0x0C0C0804, 0x08080C04, 0x0C080C04, 0x080C0C04, 0x0C0C0C04,
68: 0x00000008, 0x04000008, 0x00040008, 0x04040008, 0x00000408, 0x04000408, 0x00040408, 0x04040408,
69: 0x0000000C, 0x0400000C, 0x0004000C, 0x0404000C, 0x0000040C, 0x0400040C, 0x0004040C, 0x0404040C,
70: 0x08000008, 0x0C000008, 0x08040008, 0x0C040008, 0x08000408, 0x0C000408, 0x08040408, 0x0C040408,
71: 0x0800000C, 0x0C00000C, 0x0804000C, 0x0C04000C, 0x0800040C, 0x0C00040C, 0x0804040C, 0x0C04040C,
72: 0x00080008, 0x04080008, 0x000C0008, 0x040C0008, 0x00080408, 0x04080408, 0x000C0408, 0x040C0408,
73: 0x0008000C, 0x0408000C, 0x000C000C, 0x040C000C, 0x0008040C, 0x0408040C, 0x000C040C, 0x040C040C,
74: 0x08080008, 0x0C080008, 0x080C0008, 0x0C0C0008, 0x08080408, 0x0C080408, 0x080C0408, 0x0C0C0408,
75: 0x0808000C, 0x0C08000C, 0x080C000C, 0x0C0C000C, 0x0808040C, 0x0C08040C, 0x080C040C, 0x0C0C040C,
76: 0x00000808, 0x04000808, 0x00040808, 0x04040808, 0x00000C08, 0x04000C08, 0x00040C08, 0x04040C08,
77: 0x0000080C, 0x0400080C, 0x0004080C, 0x0404080C, 0x00000C0C, 0x04000C0C, 0x00040C0C, 0x04040C0C,
78: 0x08000808, 0x0C000808, 0x08040808, 0x0C040808, 0x08000C08, 0x0C000C08, 0x08040C08, 0x0C040C08,
79: 0x0800080C, 0x0C00080C, 0x0804080C, 0x0C04080C, 0x08000C0C, 0x0C000C0C, 0x08040C0C, 0x0C040C0C,
80: 0x00080808, 0x04080808, 0x000C0808, 0x040C0808, 0x00080C08, 0x04080C08, 0x000C0C08, 0x040C0C08,
81: 0x0008080C, 0x0408080C, 0x000C080C, 0x040C080C, 0x00080C0C, 0x04080C0C, 0x000C0C0C, 0x040C0C0C,
82: 0x08080808, 0x0C080808, 0x080C0808, 0x0C0C0808, 0x08080C08, 0x0C080C08, 0x080C0C08, 0x0C0C0C08,
83: 0x0808080C, 0x0C08080C, 0x080C080C, 0x0C0C080C, 0x08080C0C, 0x0C080C0C, 0x080C0C0C, 0x0C0C0C0C,
84: };
85:
1.1.1.6 root 86:
87: /*----------------------------------------------------------------------*/
88: /* Macros to convert from Atari's planar mode to chunky mode
89: * (1 byte per pixel). Convert by blocks of 4 pixels.
90: * 16 low res pixels -> 4 planes of 16 bits
91: * 16 med res pixels -> 2 planes of 16 bits
92: * 16 hi res pixels -> 1 plane of 16 bits
93: */
94:
1.1 root 95: #define LOW_BUILD_PIXELS_0 \
96: { \
97: ebx &= 0x0f0f0f0f; \
98: ecx &= 0x0f0f0f0f; \
99: eax = (ebx >> 12) | ebx; \
100: edx = (ecx >> 12) | ecx; \
101: ecx = Remap_2_Planes_Upper[edx & 0x00ff]; \
102: ecx += Remap_2_Planes[eax & 0x00ff]; \
103: }
104:
105: #define LOW_BUILD_PIXELS_1 \
106: { \
107: ecx = Remap_2_Planes_Upper[(edx >> 8) & 0x00ff]; \
108: ecx += Remap_2_Planes[(eax >> 8) & 0x00ff]; \
109: }
110:
111: #define LOW_BUILD_PIXELS_2 \
112: { \
113: ebx = (*edi & 0xf0f0f0f0) >> 4; \
114: ecx = (*(edi+1) & 0xf0f0f0f0) >> 4; \
115: eax = (ebx >> 12) | ebx; \
116: edx = (ecx >> 12) | ecx; \
117: ecx = Remap_2_Planes_Upper[edx & 0x00ff]; \
118: ecx += Remap_2_Planes[eax & 0x00ff]; \
119: }
120:
121: #define LOW_BUILD_PIXELS_3 \
122: { \
123: ecx = Remap_2_Planes_Upper[(edx >> 8) & 0x00ff]; \
124: ecx += Remap_2_Planes[(eax >> 8) & 0x00ff]; \
125: }
126:
127:
128: #define MED_BUILD_PIXELS_0 \
129: { \
130: ebx &= 0x0f0f0f0f; \
131: eax = (ebx >> 12) | ebx; \
132: ecx = Remap_2_Planes[eax & 0x000000ff]; \
133: }
134:
135: #define MED_BUILD_PIXELS_1 \
136: { \
137: ecx = Remap_2_Planes[(eax >> 8) & 0x000000ff]; \
138: }
139:
140: #define MED_BUILD_PIXELS_2 \
141: { \
142: ebx = (*edi & 0xf0f0f0f0) >> 4; \
143: eax = (ebx >> 12) | ebx; \
144: ecx = Remap_2_Planes[eax & 0x000000ff]; \
145: }
146:
147: #define MED_BUILD_PIXELS_3 \
148: { \
149: ecx = Remap_2_Planes[(eax >> 8) & 0x000000ff]; \
150: }
151:
152:
1.1.1.6 root 153: /*----------------------------------------------------------------------*/
154: /* Macros to plot Atari's pixels in the emulator's buffer
155: * (the buffer can be 32, 16 or 8 bits per pixel)
156: */
157:
158: /*
159: * 32 bit screen format
160: */
161:
1.1.1.3 root 162: /* Plot Low Resolution (320xH) 32-Bit pixels */
163: #define PLOT_LOW_320_32BIT(offset) \
164: { \
165: esi[offset] = (Uint32)STRGBPalette[ecx & 0x00ff]; \
166: esi[offset+1] = (Uint32)STRGBPalette[(ecx >> 8) & 0x00ff]; \
167: esi[offset+2] = (Uint32)STRGBPalette[(ecx >> 16) & 0x00ff]; \
168: esi[offset+3] = (Uint32)STRGBPalette[(ecx >> 24) & 0x00ff]; \
169: }
170:
171: /* Plot Low Resolution (640xH) 32-Bit pixels */
172: #define PLOT_LOW_640_32BIT(offset) \
173: { \
174: esi[offset+0] = esi[offset+1] = STRGBPalette[ecx & 0x000000ff]; \
175: esi[offset+2] = esi[offset+3] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
176: esi[offset+4] = esi[offset+5] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
177: esi[offset+6] = esi[offset+7] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
178: }
179:
180: /* Plot Low Resolution (640xH) 16-Bit pixels (Double on Y) */
181: #define PLOT_LOW_640_32BIT_DOUBLE_Y(offset) \
182: { \
183: ebx = STRGBPalette[ecx & 0x000000ff]; \
184: esi[offset+0] = esi[offset+1] = esi[offset+Screen4BytesPerLine+0] \
185: = esi[offset+Screen4BytesPerLine+1] = ebx; \
186: ebx = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
187: esi[offset+2] = esi[offset+3] = esi[offset+Screen4BytesPerLine+2] \
188: = esi[offset+Screen4BytesPerLine+3] = ebx; \
189: ebx = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
190: esi[offset+4] = esi[offset+5] = esi[offset+Screen4BytesPerLine+4] \
191: = esi[offset+Screen4BytesPerLine+5] = ebx; \
192: ebx = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
193: esi[offset+6] = esi[offset+7] = esi[offset+Screen4BytesPerLine+6] \
194: = esi[offset+Screen4BytesPerLine+7] = ebx; \
195: }
196:
197: /* Plot Medium Resolution(640xH) 32-Bit pixels */
198: #define PLOT_MED_640_32BIT(offset) \
199: { \
200: esi[offset+0] = STRGBPalette[ecx & 0x000000ff]; \
201: esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
202: esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
203: esi[offset+3] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
204: }
205:
206: /* Plot Medium Resolution(640xH) 32-Bit pixels (Double on Y) */
207: #define PLOT_MED_640_32BIT_DOUBLE_Y(offset) \
208: { \
209: esi[offset+0+Screen4BytesPerLine] = \
210: esi[offset+0] = STRGBPalette[ecx & 0x000000ff]; \
211: esi[offset+1+Screen4BytesPerLine] = \
212: esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
213: esi[offset+2+Screen4BytesPerLine] = \
214: esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
215: esi[offset+3+Screen4BytesPerLine] = \
216: esi[offset+3] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
217: }
218:
219:
220: /* Plot Spectrum512 Resolution (320xH) 32-Bit pixels */
221: #define PLOT_SPEC512_LEFT_LOW_320_32BIT(offset) \
222: { \
223: esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
224: }
225:
226: /* Plot Spectrum512 Resolution (320xH) 32-Bit pixels */
1.1.1.6 root 227: #define PLOT_SPEC512_MID_320_32BIT PLOT_LOW_320_32BIT
1.1.1.3 root 228:
229: /* Plot Spectrum512 Resolution(320xH) 32-Bit pixels */
230: #define PLOT_SPEC512_END_LOW_320_32BIT(offset) \
231: { \
232: esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
233: esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
234: esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
235: }
236:
237:
238: /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels */
239: #define PLOT_SPEC512_LEFT_LOW_640_32BIT(offset) \
240: { \
241: esi[offset] = esi[offset+1] = STRGBPalette[ecx & 0x000000ff]; \
242: }
243:
244: /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels */
245: #define PLOT_SPEC512_MID_640_32BIT PLOT_LOW_640_32BIT
246:
247: /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels */
248: #define PLOT_SPEC512_END_LOW_640_32BIT(offset) \
249: { \
250: esi[offset+0] = esi[offset+1] = STRGBPalette[ecx & 0x000000ff]; \
251: esi[offset+2] = esi[offset+3] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
252: esi[offset+4] = esi[offset+5] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
253: }
254:
255: /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels (Double on Y) */
256: #define PLOT_SPEC512_LEFT_LOW_640_32BIT_DOUBLE_Y(offset) \
257: { \
258: esi[offset+Screen4BytesPerLine] = esi[offset+Screen4BytesPerLine+1] = \
259: esi[offset] = esi[offset+1] = STRGBPalette[ecx & 0x000000ff]; \
260: }
261:
1.1.1.6 root 262: /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels (Double on Y) */
1.1.1.3 root 263: #define PLOT_SPEC512_MID_640_32BIT_DOUBLE_Y PLOT_LOW_640_32BIT_DOUBLE_Y
264:
1.1.1.6 root 265: /* Plot Spectrum512 Resolution (640xH) 32-Bit pixels (Double on Y) */
1.1.1.3 root 266: #define PLOT_SPEC512_END_LOW_640_32BIT_DOUBLE_Y(offset) \
267: { \
268: ebx = STRGBPalette[ecx & 0x000000ff]; \
269: esi[offset+Screen4BytesPerLine] = esi[offset+Screen4BytesPerLine+1] \
270: = esi[offset] = esi[offset+1] = ebx; \
271: ebx = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
272: esi[offset+2+Screen4BytesPerLine] = esi[offset+3+Screen4BytesPerLine] \
273: = esi[offset+2] = esi[offset+3] = ebx; \
274: ebx = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
275: esi[offset+4+Screen4BytesPerLine] = esi[offset+5+Screen4BytesPerLine] \
276: = esi[offset+4] = esi[offset+5] = ebx; \
277: }
278:
279:
1.1.1.6 root 280: /* Plot Spectrum512 Medium Resolution (640xH) 32-Bit pixels */
281: #define PLOT_SPEC512_LEFT_MED_640_32BIT PLOT_SPEC512_LEFT_LOW_320_32BIT
282:
283: #define PLOT_SPEC512_MID_MED_640_32BIT PLOT_SPEC512_MID_320_32BIT
284:
285: #define PLOT_SPEC512_END_MED_640_32BIT PLOT_SPEC512_END_LOW_320_32BIT
286:
287:
288: /* Plot Spectrum512 Medium Resolution (640xH) 32-Bit pixels (Double on Y) */
289: #define PLOT_SPEC512_LEFT_MED_640_32BIT_DOUBLE_Y(offset) \
290: { \
291: esi[offset+Screen4BytesPerLine] = esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
292: }
293:
294: #define PLOT_SPEC512_MID_MED_640_32BIT_DOUBLE_Y(offset) \
295: { \
296: esi[offset+0+Screen4BytesPerLine] = esi[offset+0] = STRGBPalette[ecx & 0x000000ff]; \
297: esi[offset+1+Screen4BytesPerLine] = esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
298: esi[offset+2+Screen4BytesPerLine] = esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
299: esi[offset+3+Screen4BytesPerLine] = esi[offset+3] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
300: }
301:
302: #define PLOT_SPEC512_END_MED_640_32BIT_DOUBLE_Y(offset) \
303: { \
304: esi[offset+0+Screen4BytesPerLine] = esi[offset+0] = STRGBPalette[ecx & 0x000000ff]; \
305: esi[offset+1+Screen4BytesPerLine] = esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
306: esi[offset+2+Screen4BytesPerLine] = esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
307: }
308:
309:
310:
311: /*
312: * 16 bit screen format
313: */
314:
1.1 root 315: /* Plot Low Resolution (320xH) 16-Bit pixels */
316: #define PLOT_LOW_320_16BIT(offset) \
317: { \
318: esi[offset] = (Uint16)STRGBPalette[ecx & 0x00ff]; \
319: esi[offset+1] = (Uint16)STRGBPalette[(ecx >> 8) & 0x00ff]; \
320: esi[offset+2] = (Uint16)STRGBPalette[(ecx >> 16) & 0x00ff]; \
321: esi[offset+3] = (Uint16)STRGBPalette[(ecx >> 24) & 0x00ff]; \
322: }
323:
324: /* Plot Low Resolution (640xH) 16-Bit pixels */
325: #define PLOT_LOW_640_16BIT(offset) \
326: { \
327: esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
328: esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
329: esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
330: esi[offset+3] = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
331: }
332:
333: /* Plot Low Resolution (640xH) 16-Bit pixels (Double on Y) */
334: #define PLOT_LOW_640_16BIT_DOUBLE_Y(offset) \
335: { \
336: ebx = STRGBPalette[ecx & 0x000000ff]; \
1.1.1.3 root 337: esi[offset] = esi[offset+Screen4BytesPerLine] = ebx; \
1.1 root 338: ebx = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
1.1.1.3 root 339: esi[offset+1] = esi[offset+1+Screen4BytesPerLine] = ebx; \
1.1 root 340: ebx = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
1.1.1.3 root 341: esi[offset+2] = esi[offset+2+Screen4BytesPerLine] = ebx; \
1.1 root 342: ebx = STRGBPalette[(ecx >> 24) & 0x000000ff]; \
1.1.1.3 root 343: esi[offset+3] = esi[offset+3+Screen4BytesPerLine] = ebx; \
1.1 root 344: }
345:
346:
347: /* Plot Medium Resolution(640xH) 16-Bit pixels */
348: #define PLOT_MED_640_16BIT(offset) \
349: { \
350: esi[offset] = (Uint16)STRGBPalette[ecx & 0x000000ff]; \
351: esi[offset+1] = (Uint16)STRGBPalette[(ecx >> 8) & 0x000000ff]; \
352: esi[offset+2] = (Uint16)STRGBPalette[(ecx >> 16) & 0x000000ff]; \
353: esi[offset+3] = (Uint16)STRGBPalette[(ecx >> 24) & 0x000000ff]; \
354: }
355:
356: /* Plot Medium Resolution(640xH) 16-Bit pixels (Double on Y) */
357: #define PLOT_MED_640_16BIT_DOUBLE_Y(offset) \
358: { \
1.1.1.3 root 359: esi[offset+Screen2BytesPerLine] =\
1.1 root 360: esi[offset] = (Uint16)STRGBPalette[ecx & 0x000000ff]; \
1.1.1.3 root 361: esi[offset+1+Screen2BytesPerLine] =\
1.1 root 362: esi[offset+1] = (Uint16)STRGBPalette[(ecx >> 8) & 0x000000ff]; \
1.1.1.3 root 363: esi[offset+2+Screen2BytesPerLine] =\
1.1 root 364: esi[offset+2] = (Uint16)STRGBPalette[(ecx >> 16) & 0x000000ff]; \
1.1.1.3 root 365: esi[offset+3+Screen2BytesPerLine] =\
1.1 root 366: esi[offset+3] = (Uint16)STRGBPalette[(ecx >> 24) & 0x000000ff]; \
367: }
368:
369:
370: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
371: #define PLOT_SPEC512_LEFT_LOW_320_16BIT(offset) \
372: { \
373: esi[offset] = (Uint16)STRGBPalette[ecx & 0x000000ff]; \
374: }
375:
376: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
1.1.1.6 root 377: #define PLOT_SPEC512_MID_320_16BIT PLOT_LOW_640_16BIT
1.1 root 378:
379: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
380: #define PLOT_SPEC512_END_LOW_320_16BIT(offset) \
381: { \
382: esi[offset] = (Uint16)STRGBPalette[ecx & 0x000000ff]; \
383: esi[offset+1] = (Uint16)STRGBPalette[(ecx >> 8) & 0x000000ff]; \
384: esi[offset+2] = (Uint16)STRGBPalette[(ecx >> 16) & 0x000000ff]; \
385: }
386:
387:
388: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
389: #define PLOT_SPEC512_LEFT_LOW_640_16BIT(offset) \
390: { \
391: esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
392: }
393:
394: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
395: #define PLOT_SPEC512_MID_640_16BIT PLOT_LOW_640_16BIT
396:
397: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
398: #define PLOT_SPEC512_END_LOW_640_16BIT(offset) \
399: { \
400: esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
401: esi[offset+1] = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
402: esi[offset+2] = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
403: }
404:
405: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
406: #define PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(offset) \
407: { \
1.1.1.3 root 408: esi[offset+Screen4BytesPerLine] = \
1.1 root 409: esi[offset] = STRGBPalette[ecx & 0x000000ff]; \
410: }
411:
412: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
413: #define PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y PLOT_LOW_640_16BIT_DOUBLE_Y
414:
415: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
416: #define PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(offset) \
417: { \
418: ebx = STRGBPalette[ecx & 0x000000ff]; \
1.1.1.3 root 419: esi[offset] = esi[offset+Screen4BytesPerLine] = ebx; \
1.1 root 420: ebx = STRGBPalette[(ecx >> 8) & 0x000000ff]; \
1.1.1.3 root 421: esi[offset+1] = esi[offset+1+Screen4BytesPerLine] = ebx; \
1.1 root 422: ebx = STRGBPalette[(ecx >> 16) & 0x000000ff]; \
1.1.1.3 root 423: esi[offset+2] = esi[offset+2+Screen4BytesPerLine] = ebx; \
1.1 root 424: }
425:
1.1.1.6 root 426:
427: /* Plot Spectrum512 Medium Resolution (640xH) 16-Bit pixels */
428: #define PLOT_SPEC512_LEFT_MED_640_16BIT PLOT_SPEC512_LEFT_LOW_320_16BIT
429:
430: #define PLOT_SPEC512_MID_MED_640_16BIT PLOT_SPEC512_MID_320_16BIT
431:
432: #define PLOT_SPEC512_END_MED_640_16BIT PLOT_SPEC512_END_LOW_320_16BIT
433:
434:
435: /* Plot Spectrum512 Medium Resolution (640xH) 16-Bit pixels (Double on Y) */
436: #define PLOT_SPEC512_LEFT_MED_640_16BIT_DOUBLE_Y PLOT_SPEC512_LEFT_MED_640_32BIT_DOUBLE_Y
437:
438: #define PLOT_SPEC512_MID_MED_640_16BIT_DOUBLE_Y PLOT_SPEC512_MID_MED_640_32BIT_DOUBLE_Y
439:
440: #define PLOT_SPEC512_END_MED_640_16BIT_DOUBLE_Y PLOT_SPEC512_END_MED_640_32BIT_DOUBLE_Y
441:
442:
443:
1.1.1.4 root 444: /* Get Spec512 pixels which are offset by 1 pixel */
445: #if defined(__i386__) // Unaligned direct access is only supported on i86 platforms
446:
1.1.1.5 root 447: /* on AMD XP, first one is 1/3 faster than aligned access, and
448: * final pixels access ~15% faster than aligned operation below
449: */
1.1.1.4 root 450: # define GET_SPEC512_OFFSET_PIXELS(pixels, x) \
451: (*(Uint32 *)(((Uint8 *)pixels) + x))
452: # define GET_SPEC512_OFFSET_FINAL_PIXELS(pixels) \
453: (*(Uint32 *)(((Uint8 *)pixels) + 13))
454:
455: #else
456:
457: # define GET_SPEC512_OFFSET_PIXELS(pixels, x) \
458: (((*(Uint32 *)(((Uint8 *)pixels) + x-1)) >> 8) \
459: | ((*(Uint32 *)(((Uint8 *)pixels) + x+3)) << 24))
460: # define GET_SPEC512_OFFSET_FINAL_PIXELS(pixels) \
461: ((*(Uint32 *)(((Uint8 *)pixels) + 12)) >> 8)
462:
463: #endif /* __i386__ */
464:
465:
1.1 root 466: #endif /* HATARI_CONVERTMACROS_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.