|
|
1.1.1.2 root 1: /*
2: Hatari - low640x8.c
1.1.1.5 ! root 3:
1.1.1.2 root 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.
1.1 root 6:
1.1.1.2 root 7: Screen conversion function, Low Res to 640x8Bit
8: */
1.1 root 9:
1.1.1.3 root 10: static void Line_ConvertLowRes_640x8Bit(Uint32 *edi, Uint32 *ebp, Uint32 *esi, Uint32 eax)
1.1 root 11: {
1.1.1.5 ! root 12: Uint32 edx;
! 13: Uint32 ebx, ecx, ebpp;
! 14: int x, update, Screen4BytesPerLine;
! 15:
! 16: x = STScreenWidthBytes>>3; /* Amount to draw across in 16-pixels (8 bytes) */
! 17: Screen4BytesPerLine = PCScreenBytesPerLine/4;
! 18: update = ScrUpdateFlag & PALETTEMASK_UPDATEMASK;
! 19:
! 20: do /* x-loop */
! 21: {
! 22: /* Do 16 pixels at one time */
! 23: ebx = *edi;
! 24: ecx = *(edi+1);
! 25:
! 26: if (update || ebx!=*ebp || ecx!=*(ebp+1)) /* Does differ? */
! 27: {
! 28: /* copy word */
1.1.1.2 root 29:
1.1.1.5 ! root 30: bScreenContentsChanged = TRUE;
1.1.1.2 root 31:
32: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
1.1.1.5 ! root 33: /* Plot in 'right-order' on big endian systems */
! 34: if (!bScrDoubleY) /* Double on Y? */
! 35: {
! 36: /* Plot pixels */
! 37: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
! 38: PLOT_LOW_640_8BIT(6) ;
! 39: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
! 40: PLOT_LOW_640_8BIT(2) ;
! 41: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
! 42: PLOT_LOW_640_8BIT(4) ;
! 43: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
! 44: PLOT_LOW_640_8BIT(0) ;
! 45: }
! 46: else
! 47: {
! 48: /* Plot pixels */
! 49: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
! 50: PLOT_LOW_640_8BIT_DOUBLE_Y(6) ;
! 51: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
! 52: PLOT_LOW_640_8BIT_DOUBLE_Y(2) ;
! 53: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
! 54: PLOT_LOW_640_8BIT_DOUBLE_Y(4) ;
! 55: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
! 56: PLOT_LOW_640_8BIT_DOUBLE_Y(0)
! 57: }
1.1.1.2 root 58: #else
1.1.1.5 ! root 59: /* Plot in 'wrong-order', as ebx is 68000 endian */
! 60: if (!bScrDoubleY) /* Double on Y? */
! 61: {
! 62: /* Plot pixels */
! 63: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
! 64: PLOT_LOW_640_8BIT(2) ;
! 65: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
! 66: PLOT_LOW_640_8BIT(6) ;
! 67: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
! 68: PLOT_LOW_640_8BIT(0) ;
! 69: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
! 70: PLOT_LOW_640_8BIT(4) ;
! 71: }
! 72: else
! 73: {
! 74: /* Plot pixels */
! 75: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */
! 76: PLOT_LOW_640_8BIT_DOUBLE_Y(2) ;
! 77: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */
! 78: PLOT_LOW_640_8BIT_DOUBLE_Y(6) ;
! 79: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */
! 80: PLOT_LOW_640_8BIT_DOUBLE_Y(0) ;
! 81: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */
! 82: PLOT_LOW_640_8BIT_DOUBLE_Y(4)
! 83: }
1.1.1.2 root 84: #endif
85:
1.1.1.5 ! root 86: }
1.1.1.2 root 87:
1.1.1.5 ! root 88: esi += 8; /* Next PC pixels */
! 89: edi += 2; /* Next ST pixels */
! 90: ebp += 2; /* Next ST copy pixels */
! 91: }
! 92: while (--x); /* Loop on X */
1.1.1.3 root 93: }
94:
95:
96: static void ConvertLowRes_640x8Bit(void)
97: {
1.1.1.5 ! root 98: Uint32 *edi, *ebp;
! 99: Uint32 *esi;
! 100: Uint32 eax;
! 101: int y;
! 102:
! 103: Convert_StartFrame(); /* Start frame, track palettes */
! 104:
! 105: for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++)
! 106: {
! 107:
! 108: /* Get screen addresses */
! 109: eax = STScreenLineOffset[y] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */
! 110: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colors */
! 111: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */
! 112: esi = (Uint32 *)pPCScreenDest; /* PC format screen */
! 113:
! 114: if (AdjustLinePaletteRemap(y) & 0x00030000) /* Change palette table */
! 115: Line_ConvertMediumRes_640x8Bit(edi, ebp, esi, eax);
! 116: else
! 117: Line_ConvertLowRes_640x8Bit(edi, ebp, esi, eax);
1.1.1.3 root 118:
1.1.1.5 ! root 119: pPCScreenDest = (((Uint8 *)pPCScreenDest)+PCScreenBytesPerLine*2); /* Offset to next line */
! 120: }
1.1 root 121: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.