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