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