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

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

unix.superglobalmegacorp.com

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