Annotation of hatari/src/screenConvert.c, revision 1.1.1.6

1.1       root        1: /*
1.1.1.6 ! root        2:   Hatari - screenConvert.c
1.1       root        3: 
1.1.1.6 ! 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.
        !             6: 
        !             7:   Screen conversion routines. We have a number of routines to convert ST screen
        !             8:   to PC format. We split these into Low, Medium and High each with 8/16-bit
        !             9:   versions. To gain extra speed, as almost half of the processing time can be
        !            10:   spent in these routines, we check for any changes from the previously
        !            11:   displayed frame. AdjustLinePaletteRemap() sets a flag to tell the routines if
        !            12:   we need to totally update a line (ie full update, or palette/res change) or if
        !            13:   we just can do a difference check.
        !            14:   We convert each screen 16 pixels at a time by use of a couple of look-up
        !            15:   tables. These tables convert from 2-plane format to bbp and then we can add
        !            16:   two of these together to get 4-planes. This keeps the tables small and thus
        !            17:   improves speed. We then look these bbp values up as an RGB/Index value to copy
        !            18:   to the screen.
1.1       root       19: */
1.1.1.6 ! root       20: static char rcsid[] = "Hatari $Id: screenConvert.c,v 1.14 2003/02/02 22:41:34 thothy Exp $";
1.1       root       21: 
1.1.1.2   root       22: #include <SDL.h>
1.1.1.5   root       23: #include <SDL_endian.h>
1.1.1.2   root       24: 
1.1       root       25: #include "main.h"
                     26: #include "screen.h"
                     27: #include "screenConvert.h"
                     28: #include "spec512.h"
                     29: #include "vdi.h"
                     30: #include "video.h"
                     31: 
                     32: 
                     33: int ScrX,ScrY;                   /* Locals */
                     34: int ScrUpdateFlag;               /* Bit mask of how to update screen */
                     35: BOOL bScrDoubleY;                /* TRUE if double on Y */
1.1.1.3   root       36: Uint32 PixelWorkspace[4];        /* Workspace to store pixels to so can print in right order for Spec512 */
1.1       root       37: 
                     38: /* Remap tables to convert from plane format to byte-per-pixel (Upper is for 4-Planes so if shifted by 2) */
1.1.1.3   root       39: Uint32 Remap_2_Planes[256] = {
1.1       root       40:   0x00000000,  0x01000000,  0x00010000,  0x01010000,  0x00000100,  0x01000100,  0x00010100,  0x01010100,
                     41:   0x00000001,  0x01000001,  0x00010001,  0x01010001,  0x00000101,  0x01000101,  0x00010101,  0x01010101,
                     42:   0x02000000,  0x03000000,  0x02010000,  0x03010000,  0x02000100,  0x03000100,  0x02010100,  0x03010100,
                     43:   0x02000001,  0x03000001,  0x02010001,  0x03010001,  0x02000101,  0x03000101,  0x02010101,  0x03010101,
                     44:   0x00020000,  0x01020000,  0x00030000,  0x01030000,  0x00020100,  0x01020100,  0x00030100,  0x01030100,
                     45:   0x00020001,  0x01020001,  0x00030001,  0x01030001,  0x00020101,  0x01020101,  0x00030101,  0x01030101,
                     46:   0x02020000,  0x03020000,  0x02030000,  0x03030000,  0x02020100,  0x03020100,  0x02030100,  0x03030100,
                     47:   0x02020001,  0x03020001,  0x02030001,  0x03030001,  0x02020101,  0x03020101,  0x02030101,  0x03030101,
                     48:   0x00000200,  0x01000200,  0x00010200,  0x01010200,  0x00000300,  0x01000300,  0x00010300,  0x01010300,
                     49:   0x00000201,  0x01000201,  0x00010201,  0x01010201,  0x00000301,  0x01000301,  0x00010301,  0x01010301,
                     50:   0x02000200,  0x03000200,  0x02010200,  0x03010200,  0x02000300,  0x03000300,  0x02010300,  0x03010300,
                     51:   0x02000201,  0x03000201,  0x02010201,  0x03010201,  0x02000301,  0x03000301,  0x02010301,  0x03010301,
                     52:   0x00020200,  0x01020200,  0x00030200,  0x01030200,  0x00020300,  0x01020300,  0x00030300,  0x01030300,
                     53:   0x00020201,  0x01020201,  0x00030201,  0x01030201,  0x00020301,  0x01020301,  0x00030301,  0x01030301,
                     54:   0x02020200,  0x03020200,  0x02030200,  0x03030200,  0x02020300,  0x03020300,  0x02030300,  0x03030300,
                     55:   0x02020201,  0x03020201,  0x02030201,  0x03030201,  0x02020301,  0x03020301,  0x02030301,  0x03030301,
                     56:   0x00000002,  0x01000002,  0x00010002,  0x01010002,  0x00000102,  0x01000102,  0x00010102,  0x01010102,
                     57:   0x00000003,  0x01000003,  0x00010003,  0x01010003,  0x00000103,  0x01000103,  0x00010103,  0x01010103,
                     58:   0x02000002,  0x03000002,  0x02010002,  0x03010002,  0x02000102,  0x03000102,  0x02010102,  0x03010102,
                     59:   0x02000003,  0x03000003,  0x02010003,  0x03010003,  0x02000103,  0x03000103,  0x02010103,  0x03010103,
                     60:   0x00020002,  0x01020002,  0x00030002,  0x01030002,  0x00020102,  0x01020102,  0x00030102,  0x01030102,
                     61:   0x00020003,  0x01020003,  0x00030003,  0x01030003,  0x00020103,  0x01020103,  0x00030103,  0x01030103,
                     62:   0x02020002,  0x03020002,  0x02030002,  0x03030002,  0x02020102,  0x03020102,  0x02030102,  0x03030102,
                     63:   0x02020003,  0x03020003,  0x02030003,  0x03030003,  0x02020103,  0x03020103,  0x02030103,  0x03030103,
                     64:   0x00000202,  0x01000202,  0x00010202,  0x01010202,  0x00000302,  0x01000302,  0x00010302,  0x01010302,
                     65:   0x00000203,  0x01000203,  0x00010203,  0x01010203,  0x00000303,  0x01000303,  0x00010303,  0x01010303,
                     66:   0x02000202,  0x03000202,  0x02010202,  0x03010202,  0x02000302,  0x03000302,  0x02010302,  0x03010302,
                     67:   0x02000203,  0x03000203,  0x02010203,  0x03010203,  0x02000303,  0x03000303,  0x02010303,  0x03010303,
                     68:   0x00020202,  0x01020202,  0x00030202,  0x01030202,  0x00020302,  0x01020302,  0x00030302,  0x01030302,
                     69:   0x00020203,  0x01020203,  0x00030203,  0x01030203,  0x00020303,  0x01020303,  0x00030303,  0x01030303,
                     70:   0x02020202,  0x03020202,  0x02030202,  0x03030202,  0x02020302,  0x03020302,  0x02030302,  0x03030302,
                     71:   0x02020203,  0x03020203,  0x02030203,  0x03030203,  0x02020303,  0x03020303,  0x02030303,  0x03030303,
                     72: };
1.1.1.3   root       73: 
                     74: Uint32 Remap_2_Planes_Upper[256] = {
1.1       root       75:   0x00000000,  0x04000000,  0x00040000,  0x04040000,  0x00000400,  0x04000400,  0x00040400,  0x04040400,
                     76:   0x00000004,  0x04000004,  0x00040004,  0x04040004,  0x00000404,  0x04000404,  0x00040404,  0x04040404,
                     77:   0x08000000,  0x0C000000,  0x08040000,  0x0C040000,  0x08000400,  0x0C000400,  0x08040400,  0x0C040400,
                     78:   0x08000004,  0x0C000004,  0x08040004,  0x0C040004,  0x08000404,  0x0C000404,  0x08040404,  0x0C040404,
                     79:   0x00080000,  0x04080000,  0x000C0000,  0x040C0000,  0x00080400,  0x04080400,  0x000C0400,  0x040C0400,
                     80:   0x00080004,  0x04080004,  0x000C0004,  0x040C0004,  0x00080404,  0x04080404,  0x000C0404,  0x040C0404,
                     81:   0x08080000,  0x0C080000,  0x080C0000,  0x0C0C0000,  0x08080400,  0x0C080400,  0x080C0400,  0x0C0C0400,
                     82:   0x08080004,  0x0C080004,  0x080C0004,  0x0C0C0004,  0x08080404,  0x0C080404,  0x080C0404,  0x0C0C0404,
                     83:   0x00000800,  0x04000800,  0x00040800,  0x04040800,  0x00000C00,  0x04000C00,  0x00040C00,  0x04040C00,
                     84:   0x00000804,  0x04000804,  0x00040804,  0x04040804,  0x00000C04,  0x04000C04,  0x00040C04,  0x04040C04,
                     85:   0x08000800,  0x0C000800,  0x08040800,  0x0C040800,  0x08000C00,  0x0C000C00,  0x08040C00,  0x0C040C00,
                     86:   0x08000804,  0x0C000804,  0x08040804,  0x0C040804,  0x08000C04,  0x0C000C04,  0x08040C04,  0x0C040C04,
                     87:   0x00080800,  0x04080800,  0x000C0800,  0x040C0800,  0x00080C00,  0x04080C00,  0x000C0C00,  0x040C0C00,
                     88:   0x00080804,  0x04080804,  0x000C0804,  0x040C0804,  0x00080C04,  0x04080C04,  0x000C0C04,  0x040C0C04,
                     89:   0x08080800,  0x0C080800,  0x080C0800,  0x0C0C0800,  0x08080C00,  0x0C080C00,  0x080C0C00,  0x0C0C0C00,
                     90:   0x08080804,  0x0C080804,  0x080C0804,  0x0C0C0804,  0x08080C04,  0x0C080C04,  0x080C0C04,  0x0C0C0C04,
                     91:   0x00000008,  0x04000008,  0x00040008,  0x04040008,  0x00000408,  0x04000408,  0x00040408,  0x04040408,
                     92:   0x0000000C,  0x0400000C,  0x0004000C,  0x0404000C,  0x0000040C,  0x0400040C,  0x0004040C,  0x0404040C,
                     93:   0x08000008,  0x0C000008,  0x08040008,  0x0C040008,  0x08000408,  0x0C000408,  0x08040408,  0x0C040408,
                     94:   0x0800000C,  0x0C00000C,  0x0804000C,  0x0C04000C,  0x0800040C,  0x0C00040C,  0x0804040C,  0x0C04040C,
                     95:   0x00080008,  0x04080008,  0x000C0008,  0x040C0008,  0x00080408,  0x04080408,  0x000C0408,  0x040C0408,
                     96:   0x0008000C,  0x0408000C,  0x000C000C,  0x040C000C,  0x0008040C,  0x0408040C,  0x000C040C,  0x040C040C,
                     97:   0x08080008,  0x0C080008,  0x080C0008,  0x0C0C0008,  0x08080408,  0x0C080408,  0x080C0408,  0x0C0C0408,
                     98:   0x0808000C,  0x0C08000C,  0x080C000C,  0x0C0C000C,  0x0808040C,  0x0C08040C,  0x080C040C,  0x0C0C040C,
                     99:   0x00000808,  0x04000808,  0x00040808,  0x04040808,  0x00000C08,  0x04000C08,  0x00040C08,  0x04040C08,
                    100:   0x0000080C,  0x0400080C,  0x0004080C,  0x0404080C,  0x00000C0C,  0x04000C0C,  0x00040C0C,  0x04040C0C,
                    101:   0x08000808,  0x0C000808,  0x08040808,  0x0C040808,  0x08000C08,  0x0C000C08,  0x08040C08,  0x0C040C08,
                    102:   0x0800080C,  0x0C00080C,  0x0804080C,  0x0C04080C,  0x08000C0C,  0x0C000C0C,  0x08040C0C,  0x0C040C0C,
                    103:   0x00080808,  0x04080808,  0x000C0808,  0x040C0808,  0x00080C08,  0x04080C08,  0x000C0C08,  0x040C0C08,
                    104:   0x0008080C,  0x0408080C,  0x000C080C,  0x040C080C,  0x00080C0C,  0x04080C0C,  0x000C0C0C,  0x040C0C0C,
                    105:   0x08080808,  0x0C080808,  0x080C0808,  0x0C0C0808,  0x08080C08,  0x0C080C08,  0x080C0C08,  0x0C0C0C08,
                    106:   0x0808080C,  0x0C08080C,  0x080C080C,  0x0C0C080C,  0x08080C0C,  0x0C080C0C,  0x080C0C0C,  0x0C0C0C0C,
                    107: };
1.1.1.3   root      108: 
                    109: Uint32 Remap_1_Plane[16] = {
1.1       root      110:   0x00000000+BASECOLOUR_LONG,  0x01000000+BASECOLOUR_LONG,  0x00010000+BASECOLOUR_LONG,  0x01010000+BASECOLOUR_LONG,  0x00000100+BASECOLOUR_LONG,  0x01000100+BASECOLOUR_LONG,  0x00010100+BASECOLOUR_LONG,  0x01010100+BASECOLOUR_LONG,
                    111:   0x00000001+BASECOLOUR_LONG,  0x01000001+BASECOLOUR_LONG,  0x00010001+BASECOLOUR_LONG,  0x01010001+BASECOLOUR_LONG,  0x00000101+BASECOLOUR_LONG,  0x01000101+BASECOLOUR_LONG,  0x00010101+BASECOLOUR_LONG,  0x01010101+BASECOLOUR_LONG,
                    112: };
                    113: 
1.1.1.2   root      114: /*-----------------------------------------------------------------------*/
1.1       root      115: /*
                    116:   Update the STRGBPalette[] array with current colours for this raster line.
                    117: 
1.1.1.2   root      118:   Return 'ScrUpdateFlag', 0x80000000=Full update, 0x40000000=Update as palette changed
1.1       root      119: */
                    120: int AdjustLinePaletteRemap(void)
                    121: {
1.1.1.5   root      122: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
                    123:   static const int endiantable[16] = {0,2,1,3,8,10,9,11,4,6,5,7,12,14,13,15};
                    124: #endif
1.1.1.2   root      125:   unsigned short *actHBLPal;
                    126:   int i;
                    127:   int v;
1.1.1.5   root      128: 
1.1.1.2   root      129:   /* Copy palette and convert to RGB in display format */
                    130:   actHBLPal = pHBLPalettes + (ScrY<<4);    /* offset in palette */
                    131:   for(i=0; i<16; i++)
                    132:    {
                    133:     v=*actHBLPal;
                    134:     actHBLPal+=1;
                    135:     v=v&0x777;
1.1.1.3   root      136: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
1.1.1.2   root      137:     STRGBPalette[endiantable[i]] = ST2RGB[v];
                    138: #else
                    139:     STRGBPalette[i] = ST2RGB[v];
                    140: #endif
                    141:    }
1.1.1.3   root      142:   ScrUpdateFlag = HBLPaletteMasks[ScrY];
1.1.1.2   root      143:   return ScrUpdateFlag;
1.1       root      144: }
                    145: 
1.1.1.2   root      146: 
                    147: /*-----------------------------------------------------------------------*/
1.1       root      148: /*
                    149:   Run updates to palette(STRGBPalette[]) until get to screen line we are to convert from
                    150: */
                    151: void Convert_StartFrame(void)
                    152: {
                    153:  int ecx;
                    154:  ecx=STScreenStartHorizLine;            /* Get #lines before conversion starts */
                    155:  if( ecx==0 )  return;
                    156:  ScrY=0;
                    157:  do
                    158:   {
                    159:    AdjustLinePaletteRemap();            /* Update palette */
                    160:    ++ScrY;
                    161:    --ecx;
                    162:   }
                    163:  while( ecx );
                    164: }
                    165: 
                    166: 
                    167: 
                    168: 
                    169: 
                    170: #define LOW_BUILD_PIXELS_0 \
                    171: { \
                    172:  ebx &= 0x0f0f0f0f; \
                    173:  ecx &= 0x0f0f0f0f; \
                    174:  eax = ebx >> 12; \
                    175:  eax |= ebx; \
                    176:  edx = ecx >> 12; \
                    177:  edx |= ecx; \
                    178:  ebx = edx; \
                    179:  ebx &= 0x00ff; \
                    180:  ecx = Remap_2_Planes_Upper[ebx]; \
                    181:  ebx = eax; \
                    182:  ebx &= 0x00ff; \
                    183:  ecx += Remap_2_Planes[ebx]; \
                    184: }
                    185: 
                    186: #define LOW_BUILD_PIXELS_1 \
                    187: { \
                    188:  ebx = edx; \
                    189:  ebx = ebx >> 8; \
                    190:  ebx &= 0x00ff; \
                    191:  ecx = Remap_2_Planes_Upper[ebx]; \
                    192:  ebx = eax; \
                    193:  ebx = ebx >> 8; \
                    194:  ebx &= 0x00ff; \
                    195:  ecx += Remap_2_Planes[ebx]; \
                    196: }
                    197: 
                    198: #define LOW_BUILD_PIXELS_2 \
                    199: { \
                    200:  ebx = *edi; \
                    201:  ecx = *(edi+1); \
                    202:  ebx &= 0xf0f0f0f0; \
                    203:  ecx &= 0xf0f0f0f0; \
                    204:  ebx = ebx >> 4; \
                    205:  eax = ebx; \
                    206:  ebx = ebx >> 12; \
                    207:  eax |= ebx; \
                    208:  ecx = ecx >> 4; \
                    209:  edx = ecx; \
                    210:  ecx = ecx >> 12; \
                    211:  edx |= ecx; \
                    212:  ebx = edx; \
                    213:  ebx &= 0x00ff; \
                    214:  ecx = Remap_2_Planes_Upper[ebx]; \
                    215:  ebx = eax; \
                    216:  ebx &= 0x00ff; \
                    217:  ecx += Remap_2_Planes[ebx]; \
                    218: }
                    219: 
                    220: #define LOW_BUILD_PIXELS_3 \
                    221: { \
                    222:  ebx = edx; \
                    223:  ebx = ebx >> 8; \
                    224:  ebx &= 0x00ff; \
                    225:  ecx = Remap_2_Planes_Upper[ebx]; \
                    226:  ebx = eax; \
                    227:  ebx = ebx >> 8; \
                    228:  ebx &= 0x00ff; \
                    229:  ecx += Remap_2_Planes[ebx]; \
                    230: }
                    231: 
1.1.1.2   root      232: 
                    233: #define MED_BUILD_PIXELS_0 \
                    234: { \
                    235:  ebx &= 0x0f0f0f0f; \
                    236:  eax = ebx; \
                    237:  eax >>= 12; \
                    238:  eax |= ebx; \
                    239:  ebx = eax; \
                    240:  ebx &= 0x000000ff; \
                    241:  ecx = Remap_2_Planes[ebx]; \
                    242: }
                    243: 
                    244: #define MED_BUILD_PIXELS_1 \
                    245: { \
                    246:  ebx = eax; \
                    247:  ebx >>=8; \
                    248:  ebx &= 0x000000ff; \
                    249:  ecx = Remap_2_Planes[ebx]; \
                    250: }
                    251: 
                    252: #define MED_BUILD_PIXELS_2 \
                    253: { \
                    254:  ebx = *edi; \
                    255:  ebx &= 0xf0f0f0f0; \
                    256:  ebx >>= 4; \
                    257:  eax = ebx; \
                    258:  ebx >>= 12; \
                    259:  eax |= ebx; \
                    260:  ebx = eax; \
                    261:  ebx &= 0x000000ff; \
                    262:  ecx = Remap_2_Planes[ebx]; \
                    263: }
                    264: 
                    265: #define MED_BUILD_PIXELS_3 \
                    266: { \
                    267:  ebx = eax; \
                    268:  ebx >>= 8; \
                    269:  ebx &= 0x000000ff; \
                    270:  ecx = Remap_2_Planes[ebx]; \
                    271: }
                    272: 
1.1.1.3   root      273: 
                    274: /* Routines to create 'ecx' pixels - MUST be called in this order */
                    275: #define HIGH_BUILD_PIXELS_0 \
                    276: { \
                    277:  eax = ebx; \
                    278:  eax &= 0x0000000f; \
                    279: }
                    280: 
                    281: #define HIGH_BUILD_PIXELS_1 \
                    282: { \
                    283:  eax = ebx; \
                    284:  eax >>= 4; \
                    285:  eax &= 0x0000000f;\
                    286: }
                    287: 
                    288: #define HIGH_BUILD_PIXELS_2 \
                    289: { \
                    290:  eax = ebx; \
                    291:  eax >>= 8; \
                    292:  eax &= 0x0000000f;\
                    293: }
                    294: 
                    295: #define HIGH_BUILD_PIXELS_3 \
                    296: { \
                    297:  eax = ebx; \
                    298:  eax >>= 12; \
                    299:  eax &= 0x0000000f;\
                    300: }
                    301: 
                    302: 
                    303: /* Plot Low Resolution (320xH) 16-Bit pixels */
                    304: #define PLOT_LOW_320_16BIT(offset)  \
                    305: { \
                    306:  ebx = ecx; \
                    307:  ebx &= 0x00ff; \
                    308:  ecx = ecx >> 8; \
                    309:  ebx = STRGBPalette[ebx]; \
                    310:  esi[offset] = (unsigned short) ebx; \
                    311:  ebx = ecx; \
                    312:  ebx &= 0x00ff; \
                    313:  ecx = ecx >> 8; \
                    314:  ebx = STRGBPalette[ebx]; \
                    315:  esi[offset+1] = (unsigned short) ebx; \
                    316:  ebx = ecx; \
                    317:  ebx &= 0x00ff; \
                    318:  ecx = ecx >> 8; \
                    319:  ebx = STRGBPalette[ebx]; \
                    320:  esi[offset+2] = (unsigned short) ebx; \
                    321:  ebx = ecx; \
                    322:  ebx &= 0x00ff; \
                    323:  ebx = STRGBPalette[ebx]; \
                    324:  esi[offset+3] = (unsigned short) ebx; \
                    325: }
                    326: 
1.1.1.5   root      327: /* Plot Low Resolution (320xH) 8-Bit pixels */
                    328: #define PLOT_LOW_320_8BIT(offset) \
                    329: { \
                    330:   ecx += BASECOLOUR_LONG; \
                    331:   esi[offset] = SDL_SwapLE32(ecx); \
                    332: }
                    333: 
1.1.1.6 ! root      334: /* Plot Low Resolution (640xH) 8-Bit pixels */
        !           335: #define PLOT_LOW_640_8BIT(offset) \
        !           336: { \
        !           337:   ecx += BASECOLOUR_LONG; \
        !           338:   ebpp = ecx; \
        !           339:   ebx = ebpp; \
        !           340:   ecx &= 0x000000ff; \
        !           341:   ebx &= 0x0000ff00; \
        !           342:   ebx <<= 8; \
        !           343:   ecx |= ebx; \
        !           344:   ebx = ecx; \
        !           345:   ebx <<= 8; \
        !           346:   ecx |= ebx; \
        !           347:   esi[offset] = SDL_SwapLE32(ecx); \
        !           348:   ecx = ebpp; \
        !           349:   ebx = ebpp; \
        !           350:   ecx &= 0xff000000; \
        !           351:   ebx &= 0x00ff0000; \
        !           352:   ebx >>= 8; \
        !           353:   ecx |= ebx; \
        !           354:   ebx = ecx; \
        !           355:   ebx >>= 8; \
        !           356:   ecx |= ebx; \
        !           357:   esi[offset+1] = SDL_SwapLE32(ecx); \
        !           358: }
        !           359: 
        !           360: /* Plot Low Resolution (640xH) 8-Bit pixels (double on Y) */
        !           361: #define PLOT_LOW_640_8BIT_DOUBLE_Y(offset)     \
        !           362: { \
        !           363:   ecx += BASECOLOUR_LONG; \
        !           364:   ebpp = ecx; \
        !           365:   ebx = ebpp; \
        !           366:   ecx &= 0x000000ff; \
        !           367:   ebx &= 0x0000ff00; \
        !           368:   ebx <<= 8; \
        !           369:   ecx |= ebx; \
        !           370:   ebx = ecx; \
        !           371:   ebx <<= 8; \
        !           372:   ecx |= ebx; \
        !           373:   esi[offset] = esi[offset+PCScreenBytesPerLine/4] = SDL_SwapLE32(ecx); \
        !           374:   ecx = ebpp; \
        !           375:   ebx = ebpp; \
        !           376:   ecx &= 0xff000000; \
        !           377:   ebx &= 0x00ff0000; \
        !           378:   ebx >>= 8; \
        !           379:   ecx |= ebx; \
        !           380:   ebx = ecx; \
        !           381:   ebx >>= 8; \
        !           382:   ecx |= ebx; \
        !           383:   esi[offset+1] = esi[offset+1+PCScreenBytesPerLine/4] = SDL_SwapLE32(ecx); \
        !           384: }
        !           385: 
1.1.1.3   root      386: /* Plot Low Resolution (640xH) 16-Bit pixels */
                    387: #define PLOT_LOW_640_16BIT(offset) \
                    388: { \
                    389:  ebx = ecx; \
                    390:  ebx &= 0x000000ff; \
                    391:  ecx >>= 8; \
                    392:  ebx = STRGBPalette[ebx]; \
                    393:  esi[offset] = ebx; \
                    394:  ebx = ecx; \
                    395:  ebx &= 0x000000ff; \
                    396:  ecx >>= 8; \
                    397:  ebx = STRGBPalette[ebx]; \
                    398:  esi[offset+1] = ebx; \
                    399:  ebx = ecx; \
                    400:  ebx &= 0x000000ff; \
                    401:  ecx >>= 8; \
                    402:  ebx = STRGBPalette[ebx]; \
                    403:  esi[offset+2] = ebx; \
                    404:  ebx = ecx; \
                    405:  ebx &= 0x000000ff; \
                    406:  ebx = STRGBPalette[ebx]; \
                    407:  esi[offset+3] = ebx; \
                    408: } 
                    409: 
                    410: /* Plot Low Resolution (640xH) 16-Bit pixels (Double on Y) */
                    411: #define PLOT_LOW_640_16BIT_DOUBLE_Y(offset) \
                    412: { \
                    413:  ebx = ecx; \
                    414:  ebx &= 0x000000ff; \
                    415:  ecx >>= 8; \
                    416:  ebx = STRGBPalette[ebx]; \
                    417:  esi[offset] = ebx; \
                    418:  esi[offset+PCScreenBytesPerLine/4] = ebx; \
                    419:  ebx = ecx; \
                    420:  ebx &= 0x000000ff; \
                    421:  ecx >>= 8; \
                    422:  ebx = STRGBPalette[ebx]; \
                    423:  esi[offset+1] = ebx; \
                    424:  esi[offset+1+PCScreenBytesPerLine/4] = ebx; \
                    425:  ebx = ecx; \
                    426:  ebx &= 0x000000ff; \
                    427:  ecx >>= 8; \
                    428:  ebx = STRGBPalette[ebx]; \
                    429:  esi[offset+2] = ebx; \
                    430:  esi[offset+2+PCScreenBytesPerLine/4] = ebx; \
                    431:  ebx = ecx; \
                    432:  ebx &= 0x000000ff; \
                    433:  ebx = STRGBPalette[ebx]; \
                    434:  esi[offset+3] = ebx; \
                    435:  esi[offset+3+PCScreenBytesPerLine/4] = ebx; \
                    436: }
                    437: 
                    438: 
1.1.1.5   root      439: /* Plot Medium Resolution (640xH) 8-Bit pixels */
                    440: #define PLOT_MED_640_8BIT(offset) \
                    441: { \
                    442:   ecx += BASECOLOUR_LONG; \
                    443:   esi[offset] = SDL_SwapLE32(ecx); \
                    444: }
                    445: 
1.1.1.6 ! root      446: /* Plot Medium Resolution (640xH) 8-Bit pixels (Double on Y) */
        !           447: #define PLOT_MED_640_8BIT_DOUBLE_Y(offset) \
        !           448: { \
        !           449:   ecx += BASECOLOUR_LONG; \
        !           450:   esi[offset] = esi[offset+PCScreenBytesPerLine/4] = SDL_SwapLE32(ecx); \
        !           451: }
        !           452: 
1.1.1.2   root      453: /* Plot Medium Resolution(640xH) 16-Bit pixels */
                    454: #define PLOT_MED_640_16BIT(offset) \
                    455: { \
                    456:  ebx = ecx; \
                    457:  ebx &= 0x000000ff; \
                    458:  ecx >>= 8; \
                    459:  ebx = STRGBPalette[ebx]; \
                    460:  esi[offset] = (Uint16)ebx; \
                    461:  ebx = ecx; \
                    462:  ebx &= 0x000000ff; \
                    463:  ecx >>= 8; \
                    464:  ebx = STRGBPalette[ebx]; \
                    465:  esi[offset+1] = (Uint16)ebx; \
                    466:  ebx = ecx; \
                    467:  ebx &= 0x000000ff; \
                    468:  ecx >>= 8; \
                    469:  ebx = STRGBPalette[ebx]; \
                    470:  esi[offset+2] = (Uint16)ebx; \
                    471:  ebx = ecx; \
                    472:  ebx &= 0x000000ff; \
                    473:  ebx = STRGBPalette[ebx]; \
                    474:  esi[offset+3] = (Uint16)ebx; \
                    475: }
                    476: 
                    477: /* Plot Medium Resolution(640xH) 16-Bit pixels (Double on Y) */
                    478: #define PLOT_MED_640_16BIT_DOUBLE_Y(offset) \
                    479: { \
                    480:  ebx = ecx; \
                    481:  ebx &= 0x000000ff; \
                    482:  ecx >>= 8; \
                    483:  ebx = STRGBPalette[ebx]; \
                    484:  esi[offset] = (Uint16)ebx; \
1.1.1.3   root      485:  esi[offset+PCScreenBytesPerLine/2] = (Uint16)ebx; \
1.1.1.2   root      486:  ebx = ecx; \
                    487:  ebx &= 0x000000ff; \
                    488:  ecx >>= 8; \
                    489:  ebx = STRGBPalette[ebx]; \
                    490:  esi[offset+1] = (Uint16)ebx; \
1.1.1.3   root      491:  esi[offset+1+PCScreenBytesPerLine/2] = (Uint16)ebx; \
1.1.1.2   root      492:  ebx = ecx; \
                    493:  ebx &= 0x000000ff; \
                    494:  ecx >>= 8; \
                    495:  ebx = STRGBPalette[ebx]; \
                    496:  esi[offset+2] = (Uint16)ebx; \
1.1.1.3   root      497:  esi[offset+2+PCScreenBytesPerLine/2] = (Uint16)ebx; \
1.1.1.2   root      498:  ebx = ecx; \
                    499:  ebx &= 0x000000ff; \
                    500:  ebx = STRGBPalette[ebx]; \
                    501:  esi[offset+3] = (Uint16)ebx; \
1.1.1.3   root      502:  esi[offset+3+PCScreenBytesPerLine/2] = (Uint16)ebx; \
                    503: }
                    504: 
                    505: 
                    506: /* Plot High Resolution (640xH) 8-Bit pixels */
                    507: #define PLOT_HIGH_640_8BIT(offset) \
                    508: { \
1.1.1.5   root      509:  esi[offset] = SDL_SwapLE32(Remap_1_Plane[eax]); \
1.1.1.2   root      510: }
                    511: 
                    512: 
                    513: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
                    514: #define PLOT_SPEC512_LEFT_LOW_320_16BIT(offset)        \
                    515: { \
                    516:  ecx &= 0x000000ff; \
                    517:  ebx = STRGBPalette[ecx]; \
                    518:  esi[offset] = (Uint16)ebx; \
                    519: }
                    520: 
                    521: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
                    522: #define PLOT_SPEC512_MID_320_16BIT(offset) \
                    523: { \
                    524:  ebx = ecx; \
                    525:  ebx &= 0x000000ff; \
                    526:  ecx >>= 8; \
                    527:  ebx = STRGBPalette[ebx]; \
                    528:  esi[offset] = (Uint16)ebx; \
                    529:  ebx = ecx; \
                    530:  ebx &= 0x000000ff; \
                    531:  ecx >>= 8; \
                    532:  ebx = STRGBPalette[ebx]; \
                    533:  esi[offset+1] = (Uint16)ebx; \
                    534:  ebx = ecx; \
                    535:  ebx &= 0x000000ff; \
                    536:  ecx >>= 8; \
                    537:  ebx = STRGBPalette[ebx]; \
                    538:  esi[offset+2] = (Uint16)ebx; \
                    539:  ebx = ecx; \
                    540:  ebx &= 0x000000ff; \
                    541:  ebx = STRGBPalette[ebx]; \
                    542:  esi[offset+3] = (Uint16)ebx; \
                    543: }
                    544: 
                    545: /* Plot Spectrum512 Resolution(320xH) 16-Bit pixels */
                    546: #define PLOT_SPEC512_END_LOW_320_16BIT(offset) \
                    547: { \
                    548:  ebx = ecx; \
                    549:  ebx &= 0x000000ff; \
                    550:  ecx >>= 8; \
                    551:  ebx = STRGBPalette[ebx]; \
                    552:  esi[offset] = (Uint16)ebx; \
                    553:  ebx = ecx; \
                    554:  ebx &= 0x000000ff; \
                    555:  ecx >>= 8; \
                    556:  ebx = STRGBPalette[ebx]; \
                    557:  esi[offset+1] = (Uint16)ebx; \
                    558:  ebx = ecx; \
                    559:  ebx &= 0x000000ff; \
                    560:  ecx >>= 8; \
                    561:  ebx = STRGBPalette[ebx]; \
                    562:  esi[offset+2] = (Uint16)ebx; \
                    563: }
1.1       root      564: 
                    565: 
1.1.1.6 ! root      566: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
        !           567: #define PLOT_SPEC512_LEFT_LOW_640_16BIT(offset)        \
        !           568: { \
        !           569:   ecx &= 0x000000ff; \
        !           570:   ebx = STRGBPalette[ecx]; \
        !           571:   esi[offset] = ebx; \
        !           572: }
        !           573: /*
        !           574:        __asm   and             ecx,0x000000ff \
        !           575:        __asm   mov             ebx,DWORD PTR STRGBPalette[ecx*4] \
        !           576:        __asm   mov             offset[esi],ebx
        !           577: */
        !           578: 
        !           579: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
        !           580: #define PLOT_SPEC512_MID_640_16BIT(offset)     \
        !           581: { \
        !           582:   ebx = ecx; \
        !           583:   ebx &= 0x000000ff; \
        !           584:   ecx >>= 8; \
        !           585:   ebx = STRGBPalette[ebx]; \
        !           586:   esi[offset] = ebx; \
        !           587:   ebx = ecx; \
        !           588:   ebx &= 0x000000ff; \
        !           589:   ecx >>= 8; \
        !           590:   ebx = STRGBPalette[ebx]; \
        !           591:   esi[offset+1] = ebx; \
        !           592:   ebx = ecx; \
        !           593:   ebx &= 0x000000ff; \
        !           594:   ecx >>= 8; \
        !           595:   ebx = STRGBPalette[ebx]; \
        !           596:   esi[offset+2] = ebx; \
        !           597:   ebx = ecx; \
        !           598:   ebx &= 0x000000ff; \
        !           599:   ebx = STRGBPalette[ebx]; \
        !           600:   esi[offset+3] = ebx; \
        !           601: }
        !           602: 
        !           603: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels */
        !           604: #define PLOT_SPEC512_END_LOW_640_16BIT(offset) \
        !           605: { \
        !           606:   ebx = ecx; \
        !           607:   ebx &= 0x000000ff; \
        !           608:   ecx >>= 8; \
        !           609:   ebx = STRGBPalette[ebx]; \
        !           610:   esi[offset] = ebx; \
        !           611:   ebx = ecx; \
        !           612:   ebx &= 0x000000ff; \
        !           613:   ecx >>= 8; \
        !           614:   ebx = STRGBPalette[ebx]; \
        !           615:   esi[offset+1] = ebx; \
        !           616:   ebx = ecx; \
        !           617:   ebx &= 0x000000ff; \
        !           618:   ecx >>= 8; \
        !           619:   ebx = STRGBPalette[ebx]; \
        !           620:   esi[offset+2] = ebx; \
        !           621: }
        !           622: /*
        !           623:        __asm   mov             ebx,ecx \
        !           624:        __asm   and             ebx,0x000000ff \
        !           625:        __asm   shr             ecx,8 \
        !           626:        __asm   mov             ebx,DWORD PTR STRGBPalette[ebx*4] \
        !           627:        __asm   mov             offset[esi],ebx \
        !           628:        __asm   mov             ebx,ecx \
        !           629:        __asm   and             ebx,0x000000ff \
        !           630:        __asm   shr             ecx,8 \
        !           631:        __asm   mov             ebx,DWORD PTR STRGBPalette[ebx*4] \
        !           632:        __asm   mov             offset[esi+4],ebx \
        !           633:        __asm   mov             ebx,ecx \
        !           634:        __asm   and             ebx,0x000000ff \
        !           635:        __asm   shr             ecx,8 \
        !           636:        __asm   mov             ebx,DWORD PTR STRGBPalette[ebx*4] \
        !           637:        __asm   mov             offset[esi+8],ebx
        !           638: */
        !           639: 
        !           640: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
        !           641: #define PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(offset)       \
        !           642: { \
        !           643:   ecx &= 0x000000ff; \
        !           644:   ebx = STRGBPalette[ecx]; \
        !           645:   esi[offset] = ebx; \
        !           646:   esi[offset+PCScreenBytesPerLine/4] = ebx; \
        !           647: }
        !           648: /*
        !           649:        __asm   and             ecx,0x000000ff \
        !           650:        __asm   mov             ebx,DWORD PTR STRGBPalette[ecx*4] \
        !           651:        __asm   mov             offset[esi],ebx \
        !           652:        __asm   mov             offset[esi+ebp],ebx
        !           653: */
        !           654: 
        !           655: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
        !           656: #define PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(offset)    \
        !           657: { \
        !           658:   ebx = ecx; \
        !           659:   ebx &= 0x000000ff; \
        !           660:   ecx >>= 8; \
        !           661:   ebx = STRGBPalette[ebx]; \
        !           662:   esi[offset] = ebx; \
        !           663:   esi[offset+PCScreenBytesPerLine/4] = ebx; \
        !           664:   ebx = ecx; \
        !           665:   ebx &= 0x000000ff; \
        !           666:   ecx >>= 8; \
        !           667:   ebx = STRGBPalette[ebx]; \
        !           668:   esi[offset+1] = ebx; \
        !           669:   esi[offset+1+PCScreenBytesPerLine/4] = ebx; \
        !           670:   ebx = ecx; \
        !           671:   ebx &= 0x000000ff; \
        !           672:   ecx >>= 8; \
        !           673:   ebx = STRGBPalette[ebx]; \
        !           674:   esi[offset+2] = ebx; \
        !           675:   esi[offset+2+PCScreenBytesPerLine/4] = ebx; \
        !           676:   ebx = ecx; \
        !           677:   ebx &= 0x000000ff; \
        !           678:   ebx = STRGBPalette[ebx]; \
        !           679:   esi[offset+3] = ebx; \
        !           680:   esi[offset+3+PCScreenBytesPerLine/4] = ebx; \
        !           681: }
        !           682: 
        !           683: /* Plot Spectrum512 Resolution (640xH) 16-Bit pixels (Double on Y) */
        !           684: #define PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(offset)        \
        !           685: { \
        !           686:   ebx = ecx; \
        !           687:   ebx &= 0x000000ff; \
        !           688:   ecx >>= 8; \
        !           689:   ebx = STRGBPalette[ebx]; \
        !           690:   esi[offset] = ebx; \
        !           691:   esi[offset+PCScreenBytesPerLine/4] = ebx; \
        !           692:   ebx = ecx; \
        !           693:   ebx &= 0x000000ff; \
        !           694:   ecx >>= 8; \
        !           695:   ebx = STRGBPalette[ebx]; \
        !           696:   esi[offset+1] = ebx; \
        !           697:   esi[offset+1+PCScreenBytesPerLine/4] = ebx; \
        !           698:   ebx = ecx; \
        !           699:   ebx &= 0x000000ff; \
        !           700:   ecx >>= 8; \
        !           701:   ebx = STRGBPalette[ebx]; \
        !           702:   esi[offset+2] = ebx; \
        !           703:   esi[offset+2+PCScreenBytesPerLine/4] = ebx; \
        !           704: }
        !           705: /*
        !           706:        __asm   mov             ebx,ecx \
        !           707:        __asm   and             ebx,0x000000ff \
        !           708:        __asm   shr             ecx,8 \
        !           709:        __asm   mov             ebx,DWORD PTR STRGBPalette[ebx*4] \
        !           710:        __asm   mov             offset[esi],ebx \
        !           711:        __asm   mov             offset[esi+ebp],ebx \
        !           712:        __asm   mov             ebx,ecx \
        !           713:        __asm   and             ebx,0x000000ff \
        !           714:        __asm   shr             ecx,8 \
        !           715:        __asm   mov             ebx,DWORD PTR STRGBPalette[ebx*4] \
        !           716:        __asm   mov             offset[esi+4],ebx \
        !           717:        __asm   mov             offset[esi+4+ebp],ebx \
        !           718:        __asm   mov             ebx,ecx \
        !           719:        __asm   and             ebx,0x000000ff \
        !           720:        __asm   shr             ecx,8 \
        !           721:        __asm   mov             ebx,DWORD PTR STRGBPalette[ebx*4] \
        !           722:        __asm   mov             offset[esi+8],ebx \
        !           723:        __asm   mov             offset[esi+8+ebp],ebx
        !           724: */
        !           725: 
        !           726: 
1.1       root      727: 
                    728: /* Conversion routines */
                    729: #include "convert/low320x16.c"    /* LowRes To 320xH x 16-bit colour */
                    730: #include "convert/low640x16.c"    /* LowRes To 640xH x 16-bit colour */
                    731: #include "convert/med640x16.c"    /* MediumRes To 640xH x 16-bit colour */
                    732: #include "convert/low320x8.c"     /* LowRes To 320xH x 8-bit colour */
                    733: #include "convert/low640x8.c"     /* LowRes To 640xH x 8-bit colour */
                    734: #include "convert/med640x8.c"     /* MediumRes To 640xH x 8-bit colour */
                    735: #include "convert/high640x8.c"    /* HighRes To 640xH x 8-bit colour */
                    736: #include "convert/high640x1.c"    /* HighRes To 640xH x 1-bit colour */
                    737: #include "convert/spec320x16.c"   /* Spectrum 512 To 320xH x 16-bit colour */
                    738: #include "convert/spec640x16.c"   /* Spectrum 512 To 640xH x 16-bit colour */
                    739: 
                    740: #include "convert/vdi16.c"        /* VDI x 16 colour */
                    741: #include "convert/vdi4.c"         /* VDI x 4 colour */
                    742: #include "convert/vdi2.c"         /* VDI x 2 colour */

unix.superglobalmegacorp.com

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