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

1.1     ! root        1: // Screen Conversion, Medium Res to 640x8Bit
        !             2: 
        !             3: void ConvertMediumRes_640x8Bit_YLoop(void);
        !             4: void Line_ConvertMediumRes_640x8Bit(void);
        !             5: 
        !             6: void ConvertMediumRes_640x8Bit(void)
        !             7: {
        !             8: fprintf(stderr,"FIXME: Screen Conversion, Medium Res to 640x8Bit\n");
        !             9: /* FIXME */
        !            10: /*
        !            11:   __asm {
        !            12:     push  ebp
        !            13:     push  edi
        !            14:     push  esi
        !            15:     push  ebx
        !            16: 
        !            17:     xor    edx,edx                  // Clear index for loop
        !            18: 
        !            19:     call  Convert_StartFrame            // Start frame, track palettes
        !            20:     mov    eax,[STScreenStartHorizLine]
        !            21:     mov    [ScrY],eax                // Starting line in ST screen
        !            22:     jmp    ConvertMediumRes_640x8Bit_YLoop
        !            23:   }
        !            24: */
        !            25: }
        !            26: /*
        !            27: NAKED void ConvertMediumRes_640x8Bit_YLoop(void)
        !            28: {
        !            29:   __asm {
        !            30:     // Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen
        !            31:     mov    eax,[ScrY]
        !            32:     mov    eax,STScreenLineOffset[eax*4]      // Offset for this line
        !            33:     add    eax,[STScreenLeftSkipBytes]        // Amount to skip on left hand side
        !            34:     mov    edi,[pSTScreen]              // ST format screen 4-plane 16 colours
        !            35:     add    edi,eax
        !            36:     mov    ebp,[pSTScreenCopy]            // Previous ST format screen
        !            37:     add    ebp,eax
        !            38:     mov    esi,[pPCScreenDest]            // PC format screen, byte per pixel 256 colours
        !            39: 
        !            40:     call  AdjustLinePaletteRemap          // Change palette table, DO NOT corrupt edx,edi,esi or ebp!
        !            41:     test  eax,0x00030000
        !            42:     je    Line_ConvertLowRes_640x8Bit        // resolution change(MUST be first)
        !            43:     jmp    Line_ConvertMediumRes_640x8Bit      // 0 palette same, can do check tests
        !            44:   }
        !            45: }
        !            46: NAKED void Line_ConvertMediumRes_640x8Bit(void)
        !            47: {
        !            48:   __asm {
        !            49:     mov    eax,[STScreenWidthBytes]        // Amount to draw across
        !            50:     shr    eax,2                  // in 16-pixels(4 bytes)
        !            51:     mov    [ScrX],eax
        !            52: x_loop:
        !            53: #ifdef TEST_SCREEN_UPDATE
        !            54:     mov    BYTE PTR [esi+0],0
        !            55:     mov    BYTE PTR [esi+2],0
        !            56:     mov    BYTE PTR [esi+4],0
        !            57:     mov    BYTE PTR [esi+6],0
        !            58:     mov    BYTE PTR [esi+8],0
        !            59:     mov    BYTE PTR [esi+10],0
        !            60:     mov    BYTE PTR [esi+12],0
        !            61:     mov    BYTE PTR [esi+14],0
        !            62: #endif  //TEST_SCREEN_UPDATE
        !            63: 
        !            64:     // Do 16 pixels at one time
        !            65:     mov    ebx,[edi]
        !            66:     // Full update? or just test changes?
        !            67:     test  [ScrUpdateFlag],0xe0000000
        !            68:     jne    copy_word                // Force
        !            69:     // Does differ?
        !            70:     cmp    ebx,[ebp]
        !            71:     je    next_word                // Pixels are same as last frame, so ignore
        !            72: 
        !            73: copy_word:
        !            74:     mov    [bScreenContentsChanged],TRUE
        !            75: 
        !            76:     // Plot in 'wrong-order', as ebx is 68000 endian
        !            77:     push  ebp
        !            78:     cmp    [bScrDoubleY],TRUE            // Double on Y?
        !            79:     je    double_y
        !            80: 
        !            81:     MED_BUILD_PIXELS_0                // Generate 'ecx' as pixels [4,5,6,7]
        !            82:     PLOT_MED_640_8BIT(4)
        !            83:     MED_BUILD_PIXELS_1                // Generate 'ecx' as pixels [12,13,14,15]
        !            84:     PLOT_MED_640_8BIT(12)
        !            85:     MED_BUILD_PIXELS_2                // Generate 'ecx' as pixels [0,1,2,3]
        !            86:     PLOT_MED_640_8BIT(0)
        !            87:     MED_BUILD_PIXELS_3                // Generate 'ecx' as pixels [8,9,10,11]
        !            88:     PLOT_MED_640_8BIT(8)
        !            89: 
        !            90:     jmp    done_word
        !            91: 
        !            92: double_y:
        !            93:     push  ebp
        !            94:     mov    ebp,[PCScreenBytesPerLine]
        !            95:     MED_BUILD_PIXELS_0                // Generate 'ecx' as pixels [4,5,6,7]
        !            96:     PLOT_MED_640_8BIT_DOUBLE_Y(4)
        !            97:     MED_BUILD_PIXELS_1                // Generate 'ecx' as pixels [12,13,14,15]
        !            98:     PLOT_MED_640_8BIT_DOUBLE_Y(12)
        !            99:     MED_BUILD_PIXELS_2                // Generate 'ecx' as pixels [0,1,2,3]
        !           100:     PLOT_MED_640_8BIT_DOUBLE_Y(0)
        !           101:     MED_BUILD_PIXELS_3                // Generate 'ecx' as pixels [8,9,10,11]
        !           102:     PLOT_MED_640_8BIT_DOUBLE_Y(8)
        !           103:     pop    ebp
        !           104: done_word:
        !           105: 
        !           106:     pop    ebp
        !           107: 
        !           108: next_word:
        !           109:     add    esi,16                  // Next PC pixels
        !           110:     add    edi,4                  // Next ST pixels
        !           111:     add    ebp,4                  // Next ST copy pixels
        !           112: 
        !           113:     dec    [ScrX]
        !           114:     jne    x_loop                  // Loop on X
        !           115: 
        !           116:     mov    eax,[pPCScreenDest]
        !           117:     add    eax,[PCScreenBytesPerLine]        // Offset to next line
        !           118:     add    eax,[PCScreenBytesPerLine]
        !           119:     mov    [pPCScreenDest],eax
        !           120: 
        !           121:     inc    [ScrY]
        !           122:     mov    eax,[STScreenEndHorizLine]
        !           123:     cmp    [ScrY],eax
        !           124:     jne    ConvertMediumRes_640x8Bit_YLoop      // And on Y
        !           125: 
        !           126:     pop    ebx
        !           127:     pop    esi
        !           128:     pop    edi
        !           129:     pop    ebp
        !           130: 
        !           131:     ret
        !           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.