|
|
1.1 root 1: /*
2: Hatari - low320x16_spec.c
3:
1.1.1.2 ! root 4: This file is distributed under the GNU General Public License, version 2
! 5: or at your option any later version. Read the file gpl.txt for details.
1.1 root 6:
7: Screen Conversion, Low Res Spec512 to 320x16Bit
8: */
9:
10: static void ConvertLowRes_320x16Bit_Spec(void)
11: {
12: Uint32 *edi, *ebp;
13: Uint16 *esi;
14: Uint32 eax, ebx, ecx, edx;
15: Uint32 pixelspace[5]; /* Workspace to store pixels to so can print in right order for Spec512 */
16: int y, x;
17:
18: /* on x86, unaligned access macro touches also
19: * next byte, zero it for code checkers
20: */
21: pixelspace[4] = 0;
22:
23: Spec512_StartFrame(); /* Start frame, track palettes */
24:
25: edx = 0; /* Clear index for loop */
26:
27: for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++)
28: {
29:
30: Spec512_StartScanLine(); /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */
31: edx = 0; /* Clear index for loop */
32:
33: /* Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen */
34: eax = STScreenLineOffset[y] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */
35: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colors */
36: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */
37: esi = (Uint16 *)pPCScreenDest; /* PC format screen */
38:
39: x = STScreenWidthBytes >> 3; /* Amount to draw across in 16-pixels (8 bytes) */
40:
41: do /* x-loop */
42: {
43: ebx = *edi; /* Do 16 pixels at one time */
44: ecx = *(edi+1);
45:
46: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
47: /* Convert planes to byte indices - as works in wrong order store to workspace so can read back in order! */
48: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [12,13,14,15] */
49: pixelspace[3] = ecx;
50: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [4,5,6,7] */
51: pixelspace[1] = ecx;
52: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [8,9,10,11] */
53: pixelspace[2] = ecx;
54: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [0,1,2,3] */
55: pixelspace[0] = ecx;
56: #else
57: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
58: pixelspace[1] = ecx;
59: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
60: pixelspace[3] = ecx;
61: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
62: pixelspace[0] = ecx;
63: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
64: pixelspace[2] = ecx;
65: #endif
66: /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */
67: /* So, we plot 1_4_4_4_3 to give 16 pixels, changing palette between */
68: /* (last one is used for first of next 16-pixels) */
69: ecx = pixelspace[0];
70: PLOT_SPEC512_LEFT_LOW_320_16BIT(0);
71: Spec512_UpdatePaletteSpan();
72:
73: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1);
74: PLOT_SPEC512_MID_320_16BIT(1);
75: Spec512_UpdatePaletteSpan();
76:
77: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5);
78: PLOT_SPEC512_MID_320_16BIT(5);
79: Spec512_UpdatePaletteSpan();
80:
81: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9);
82: PLOT_SPEC512_MID_320_16BIT(9);
83: Spec512_UpdatePaletteSpan();
84:
85: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace);
86: PLOT_SPEC512_END_LOW_320_16BIT(13);
87:
88: esi += 16; /* Next PC pixels */
89: edi += 2; /* Next ST pixels */
90: ebp += 2; /* Next ST copy pixels */
91: }
92: while (--x); /* Loop on X */
93:
94: Spec512_EndScanLine();
95:
96: /* Offset to next line */
97: pPCScreenDest = (((Uint8 *)pPCScreenDest) + PCScreenBytesPerLine);
98: }
99:
100: bScreenContentsChanged = true;
101: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.