|
|
1.1 ! root 1: /* ! 2: Hatari - low640x16_spec.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, Low Res Spec512 to 640x16Bit ! 8: */ ! 9: ! 10: static void ConvertLowRes_640x16Bit_Spec(void) ! 11: { ! 12: Uint32 *edi, *ebp; ! 13: Uint32 *esi; ! 14: Uint32 eax; ! 15: int y; ! 16: ! 17: Spec512_StartFrame(); /* Start frame, track palettes */ ! 18: ! 19: for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++) ! 20: { ! 21: eax = STScreenLineOffset[y] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */ ! 22: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colors */ ! 23: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */ ! 24: esi = (Uint32 *)pPCScreenDest; /* PC format screen */ ! 25: ! 26: Line_ConvertLowRes_640x16Bit_Spec(edi, ebp, esi, eax); ! 27: ! 28: /* Offset to next line (double on Y) */ ! 29: pPCScreenDest = (((Uint8 *)pPCScreenDest) + PCScreenBytesPerLine * 2); ! 30: } ! 31: ! 32: bScreenContentsChanged = true; ! 33: } ! 34: ! 35: ! 36: static void Line_ConvertLowRes_640x16Bit_Spec(Uint32 *edi, Uint32 *ebp, Uint32 *esi, Uint32 eax) ! 37: { ! 38: Uint32 ebx, ecx, edx; ! 39: int x, Screen4BytesPerLine; ! 40: Uint32 pixelspace[5]; /* Workspace to store pixels to so can print in right order for Spec512 */ ! 41: ! 42: /* on x86, unaligned access macro touches also ! 43: * next byte, zero it for code checkers ! 44: */ ! 45: pixelspace[4] = 0; ! 46: ! 47: Spec512_StartScanLine(); /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */ ! 48: edx = 0; /* Clear index for loop */ ! 49: ! 50: x = STScreenWidthBytes >> 3; /* Amount to draw across in 16-pixels (8 bytes) */ ! 51: Screen4BytesPerLine = PCScreenBytesPerLine/4; ! 52: ! 53: do /* x-loop */ ! 54: { ! 55: ebx = *edi; /* Do 16 pixels at one time */ ! 56: ecx = *(edi+1); ! 57: ! 58: #if SDL_BYTEORDER == SDL_BIG_ENDIAN ! 59: /* Convert planes to byte indices - as works in wrong order store to workspace so can read back in order! */ ! 60: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 61: pixelspace[3] = ecx; ! 62: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 63: pixelspace[1] = ecx; ! 64: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 65: pixelspace[2] = ecx; ! 66: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 67: pixelspace[0] = ecx; ! 68: #else ! 69: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 70: pixelspace[1] = ecx; ! 71: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 72: pixelspace[3] = ecx; ! 73: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 74: pixelspace[0] = ecx; ! 75: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 76: pixelspace[2] = ecx; ! 77: #endif ! 78: /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */ ! 79: /* So, we plot 1_4_4_4_3 to give 16 pixels, changing palette between */ ! 80: /* (last one is used for first of next 16-pixels) */ ! 81: if (!bScrDoubleY) /* Double on Y? */ ! 82: { ! 83: ecx = pixelspace[0]; ! 84: PLOT_SPEC512_LEFT_LOW_640_16BIT(0); ! 85: Spec512_UpdatePaletteSpan(); ! 86: ! 87: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1); ! 88: PLOT_SPEC512_MID_640_16BIT(1); ! 89: Spec512_UpdatePaletteSpan(); ! 90: ! 91: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5); ! 92: PLOT_SPEC512_MID_640_16BIT(5); ! 93: Spec512_UpdatePaletteSpan(); ! 94: ! 95: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9); ! 96: PLOT_SPEC512_MID_640_16BIT(9); ! 97: Spec512_UpdatePaletteSpan(); ! 98: ! 99: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace); ! 100: PLOT_SPEC512_END_LOW_640_16BIT(13); ! 101: } ! 102: else ! 103: { ! 104: ecx = pixelspace[0]; ! 105: PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(0); ! 106: Spec512_UpdatePaletteSpan(); ! 107: ! 108: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1); ! 109: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(1); ! 110: Spec512_UpdatePaletteSpan(); ! 111: ! 112: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5); ! 113: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(5); ! 114: Spec512_UpdatePaletteSpan(); ! 115: ! 116: ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9); ! 117: PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(9); ! 118: Spec512_UpdatePaletteSpan(); ! 119: ! 120: ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace); ! 121: PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(13); ! 122: } ! 123: ! 124: esi += 16; /* Next PC pixels */ ! 125: edi += 2; /* Next ST pixels */ ! 126: ebp += 2; /* Next ST copy pixels */ ! 127: } ! 128: while (--x); /* Loop on X */ ! 129: ! 130: Spec512_EndScanLine(); ! 131: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.