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

1.1.1.2 ! root        1: /* Screen Conversion, Low Res to 320x16Bit */
1.1       root        2: 
                      3: void ConvertLowRes_320x16Bit(void)
                      4: {
1.1.1.2 ! root        5:  Uint32 *edi, *ebp;
        !             6:  Uint16 *esi;
        !             7:  register Uint32 eax, ebx, ecx, edx;
1.1       root        8: 
                      9:  edx=0;
                     10: 
1.1.1.2 ! root       11:  Convert_StartFrame();            /* Start frame, track palettes */
        !            12:  ScrY = STScreenStartHorizLine;   /* Starting line in ST screen */
1.1       root       13: 
                     14:  do      /* y-loop */
                     15:   {
                     16:    eax = STScreenLineOffset[ScrY] + STScreenLeftSkipBytes;  /* Offset for this line + Amount to skip on left hand side */
1.1.1.2 ! root       17:    edi = (Uint32 *)((Uint8 *)pSTScreen + eax);        /* ST format screen 4-plane 16 colours */
        !            18:    ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax);    /* Previous ST format screen */
        !            19:    esi = (Uint16 *)pPCScreenDest;                   /* PC format screen */
1.1       root       20: 
                     21:    AdjustLinePaletteRemap();
                     22:  
                     23: /*
                     24:     call  AdjustLinePaletteRemap        // Change palette table, DO NOT corrupt edx,edi,esi or ebp!
                     25:     jmp    Line_ConvertLowRes_320x16Bit    // 0 palette same, can do check tests
                     26: }
                     27: */
                     28: 
                     29: /*
                     30: NAKED void Line_ConvertLowRes_320x16Bit(void)
                     31: {
                     32: */
                     33: 
                     34:    ScrX=STScreenWidthBytes>>3;                /* Amount to draw across in 16-pixels(8 bytes) */
                     35: /*
                     36:   __asm {
                     37:     mov    eax,[STScreenWidthBytes]    // Amount to draw across
                     38:     shr    eax,3          // in 16-pixels(8 bytes)
                     39:     mov    [ScrX],eax
                     40: */
                     41: 
                     42:    do    /* x-loop */
                     43:     {
                     44:      /* Do 16 pixels at one time */
                     45:      ebx=*edi;
                     46:      ecx=*(edi+1);
                     47:      /* ScrUpdateFlag seems not to be set correctly?! - Thothy */
                     48:      if( 1||(ScrUpdateFlag&0xe0000000) || ebx!=*ebp || ecx!=*(ebp+1) )     /* Does differ? */
                     49:       { /* copy word */
                     50: /*
                     51: x_loop:
                     52: 
                     53:     // Do 16 pixels at one time
                     54:     mov    ebx,[edi]
                     55:     mov    ecx,4[edi]
                     56:     // Full update? or just test changes?
                     57:     test  [ScrUpdateFlag],0xe0000000
                     58:     jne    copy_word        // Force
                     59:     // Does differ?
                     60:     cmp    ebx,[ebp]
                     61:     jne    copy_word
                     62:     cmp    ecx,4[ebp]
                     63:     je    next_word        // Pixels are same as last frame, so ignore
                     64: */
                     65: 
                     66:        bScreenContentsChanged=TRUE;
                     67:    
                     68: /*
                     69: copy_word:
                     70:     mov    [bScreenContentsChanged],TRUE
                     71: */
                     72: 
1.1.1.2 ! root       73: #if SDL_BYTEORDER == SDL_BIG_ENDIAN
1.1       root       74:        /* Plot pixels */
                     75:        LOW_BUILD_PIXELS_0 ;      /* Generate 'ecx' as pixels [4,5,6,7] */
                     76:        PLOT_LOW_320_16BIT(12) ;
                     77:        LOW_BUILD_PIXELS_1 ;      /* Generate 'ecx' as pixels [12,13,14,15] */
                     78:        PLOT_LOW_320_16BIT(4) ;
                     79:        LOW_BUILD_PIXELS_2 ;      /* Generate 'ecx' as pixels [0,1,2,3] */
                     80:        PLOT_LOW_320_16BIT(8) ;
                     81:        LOW_BUILD_PIXELS_3 ;      /* Generate 'ecx' as pixels [8,9,10,11] */
                     82:        PLOT_LOW_320_16BIT(0) ;
                     83: #else
                     84:        /* Plot pixels */
                     85:        LOW_BUILD_PIXELS_0 ;      /* Generate 'ecx' as pixels [4,5,6,7] */
                     86:        PLOT_LOW_320_16BIT(4) ;
                     87:        LOW_BUILD_PIXELS_1 ;      /* Generate 'ecx' as pixels [12,13,14,15] */
                     88:        PLOT_LOW_320_16BIT(12) ;
                     89:        LOW_BUILD_PIXELS_2 ;      /* Generate 'ecx' as pixels [0,1,2,3] */
                     90:        PLOT_LOW_320_16BIT(0) ;
                     91:        LOW_BUILD_PIXELS_3 ;      /* Generate 'ecx' as pixels [8,9,10,11] */
                     92:        PLOT_LOW_320_16BIT(8) ;
                     93: #endif
                     94:       }
                     95: 
                     96:      esi += 16;                             /* Next PC pixels */
                     97:      edi += 2;                              /* Next ST pixels */
                     98:      ebp += 2;                              /* Next ST copy pixels */
                     99:     }
                    100:    while( --ScrX );                         /* Loop on X */
                    101: /*
                    102: next_word:
                    103:     add    esi,16*2        // Next PC pixels
                    104:     add    edi,8          // Next ST pixels
                    105:     add    ebp,8          // Next ST copy pixels
                    106: 
                    107:     dec    [ScrX]
                    108:     jne    x_loop          // Loop on X
                    109: */
                    110: 
                    111:    pPCScreenDest = (void *)(((unsigned char *)pPCScreenDest)+PCScreenBytesPerLine);  /* Offset to next line */
                    112:    ScrY += 1;
                    113:   }
                    114:  while( ScrY < STScreenEndHorizLine );      /* Loop on Y */
                    115: /*
                    116:     mov    eax,[pPCScreenDest]
                    117:     add    eax,[PCScreenBytesPerLine]    // Offset to next line
                    118:     mov    [pPCScreenDest],eax
                    119:     
                    120:     inc    [ScrY]
                    121:     mov    eax,[STScreenEndHorizLine]
                    122:     cmp    [ScrY],eax
                    123:     jne    ConvertLowRes_320x16Bit_YLoop    // And on Y
                    124: 
                    125:     pop    ebx
                    126:     pop    esi
                    127:     pop    edi
                    128:     pop    ebp
                    129: 
                    130:     ret
                    131:   }
                    132: */
                    133: }
                    134: 

unix.superglobalmegacorp.com

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