|
|
1.1.1.7 root 1: /*
2: Hatari - spec320x16.c
1.1 root 3:
1.1.1.7 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.
1.1.1.2 root 6:
1.1.1.7 root 7: Screen Conversion, Spec512 to 320x16Bit
8: */
1.1 root 9:
1.1.1.7 root 10: static void ConvertSpec512_320x16Bit(void)
11: {
12: Uint32 *edi, *ebp;
13: Uint16 *esi;
14: Uint32 eax, ebx, ecx, edx;
1.1.1.10! root 15: Uint32 pixelspace[5]; /* Workspace to store pixels to so can print in right order for Spec512 */
1.1.1.7 root 16: int y, x;
17:
1.1.1.10! root 18: /* on x86, unaligned access macro touches also
! 19: * next byte, zero it for code checkers
! 20: */
! 21: pixelspace[4] = 0;
! 22:
1.1.1.7 root 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);
1.1 root 45:
1.1.1.4 root 46: #if SDL_BYTEORDER == SDL_LIL_ENDIAN
1.1.1.7 root 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 [4,5,6,7] */
49: pixelspace[1] = ecx;
50: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
51: pixelspace[3] = ecx;
52: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
53: pixelspace[0] = ecx;
54: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
55: pixelspace[2] = ecx;
1.1.1.4 root 56: #else
1.1.1.7 root 57: LOW_BUILD_PIXELS_0 ;
58: pixelspace[3] = ecx;
59: LOW_BUILD_PIXELS_1 ;
60: pixelspace[1] = ecx;
61: LOW_BUILD_PIXELS_2 ;
62: pixelspace[2] = ecx;
63: LOW_BUILD_PIXELS_3 ;
64: pixelspace[0] = ecx;
1.1.1.8 root 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_3 to give 16 pixels, changing palette between */
68: /* (last one is used for first of next 16-pixels) */
1.1.1.7 root 69: ecx = pixelspace[0];
70: PLOT_SPEC512_LEFT_LOW_320_16BIT(0);
71: Spec512_UpdatePaletteSpan();
72:
1.1.1.8 root 73: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1);
1.1.1.7 root 74: PLOT_SPEC512_MID_320_16BIT(1);
75: Spec512_UpdatePaletteSpan();
76:
1.1.1.8 root 77: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5);
1.1.1.7 root 78: PLOT_SPEC512_MID_320_16BIT(5);
79: Spec512_UpdatePaletteSpan();
80:
1.1.1.8 root 81: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9);
1.1.1.7 root 82: PLOT_SPEC512_MID_320_16BIT(9);
83: Spec512_UpdatePaletteSpan();
84:
1.1.1.8 root 85: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace);
1.1.1.7 root 86: PLOT_SPEC512_END_LOW_320_16BIT(13);
1.1.1.4 root 87:
1.1.1.7 root 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: }
1.1.1.2 root 99:
1.1.1.9 root 100: bScreenContentsChanged = true;
1.1 root 101: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.