Annotation of hatari/src/convert/spec320x16.c, revision 1.1.1.1

1.1       root        1: // Screen Conversion, Spec512 to 320x16Bit
                      2: 
                      3: void ConvertSpec512_320x16Bit_YLoop(void);
                      4: void Line_ConvertSpec512_320x16Bit(void);
                      5: 
                      6: void ConvertSpec512_320x16Bit(void)
                      7: {
                      8: fprintf(stderr,"FIXME: Screen Conversion, Spec512 to 320x16Bit\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_320x16Bit_YLoop
                     24:   }
                     25: */
                     26: }
                     27: /*
                     28: NAKED void ConvertSpec512_320x16Bit_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_320x16Bit
                     45:   }
                     46: }
                     47: 
                     48: NAKED void Line_ConvertSpec512_320x16Bit(void)
                     49: {
                     50:   __asm {
                     51:     mov    eax,[STScreenWidthBytes]        // Amount to draw across
                     52:     shr    eax,3                  // in 16-pixels(8 bytes)
                     53:     mov    [ScrX],eax
                     54: x_loop:
                     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:     // And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels
                     70:     // So, we plot 1_4_4_3 to give 16 pixels, changing palette between(last one is used for first of next 16-pixels)
                     71:     mov    ecx,[PixelWorkspace]
                     72:     PLOT_SPEC512_LEFT_LOW_320_16BIT(0)
                     73:     call  Spec512_UpdatePaletteSpan
                     74:     mov    ecx,[PixelWorkspace+1]
                     75:     PLOT_SPEC512_MID_320_16BIT(2)
                     76:     call  Spec512_UpdatePaletteSpan
                     77:     mov    ecx,[PixelWorkspace+5]
                     78:     PLOT_SPEC512_MID_320_16BIT(10)
                     79:     call  Spec512_UpdatePaletteSpan
                     80:     mov    ecx,[PixelWorkspace+9]
                     81:     PLOT_SPEC512_MID_320_16BIT(18)
                     82:     call  Spec512_UpdatePaletteSpan
                     83:     mov    ecx,[PixelWorkspace+13]
                     84:     PLOT_SPEC512_END_LOW_320_16BIT(26)
                     85: 
                     86:     add    esi,16*2                // Next PC pixels
                     87:     add    edi,8                  // Next ST pixels
                     88:     add    ebp,8                  // Next ST copy pixels
                     89: 
                     90:     dec    [ScrX]
                     91:     jne    x_loop                  // Loop on X
                     92: 
                     93:     call  Spec512_EndScanLine
                     94: 
                     95:     mov    eax,[pPCScreenDest]
                     96:     add    eax,[PCScreenBytesPerLine]        // Offset to next line
                     97:     mov    [pPCScreenDest],eax
                     98:     
                     99:     inc    [ScrY]
                    100:     mov    eax,[STScreenEndHorizLine]
                    101:     cmp    [ScrY],eax
                    102:     jne    ConvertSpec512_320x16Bit_YLoop      // And on Y
                    103: 
                    104:     mov    [bScreenContentsChanged],TRUE
                    105: 
                    106:     pop    ebx
                    107:     pop    esi
                    108:     pop    edi
                    109:     pop    ebp
                    110: 
                    111:     ret
                    112:   }
                    113: }
                    114: */

unix.superglobalmegacorp.com

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