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

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