|
|
1.1 root 1: /*
2: Hatari - med640x32_spec.c
3:
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, Medium Res Spec512 to 640x32Bit
8: */
9:
10: static void ConvertMediumRes_640x32Bit_Spec(void)
11: {
12: Uint32 *edi, *ebp;
13: Uint32 *esi;
14: Uint32 eax;
15: int y;
16:
17: Spec512_StartFrame(); /* Start frame, track palettes */
18:
19: for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++)
20: {
21: eax = STScreenLineOffset[y] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */
22: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colors */
23: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */
24: esi = (Uint32 *)pPCScreenDest; /* PC format screen */
25:
26: if (HBLPaletteMasks[y] & 0x00030000) /* Test resolution */
27: Line_ConvertMediumRes_640x32Bit_Spec(edi, ebp, esi, eax); /* med res line */
28: else
29: Line_ConvertLowRes_640x32Bit_Spec(edi, ebp, esi, eax); /* low res line (double on X) */
30:
31: /* Offset to next line (double on Y) */
32: pPCScreenDest = (((Uint8 *)pPCScreenDest) + PCScreenBytesPerLine * 2);
33: }
34:
35: bScreenContentsChanged = true;
36: }
37:
38:
39: static void Line_ConvertMediumRes_640x32Bit_Spec(Uint32 *edi, Uint32 *ebp, Uint32 *esi, Uint32 eax)
40: {
1.1.1.2 ! root 41: Uint32 ebx, ecx;
1.1 root 42: int x, Screen4BytesPerLine;
43: Uint32 pixelspace[5]; /* Workspace to store pixels to so can print in right order for Spec512 */
44:
45: /* on x86, unaligned access macro touches also
46: * next byte, zero it for code checkers
47: */
48: pixelspace[4] = 0;
49:
50: Spec512_StartScanLine(); /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */
51:
52: x = STScreenWidthBytes >> 2; /* Amount to draw across in 16-pixels (4 bytes) */
53: Screen4BytesPerLine = PCScreenBytesPerLine/4;
54:
55: do /* x-loop */
56: {
57: /* Do 16 pixels at one time */
58: ebx = *edi;
59:
60:
61: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
62: /* Plot in 'right-order' on big endian systems */
63: MED_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [12,13,14,15] */
64: pixelspace[3] = ecx;
65: MED_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [4,5,6,7] */
66: pixelspace[1] = ecx;
67: MED_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [8,9,10,11] */
68: pixelspace[2] = ecx;
69: MED_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [0,1,2,3] */
70: pixelspace[0] = ecx;
71: #else
72: /* Plot in 'wrong-order', as ebx is 68000 endian */
73: MED_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
74: pixelspace[1] = ecx;
75: MED_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
76: pixelspace[3] = ecx;
77: MED_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
78: pixelspace[0] = ecx;
79: MED_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
80: pixelspace[2] = ecx;
81: #endif
82: /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */
83: /* So, we plot 1_4_4_4_3 to give 16 pixels, changing palette between */
84: /* (last one is used for first of next 16-pixels) */
85: /* NOTE : In med res, we display 16 pixels in 8 cycles, so palette should be */
86: /* updated every 8 pixels, not every 4 pixels (as in low res) */
87: ecx = pixelspace[0];
88: if (!bScrDoubleY) { PLOT_SPEC512_LEFT_MED_640_32BIT(0); }
89: else { PLOT_SPEC512_LEFT_MED_640_32BIT_DOUBLE_Y(0); }
90: // Spec512_UpdatePaletteSpan();
91:
92: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1);
93: if (!bScrDoubleY) { PLOT_SPEC512_MID_MED_640_32BIT(1); }
94: else { PLOT_SPEC512_MID_MED_640_32BIT_DOUBLE_Y(1); }
95: Spec512_UpdatePaletteSpan();
96:
97: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5);
98: if (!bScrDoubleY) { PLOT_SPEC512_MID_MED_640_32BIT(5); }
99: else { PLOT_SPEC512_MID_MED_640_32BIT_DOUBLE_Y(5); }
100: // Spec512_UpdatePaletteSpan();
101:
102: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9);
103: if (!bScrDoubleY) { PLOT_SPEC512_MID_MED_640_32BIT(9); }
104: else { PLOT_SPEC512_MID_MED_640_32BIT_DOUBLE_Y(9); }
105: Spec512_UpdatePaletteSpan();
106:
107: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace);
108: if (!bScrDoubleY) { PLOT_SPEC512_END_MED_640_32BIT(13); }
109: else { PLOT_SPEC512_END_MED_640_32BIT_DOUBLE_Y(13); }
110:
111: esi += 16; /* Next PC pixels */
112: edi += 1; /* Next ST pixels */
113: ebp += 1; /* Next ST copy pixels */
114: }
115: while (--x); /* Loop on X */
116:
117: Spec512_EndScanLine();
118: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.