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

1.1.1.2   root        1: /* Screen Conversion, Spec512 to 320x16Bit */
1.1       root        2: 
                      3: void ConvertSpec512_320x16Bit(void)
                      4: {
1.1.1.2   root        5:  Uint32 *edi, *ebp;
                      6:  Uint16 *esi;
                      7:  register Uint32 eax, ebx, ecx, edx;
                      8: 
                      9:  Spec512_StartFrame();            /* Start frame, track palettes */
                     10: 
                     11:  edx = 0;                         /* Clear index for loop */
                     12: 
                     13:  ScrY = STScreenStartHorizLine;   /* Starting line in ST screen */
                     14: 
                     15:  do      /* y-loop */
                     16:   {
                     17: 
                     18:    Spec512_StartScanLine();         /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */
                     19:    edx = 0;                         /* Clear index for loop */
                     20: 
                     21:    /* Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen */
                     22:    eax = STScreenLineOffset[ScrY] + STScreenLeftSkipBytes;  /* Offset for this line + Amount to skip on left hand side */
                     23:    edi = (Uint32 *)((Uint8 *)pSTScreen + eax);        /* ST format screen 4-plane 16 colours */
                     24:    ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax);    /* Previous ST format screen */
1.1.1.3 ! root       25:    esi = (Uint16 *)pPCScreenDest;                     /* PC format screen */
1.1       root       26: 
1.1.1.2   root       27:    ScrX=STScreenWidthBytes>>3;   /* Amount to draw across in 16-pixels (8 bytes) */
                     28: 
                     29:    do    /* x-loop */
                     30:     {
                     31:      ebx = *edi;                /* Do 16 pixels at one time */
                     32:      ecx = *(edi+1);
1.1       root       33: 
1.1.1.2   root       34:      /* Convert planes to byte indices - as works in wrong order store to workspace so can read back in order! */
                     35:      LOW_BUILD_PIXELS_0 ;               /* Generate 'ecx' as pixels [4,5,6,7] */
                     36:      PixelWorkspace[1] = ecx;
                     37:      LOW_BUILD_PIXELS_1 ;               /* Generate 'ecx' as pixels [12,13,14,15] */
                     38:      PixelWorkspace[3] = ecx;
                     39:      LOW_BUILD_PIXELS_2 ;               /* Generate 'ecx' as pixels [0,1,2,3] */
                     40:      PixelWorkspace[0] = ecx;
                     41:      LOW_BUILD_PIXELS_3 ;               /* Generate 'ecx' as pixels [8,9,10,11] */
                     42:      PixelWorkspace[2] = ecx;
                     43: 
1.1.1.3 ! root       44:      /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */
        !            45:      /* So, we plot 1_4_4_3 to give 16 pixels, changing palette between */
        !            46:      /* (last one is used for first of next 16-pixels) */
        !            47:      ecx = PixelWorkspace[0];
        !            48:      PLOT_SPEC512_LEFT_LOW_320_16BIT(0) ;
        !            49:      Spec512_UpdatePaletteSpan();
        !            50: 
        !            51:      ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+1 );  /* FIXME: I guess this will not work on some non-Intel architectures - Thothy */
        !            52:      PLOT_SPEC512_MID_320_16BIT(1) ;
        !            53:      Spec512_UpdatePaletteSpan();
        !            54: 
        !            55:      ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+5 );
        !            56:      PLOT_SPEC512_MID_320_16BIT(5) ;
        !            57:      Spec512_UpdatePaletteSpan();
        !            58: 
        !            59:      ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+9 );
        !            60:      PLOT_SPEC512_MID_320_16BIT(9) ;
        !            61:      Spec512_UpdatePaletteSpan();
        !            62: 
        !            63:      ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+13 );
        !            64:      PLOT_SPEC512_END_LOW_320_16BIT(13) ;
        !            65: 
1.1.1.2   root       66:      esi += 16;                             /* Next PC pixels */
                     67:      edi += 2;                              /* Next ST pixels */
                     68:      ebp += 2;                              /* Next ST copy pixels */
                     69:     }
                     70:    while( --ScrX );                         /* Loop on X */
1.1       root       71: 
1.1.1.2   root       72:    Spec512_EndScanLine();
1.1       root       73: 
1.1.1.2   root       74:    pPCScreenDest = (void *)(((unsigned char *)pPCScreenDest)+PCScreenBytesPerLine);  /* Offset to next line */
                     75:    ScrY += 1;
                     76:   }
                     77:  while( ScrY < STScreenEndHorizLine );      /* Loop on Y */
                     78: 
                     79:  bScreenContentsChanged = TRUE;
1.1       root       80: 
                     81: }
1.1.1.2   root       82: 

unix.superglobalmegacorp.com

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