|
|
1.1.1.2 root 1: /*
2: Hatari - spec640x18.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 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.2 root 13: Uint32 *edi, *ebp;
14: Uint32 *esi;
1.1.1.3 ! root 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;
1.1.1.2 root 18:
19: Spec512_StartFrame(); /* Start frame, track palettes */
20:
21: edx = 0; /* Clear index for loop */
22:
1.1.1.3 ! root 23: for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++) {
1.1.1.2 root 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 */
1.1.1.3 ! root 29: eax = STScreenLineOffset[y] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */
1.1.1.2 root 30: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colours */
31: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */
32: esi = (Uint32 *)pPCScreenDest; /* PC format screen */
33:
1.1.1.3 ! root 34: x = STScreenWidthBytes>>3; /* Amount to draw across in 16-pixels (8 bytes) */
1.1.1.2 root 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:
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] */
1.1.1.3 ! root 45: pixelspace[1] = ecx;
1.1.1.2 root 46: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
1.1.1.3 ! root 47: pixelspace[3] = ecx;
1.1.1.2 root 48: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
1.1.1.3 ! root 49: pixelspace[0] = ecx;
1.1.1.2 root 50: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
1.1.1.3 ! root 51: pixelspace[2] = ecx;
1.1.1.2 root 52:
53: /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */
54: /* So, we plot 1_4_4_3 to give 16 pixels, changing palette between */
55: /* (last one is used for first of next 16-pixels) */
56: if(!bScrDoubleY) /* Double on Y? */
57: {
1.1.1.3 ! root 58: ecx = pixelspace[0];
1.1.1.2 root 59: PLOT_SPEC512_LEFT_LOW_640_16BIT(0) ;
60: Spec512_UpdatePaletteSpan();
61:
1.1.1.3 ! root 62: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+1 );
1.1.1.2 root 63: PLOT_SPEC512_MID_640_16BIT(1) ;
64: Spec512_UpdatePaletteSpan();
65:
1.1.1.3 ! root 66: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+5 );
1.1.1.2 root 67: PLOT_SPEC512_MID_640_16BIT(5) ;
68: Spec512_UpdatePaletteSpan();
69:
1.1.1.3 ! root 70: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+9 );
1.1.1.2 root 71: PLOT_SPEC512_MID_640_16BIT(9) ;
72: Spec512_UpdatePaletteSpan();
73:
1.1.1.3 ! root 74: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+13 );
1.1.1.2 root 75: PLOT_SPEC512_END_LOW_640_16BIT(13) ;
76: }
77: else
78: {
1.1.1.3 ! root 79: ecx = pixelspace[0];
1.1.1.2 root 80: PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(0) ;
81: Spec512_UpdatePaletteSpan();
82:
1.1.1.3 ! root 83: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+1 );
1.1.1.2 root 84: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(1) ;
85: Spec512_UpdatePaletteSpan();
86:
1.1.1.3 ! root 87: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+5 );
1.1.1.2 root 88: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(5) ;
89: Spec512_UpdatePaletteSpan();
90:
1.1.1.3 ! root 91: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+9 );
1.1.1.2 root 92: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(9) ;
93: Spec512_UpdatePaletteSpan();
94:
1.1.1.3 ! root 95: ecx = *(Uint32 *)( ((Uint8 *)pixelspace)+13 );
1.1.1.2 root 96: PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(13) ;
97: }
98:
99: #else
100: /* Well, I didn't get the code above working on big-endian machines, too,
101: But I hope the following lines are good enough to do the job... */
102:
103: LOW_BUILD_PIXELS_0 ;
1.1.1.3 ! root 104: pixelspace[3] = ecx;
1.1.1.2 root 105: LOW_BUILD_PIXELS_1 ;
1.1.1.3 ! root 106: pixelspace[1] = ecx;
1.1.1.2 root 107: LOW_BUILD_PIXELS_2 ;
1.1.1.3 ! root 108: pixelspace[2] = ecx;
1.1.1.2 root 109: LOW_BUILD_PIXELS_3 ;
1.1.1.3 ! root 110: pixelspace[0] = ecx;
1.1.1.2 root 111:
112: if(!bScrDoubleY) /* Double on Y? */
113: {
1.1.1.3 ! root 114: ecx = pixelspace[0];
1.1.1.2 root 115: PLOT_SPEC512_MID_640_16BIT(0) ;
116: Spec512_UpdatePaletteSpan();
117:
1.1.1.3 ! root 118: ecx = pixelspace[1];
1.1.1.2 root 119: PLOT_SPEC512_MID_640_16BIT(4) ;
120: Spec512_UpdatePaletteSpan();
121:
1.1.1.3 ! root 122: ecx = pixelspace[2];
1.1.1.2 root 123: PLOT_SPEC512_MID_640_16BIT(8) ;
124: Spec512_UpdatePaletteSpan();
125:
1.1.1.3 ! root 126: ecx = pixelspace[3];
1.1.1.2 root 127: PLOT_SPEC512_MID_640_16BIT(12) ;
128: Spec512_UpdatePaletteSpan();
129: }
130: else
131: {
1.1.1.3 ! root 132: ecx = pixelspace[0];
1.1.1.2 root 133: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(0) ;
134: Spec512_UpdatePaletteSpan();
135:
1.1.1.3 ! root 136: ecx = pixelspace[1];
1.1.1.2 root 137: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(4) ;
138: Spec512_UpdatePaletteSpan();
139:
1.1.1.3 ! root 140: ecx = pixelspace[2];
1.1.1.2 root 141: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(8) ;
142: Spec512_UpdatePaletteSpan();
143:
1.1.1.3 ! root 144: ecx = pixelspace[3];
1.1.1.2 root 145: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(12) ;
146: Spec512_UpdatePaletteSpan();
147: }
148:
149: #endif
150:
151: esi += 16; /* Next PC pixels */
152: edi += 2; /* Next ST pixels */
153: ebp += 2; /* Next ST copy pixels */
154: }
1.1.1.3 ! root 155: while(--x); /* Loop on X */
1.1.1.2 root 156:
157: Spec512_EndScanLine();
158:
159: /* Offset to next line: */
160: pPCScreenDest = (void *)(((unsigned char *)pPCScreenDest)+2*PCScreenBytesPerLine);
1.1 root 161: }
162:
1.1.1.2 root 163: bScreenContentsChanged = TRUE;
1.1 root 164: }
165:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.