|
|
1.1.1.2 root 1: /*
1.1.1.5 root 2: Hatari - spec640x16.c
3:
1.1.1.2 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, Spec512 to 640x16Bit
8: */
1.1 root 9:
10:
1.1.1.3 root 11: static void ConvertSpec512_640x16Bit(void)
1.1 root 12: {
1.1.1.5 root 13: Uint32 *edi, *ebp;
14: Uint32 *esi;
15: Uint32 eax, ebx, ecx, edx;
16: Uint32 pixelspace[4]; /* Workspace to store pixels to so can print in right order for Spec512 */
17: int y, x, Screen4BytesPerLine;
18:
19: Spec512_StartFrame(); /* Start frame, track palettes */
20: Screen4BytesPerLine = PCScreenBytesPerLine / 4;
21: edx = 0; /* Clear index for loop */
22:
23: for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++)
24: {
25:
26: Spec512_StartScanLine(); /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */
27: edx = 0; /* Clear index for loop */
28:
29: /* Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen */
30: eax = STScreenLineOffset[y] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */
31: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colors */
32: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */
33: esi = (Uint32 *)pPCScreenDest; /* PC format screen */
34:
35: x = STScreenWidthBytes >> 3; /* Amount to draw across in 16-pixels (8 bytes) */
36:
37: do /* x-loop */
38: {
39: ebx = *edi; /* Do 16 pixels at one time */
40: ecx = *(edi+1);
1.1.1.2 root 41:
42: #if SDL_BYTEORDER == SDL_LIL_ENDIAN
1.1.1.5 root 43: /* Convert planes to byte indices - as works in wrong order store to workspace so can read back in order! */
44: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
45: pixelspace[1] = ecx;
46: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
47: pixelspace[3] = ecx;
48: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
49: pixelspace[0] = ecx;
50: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
51: pixelspace[2] = ecx;
1.1.1.2 root 52: #else
1.1.1.5 root 53: LOW_BUILD_PIXELS_0 ;
54: pixelspace[3] = ecx;
55: LOW_BUILD_PIXELS_1 ;
56: pixelspace[1] = ecx;
57: LOW_BUILD_PIXELS_2 ;
58: pixelspace[2] = ecx;
59: LOW_BUILD_PIXELS_3 ;
60: pixelspace[0] = ecx;
1.1.1.6 root 61: #endif
62: /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */
63: /* So, we plot 1_4_4_3 to give 16 pixels, changing palette between */
64: /* (last one is used for first of next 16-pixels) */
1.1.1.5 root 65: if (!bScrDoubleY) /* Double on Y? */
66: {
67: ecx = pixelspace[0];
68: PLOT_SPEC512_LEFT_LOW_640_16BIT(0);
69: Spec512_UpdatePaletteSpan();
70:
1.1.1.6 root 71: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1);
1.1.1.5 root 72: PLOT_SPEC512_MID_640_16BIT(1);
73: Spec512_UpdatePaletteSpan();
74:
1.1.1.6 root 75: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5);
1.1.1.5 root 76: PLOT_SPEC512_MID_640_16BIT(5);
77: Spec512_UpdatePaletteSpan();
78:
1.1.1.6 root 79: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9);
1.1.1.5 root 80: PLOT_SPEC512_MID_640_16BIT(9);
81: Spec512_UpdatePaletteSpan();
82:
1.1.1.6 root 83: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace);
1.1.1.5 root 84: PLOT_SPEC512_END_LOW_640_16BIT(13);
85: }
86: else
87: {
88: ecx = pixelspace[0];
89: PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(0);
90: Spec512_UpdatePaletteSpan();
91:
1.1.1.6 root 92: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1);
1.1.1.5 root 93: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(1);
94: Spec512_UpdatePaletteSpan();
95:
1.1.1.6 root 96: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5);
1.1.1.5 root 97: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(5);
98: Spec512_UpdatePaletteSpan();
99:
1.1.1.6 root 100: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9);
1.1.1.5 root 101: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(9);
102: Spec512_UpdatePaletteSpan();
103:
1.1.1.6 root 104: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace);
1.1.1.5 root 105: PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(13);
106: }
1.1.1.2 root 107:
1.1.1.5 root 108: esi += 16; /* Next PC pixels */
109: edi += 2; /* Next ST pixels */
110: ebp += 2; /* Next ST copy pixels */
111: }
112: while (--x); /* Loop on X */
113:
114: Spec512_EndScanLine();
115:
116: /* Offset to next line: */
117: pPCScreenDest = (((Uint8 *)pPCScreenDest)+2*PCScreenBytesPerLine);
118: }
1.1 root 119:
1.1.1.7 ! root 120: bScreenContentsChanged = true;
1.1 root 121: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.