Annotation of hatari/src/convert/low320x16_spec.c, revision 1.1.1.3

1.1       root        1: /*
                      2:   Hatari - low320x16_spec.c
                      3: 
1.1.1.2   root        4:   This file is distributed under the GNU General Public License, version 2
                      5:   or at your option any later version. Read the file gpl.txt for details.
1.1       root        6: 
                      7:   Screen Conversion, Low Res Spec512 to 320x16Bit
                      8: */
                      9: 
                     10: static void ConvertLowRes_320x16Bit_Spec(void)
                     11: {
                     12:        Uint32 *edi, *ebp;
                     13:        Uint16 *esi;
                     14:        Uint32 eax, ebx, ecx, edx;
                     15:        Uint32 pixelspace[5]; /* Workspace to store pixels to so can print in right order for Spec512 */
                     16:        int y, x;
                     17: 
                     18:        /* on x86, unaligned access macro touches also
                     19:         * next byte, zero it for code checkers
                     20:         */
                     21:        pixelspace[4] = 0;
                     22: 
                     23:        Spec512_StartFrame();            /* Start frame, track palettes */
                     24: 
                     25:        for (y = STScreenStartHorizLine; y < STScreenEndHorizLine; y++)
                     26:        {
                     27: 
                     28:                Spec512_StartScanLine();        /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */
                     29: 
                     30:                /* Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen */
                     31:                eax = STScreenLineOffset[y] + STScreenLeftSkipBytes;  /* Offset for this line + Amount to skip on left hand side */
                     32:                edi = (Uint32 *)((Uint8 *)pSTScreen + eax);       /* ST format screen 4-plane 16 colors */
                     33:                ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax);   /* Previous ST format screen */
                     34:                esi = (Uint16 *)pPCScreenDest;                    /* PC format screen */
                     35: 
                     36:                x = STScreenWidthBytes >> 3;    /* Amount to draw across in 16-pixels (8 bytes) */
                     37: 
                     38:                do  /* x-loop */
                     39:                {
                     40:                        ebx = *edi;                 /* Do 16 pixels at one time */
                     41:                        ecx = *(edi+1);
                     42: 
                     43: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
                     44:                        /* Convert planes to byte indices - as works in wrong order store to workspace so can read back in order! */
                     45:                        LOW_BUILD_PIXELS_0 ;        /* Generate 'ecx' as pixels [12,13,14,15] */
                     46:                        pixelspace[3] = ecx;
                     47:                        LOW_BUILD_PIXELS_1 ;        /* Generate 'ecx' as pixels [4,5,6,7] */
                     48:                        pixelspace[1] = ecx;
                     49:                        LOW_BUILD_PIXELS_2 ;        /* Generate 'ecx' as pixels [8,9,10,11] */
                     50:                        pixelspace[2] = ecx;
                     51:                        LOW_BUILD_PIXELS_3 ;        /* Generate 'ecx' as pixels [0,1,2,3] */
                     52:                        pixelspace[0] = ecx;
                     53: #else
                     54:                        LOW_BUILD_PIXELS_0 ;        /* Generate 'ecx' as pixels [4,5,6,7] */
                     55:                        pixelspace[1] = ecx;
                     56:                        LOW_BUILD_PIXELS_1 ;        /* Generate 'ecx' as pixels [12,13,14,15] */
                     57:                        pixelspace[3] = ecx;
                     58:                        LOW_BUILD_PIXELS_2 ;        /* Generate 'ecx' as pixels [0,1,2,3] */
                     59:                        pixelspace[0] = ecx;
                     60:                        LOW_BUILD_PIXELS_3 ;        /* Generate 'ecx' as pixels [8,9,10,11] */
                     61:                        pixelspace[2] = ecx;
                     62: #endif
                     63:                        /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */
                     64:                        /* So, we plot 1_4_4_4_3 to give 16 pixels, changing palette between */
                     65:                        /* (last one is used for first of next 16-pixels) */
                     66:                        ecx = pixelspace[0];
                     67:                        PLOT_SPEC512_LEFT_LOW_320_16BIT(0);
                     68:                        Spec512_UpdatePaletteSpan();
                     69: 
                     70:                        ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 1);
                     71:                        PLOT_SPEC512_MID_320_16BIT(1);
                     72:                        Spec512_UpdatePaletteSpan();
                     73: 
                     74:                        ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 5);
                     75:                        PLOT_SPEC512_MID_320_16BIT(5);
                     76:                        Spec512_UpdatePaletteSpan();
                     77: 
                     78:                        ecx = GET_SPEC512_OFFSET_PIXELS(pixelspace, 9);
                     79:                        PLOT_SPEC512_MID_320_16BIT(9);
                     80:                        Spec512_UpdatePaletteSpan();
                     81: 
                     82:                        ecx = GET_SPEC512_OFFSET_FINAL_PIXELS(pixelspace);
                     83:                        PLOT_SPEC512_END_LOW_320_16BIT(13);
                     84: 
                     85:                        esi += 16;                  /* Next PC pixels */
                     86:                        edi += 2;                   /* Next ST pixels */
                     87:                        ebp += 2;                   /* Next ST copy pixels */
                     88:                }
                     89:                while (--x);                    /* Loop on X */
                     90: 
                     91:                Spec512_EndScanLine();
                     92: 
                     93:                /* Offset to next line */
                     94:                pPCScreenDest = (((Uint8 *)pPCScreenDest) + PCScreenBytesPerLine);
                     95:        }
                     96: 
                     97:        bScreenContentsChanged = true;
                     98: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.