Annotation of hatari/src/convert/high640x8.c, revision 1.1.1.2

1.1.1.2 ! root        1: /* Screen Conversion, High Res to 640x8Bit */
1.1       root        2: 
                      3: 
                      4: void ConvertHighRes_640x8Bit(void)
                      5: {
1.1.1.2 ! root        6:   Uint16 *edi, *ebp;
        !             7:   Uint32 *esi;
        !             8:   register Uint16 eax, ebx;
        !             9: 
1.1       root       10: /*
1.1.1.2 ! root       11:   // This is the method that I first used in Hatari...
        !            12:   // ...but I now rewrote the old WinSTon method, too.
        !            13:   // Don't know what is faster, so I didn't removed my
        !            14:   // first method here completely...
        !            15:   Uint8 *src=pSTScreen;
        !            16:   Uint8 *osrc=pSTScreenCopy;
        !            17:   Uint8 *dst=pPCScreenDest;
        !            18:   int i;
        !            19:   for(i=0; i<640*400/8; i++, src++, osrc++)
        !            20:    {
        !            21:     if( *osrc==*src )
        !            22:       dst+=8;
        !            23:      else
        !            24:      {
        !            25:       if( *src & 128 ) *dst++ = 1;  else  *dst++ = 0;
        !            26:       if( *src & 64 )  *dst++ = 1;  else  *dst++ = 0;
        !            27:       if( *src & 32 )  *dst++ = 1;  else  *dst++ = 0;
        !            28:       if( *src & 16 )  *dst++ = 1;  else  *dst++ = 0;
        !            29:       if( *src & 8 )   *dst++ = 1;  else  *dst++ = 0;
        !            30:       if( *src & 4 )   *dst++ = 1;  else  *dst++ = 0;
        !            31:       if( *src & 2 )   *dst++ = 1;  else  *dst++ = 0;
        !            32:       if( *src & 1 )   *dst++ = 1;  else  *dst++ = 0;
        !            33:      }
        !            34:    }
        !            35:   bScreenContentsChanged = TRUE;
        !            36:   return;
1.1       root       37: */
                     38: 
1.1.1.2 ! root       39:   /* Here's now the rewrite of the original WinSTon method: */
        !            40: 
        !            41:   edi = (Uint16 *)pSTScreen;        /* ST format screen */
        !            42:   ebp = (Uint16 *)pSTScreenCopy;    /* Previous ST format screen */
        !            43:   esi = (Uint32 *)pPCScreenDest;    /* PC format screen */
        !            44: 
        !            45:   ScrY = STScreenStartHorizLine;
        !            46:   
        !            47:   /* NOTE 'ScrUpdateFlag' is already set (to full update or check, no palettes) */
        !            48:   
        !            49:   do                                /* Y-loop */
        !            50:    {
        !            51: 
        !            52:     ScrX = 40;
        !            53:     
        !            54:     do                              /* X-loop */
        !            55:      {
        !            56: 
        !            57:       /* Do 16 pixels at one time */
        !            58:       ebx = *edi;
        !            59:       
        !            60:       if( (ScrUpdateFlag&0xe0000000) || ebx!=*ebp )  /* Does differ? */
        !            61:        {
        !            62:         bScreenContentsChanged = TRUE;
        !            63: 
        !            64: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
        !            65:         /* Plot in 'right-order' on big endian systems */
        !            66:         HIGH_BUILD_PIXELS_0 ;               /* Generate pixels [4,5,6,7] */
        !            67:         PLOT_HIGH_640_8BIT(3) ;
        !            68:         HIGH_BUILD_PIXELS_1 ;               /* Generate pixels [0,1,2,3] */
        !            69:         PLOT_HIGH_640_8BIT(2) ;
        !            70:         HIGH_BUILD_PIXELS_2 ;               /* Generate pixels [12,13,14,15] */
        !            71:         PLOT_HIGH_640_8BIT(1) ;
        !            72:         HIGH_BUILD_PIXELS_3 ;               /* Generate pixels [8,9,10,11] */
        !            73:         PLOT_HIGH_640_8BIT(0) ;
        !            74: #else
        !            75:         /* Plot in 'wrong-order', as ebx is 68000 endian */
        !            76:         HIGH_BUILD_PIXELS_0 ;               /* Generate pixels [4,5,6,7] */
        !            77:         PLOT_HIGH_640_8BIT(1) ;
        !            78:         HIGH_BUILD_PIXELS_1 ;               /* Generate pixels [0,1,2,3] */
        !            79:         PLOT_HIGH_640_8BIT(0) ;
        !            80:         HIGH_BUILD_PIXELS_2 ;               /* Generate pixels [12,13,14,15] */
        !            81:         PLOT_HIGH_640_8BIT(3) ;
        !            82:         HIGH_BUILD_PIXELS_3 ;               /* Generate pixels [8,9,10,11] */
        !            83:         PLOT_HIGH_640_8BIT(2) ;
        !            84: #endif
        !            85:        }
        !            86: 
        !            87:      esi += 4;                              /* Next PC pixels */
        !            88:      edi += 1;                              /* Next ST pixels */
        !            89:      ebp += 1;                              /* Next ST copy pixels */
        !            90:     }
        !            91:    while( --ScrX );                         /* Loop on X */
        !            92: 
        !            93: /*??  esi = esi -40*8 +PCScreenBytesPerLine/2;*/   /* Back to start of line + Offset to next line */
1.1       root       94: 
1.1.1.2 ! root       95:    ScrY += 1;
1.1       root       96:   }
1.1.1.2 ! root       97:  while( ScrY < 400/*STScreenEndHorizLine*/ );      /* Loop on Y */
        !            98: 
1.1       root       99: }
1.1.1.2 ! root      100: 

unix.superglobalmegacorp.com

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