|
|
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: ! 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] */ ! 45: pixelspace[1] = ecx; ! 46: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 47: pixelspace[3] = ecx; ! 48: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 49: pixelspace[0] = ecx; ! 50: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 51: pixelspace[2] = ecx; ! 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: ecx = pixelspace[0]; ! 57: PLOT_SPEC512_LEFT_LOW_320_32BIT(0) ; ! 58: Spec512_UpdatePaletteSpan(); ! 59: ! 60: ecx = *(Uint32 *)(((Uint8 *)pixelspace) + 1); ! 61: PLOT_SPEC512_MID_320_32BIT(1) ; ! 62: Spec512_UpdatePaletteSpan(); ! 63: ! 64: ecx = *(Uint32 *)(((Uint8 *)pixelspace) + 5); ! 65: PLOT_SPEC512_MID_320_32BIT(5) ; ! 66: Spec512_UpdatePaletteSpan(); ! 67: ! 68: ecx = *(Uint32 *)(((Uint8 *)pixelspace) + 9); ! 69: PLOT_SPEC512_MID_320_32BIT(9) ; ! 70: Spec512_UpdatePaletteSpan(); ! 71: ! 72: ecx = *(Uint32 *)(((Uint8 *)pixelspace) + 13); ! 73: PLOT_SPEC512_END_LOW_320_32BIT(13) ; ! 74: ! 75: #else ! 76: ! 77: LOW_BUILD_PIXELS_0 ; ! 78: pixelspace[3] = ecx; ! 79: LOW_BUILD_PIXELS_1 ; ! 80: pixelspace[1] = ecx; ! 81: LOW_BUILD_PIXELS_2 ; ! 82: pixelspace[2] = ecx; ! 83: LOW_BUILD_PIXELS_3 ; ! 84: pixelspace[0] = ecx; ! 85: ! 86: ecx = pixelspace[0]; ! 87: PLOT_SPEC512_LEFT_LOW_320_32BIT(0); ! 88: Spec512_UpdatePaletteSpan(); ! 89: ! 90: ecx = (pixelspace[0] >> 8) | (((Uint8)pixelspace[1])<<24); ! 91: PLOT_SPEC512_MID_320_32BIT(1); ! 92: Spec512_UpdatePaletteSpan(); ! 93: ! 94: ecx = (pixelspace[1] >> 8) | (((Uint8)pixelspace[2])<<24); ! 95: PLOT_SPEC512_MID_320_32BIT(5); ! 96: Spec512_UpdatePaletteSpan(); ! 97: ! 98: ecx = (pixelspace[2] >> 8) | (((Uint8)pixelspace[3])<<24); ! 99: PLOT_SPEC512_MID_320_32BIT(9); ! 100: Spec512_UpdatePaletteSpan(); ! 101: ! 102: ecx = (pixelspace[3] >> 8); ! 103: PLOT_SPEC512_END_LOW_320_32BIT(13); ! 104: ! 105: #endif ! 106: ! 107: esi += 16; /* Next PC pixels */ ! 108: edi += 2; /* Next ST pixels */ ! 109: ebp += 2; /* Next ST copy pixels */ ! 110: } ! 111: while (--x); /* Loop on X */ ! 112: ! 113: Spec512_EndScanLine(); ! 114: ! 115: /* Offset to next line */ ! 116: pPCScreenDest = (((Uint8 *)pPCScreenDest) + PCScreenBytesPerLine); ! 117: } ! 118: ! 119: bScreenContentsChanged = TRUE; ! 120: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.