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

1.1     ! root        1: // Screen Conversion, Spec512 to 640x16Bit
        !             2: 
        !             3: void ConvertSpec512_640x16Bit_YLoop(void);
        !             4: void Line_ConvertSpec512_640x16Bit(void);
        !             5: 
        !             6: void ConvertSpec512_640x16Bit(void)
        !             7: {
        !             8: fprintf(stderr,"FIXME: Screen Conversion, Spec512 to 640x16Bit\n");
        !             9: /* FIXME */
        !            10: /*
        !            11:   __asm {
        !            12:     push  ebp
        !            13:     push  edi
        !            14:     push  esi
        !            15:     push  ebx
        !            16: 
        !            17:     call  Spec512_StartFrame            // Start frame, track palettes
        !            18: 
        !            19:     xor    edx,edx                  // Clear index for loop
        !            20: 
        !            21:     mov    eax,[STScreenStartHorizLine]
        !            22:     mov    [ScrY],eax                // Starting line in ST screen
        !            23:     jmp    ConvertSpec512_640x16Bit_YLoop
        !            24:   }
        !            25: */
        !            26: }
        !            27: /*
        !            28: NAKED void ConvertSpec512_640x16Bit_YLoop(void)
        !            29: {
        !            30:   __asm {
        !            31:     call  Spec512_StartScanLine          // Build up palettes for every 4 pixels, store in 'ScanLinePalettes'
        !            32:     xor    edx,edx                  // Clear index for loop
        !            33: 
        !            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:     jmp    Line_ConvertSpec512_640x16Bit
        !            45:   }
        !            46: }
        !            47: NAKED void Line_ConvertSpec512_640x16Bit(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: 
        !            55:     // Do 16 pixels at one time
        !            56:     mov    ebx,[edi]
        !            57:     mov    ecx,4[edi]
        !            58: 
        !            59:     // Convert planes to byte indices - as works in wrong order store to workspace so can read back in order!
        !            60:     LOW_BUILD_PIXELS_0                // Generate 'ecx' as pixels [4,5,6,7]
        !            61:     mov    [PixelWorkspace+4],ecx
        !            62:     LOW_BUILD_PIXELS_1                // Generate 'ecx' as pixels [12,13,14,15]
        !            63:     mov    [PixelWorkspace+12],ecx
        !            64:     LOW_BUILD_PIXELS_2                // Generate 'ecx' as pixels [0,1,2,3]
        !            65:     mov    [PixelWorkspace],ecx
        !            66:     LOW_BUILD_PIXELS_3                // Generate 'ecx' as pixels [8,9,10,11]
        !            67:     mov    [PixelWorkspace+8],ecx
        !            68: 
        !            69:     // Plot in 'wrong-order', as ebx is 68000 endian
        !            70:     push  ebp
        !            71:     cmp    [bScrDoubleY],TRUE            // Double on Y?
        !            72:     je    double_y
        !            73: 
        !            74:     // And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels
        !            75:     // So, we plot 1_4_4_3 to give 16 pixels, changing palette between(last one is used for first of next 16-pixels)
        !            76:     mov    ecx,[PixelWorkspace]
        !            77:     PLOT_SPEC512_LEFT_LOW_640_16BIT(0)
        !            78:     call  Spec512_UpdatePaletteSpan
        !            79:     mov    ecx,[PixelWorkspace+1]
        !            80:     PLOT_SPEC512_MID_640_16BIT(4)
        !            81:     call  Spec512_UpdatePaletteSpan
        !            82:     mov    ecx,[PixelWorkspace+5]
        !            83:     PLOT_SPEC512_MID_640_16BIT(20)
        !            84:     call  Spec512_UpdatePaletteSpan
        !            85:     mov    ecx,[PixelWorkspace+9]
        !            86:     PLOT_SPEC512_MID_640_16BIT(36)
        !            87:     call  Spec512_UpdatePaletteSpan
        !            88:     mov    ecx,[PixelWorkspace+13]
        !            89:     PLOT_SPEC512_END_LOW_640_16BIT(52)
        !            90: 
        !            91:     jmp    done_word
        !            92: 
        !            93: double_y:
        !            94: 
        !            95:     // And plot, 4 pixels at a time each with a new palette
        !            96:     push  ebp
        !            97:     mov    ebp,[PCScreenBytesPerLine]
        !            98:     mov    ecx,[PixelWorkspace]
        !            99:     PLOT_SPEC512_LEFT_LOW_640_16BIT_DOUBLE_Y(0)
        !           100:     call  Spec512_UpdatePaletteSpan
        !           101:     mov    ecx,[PixelWorkspace+1]
        !           102:     PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(4)
        !           103:     call  Spec512_UpdatePaletteSpan
        !           104:     mov    ecx,[PixelWorkspace+5]
        !           105:     PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(20)
        !           106:     call  Spec512_UpdatePaletteSpan
        !           107:     mov    ecx,[PixelWorkspace+9]
        !           108:     PLOT_SPEC512_MID_640_16BIT_DOUBLE_Y(36)
        !           109:     call  Spec512_UpdatePaletteSpan
        !           110:     mov    ecx,[PixelWorkspace+13]
        !           111:     PLOT_SPEC512_END_LOW_640_16BIT_DOUBLE_Y(52)
        !           112:     pop    ebp
        !           113: done_word:
        !           114: 
        !           115:     pop    ebp
        !           116: 
        !           117:     add    esi,16*4                // Next PC pixels
        !           118:     add    edi,8                  // Next ST pixels
        !           119:     add    ebp,8                  // Next ST copy pixels
        !           120: 
        !           121:     dec    [ScrX]
        !           122:     jne    x_loop                  // Loop on X
        !           123: 
        !           124:     call  Spec512_EndScanLine
        !           125: 
        !           126:     mov    eax,[pPCScreenDest]
        !           127:     add    eax,[PCScreenBytesPerLine]        // Offset to next line
        !           128:     add    eax,[PCScreenBytesPerLine]
        !           129:     mov    [pPCScreenDest],eax
        !           130: 
        !           131:     inc    [ScrY]
        !           132:     mov    eax,[STScreenEndHorizLine]
        !           133:     cmp    [ScrY],eax
        !           134:     jne    ConvertSpec512_640x16Bit_YLoop      // And on Y
        !           135: 
        !           136:     mov    [bScreenContentsChanged],TRUE
        !           137: 
        !           138:     pop    ebx
        !           139:     pop    esi
        !           140:     pop    edi
        !           141:     pop    ebp
        !           142: 
        !           143:     ret
        !           144:   }
        !           145: }
        !           146: */

unix.superglobalmegacorp.com

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