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