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

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

unix.superglobalmegacorp.com

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