|
|
1.1.1.2 ! root 1: /* Screen Conversion, Spec512 to 320x16Bit */ 1.1 root 2: 3: void ConvertSpec512_320x16Bit(void) 4: { 1.1.1.2 ! root 5: Uint32 *edi, *ebp; ! 6: Uint16 *esi; ! 7: register Uint32 eax, ebx, ecx, edx; ! 8: ! 9: Spec512_StartFrame(); /* Start frame, track palettes */ ! 10: ! 11: edx = 0; /* Clear index for loop */ ! 12: ! 13: ScrY = STScreenStartHorizLine; /* Starting line in ST screen */ 1.1 root 14: /* 15: 16: call Spec512_StartFrame // Start frame, track palettes 17: 18: xor edx,edx // Clear index for loop 19: 20: mov eax,[STScreenStartHorizLine] 21: mov [ScrY],eax // Starting line in ST screen 22: jmp ConvertSpec512_320x16Bit_YLoop 23: } 24: } 25: /* 26: NAKED void ConvertSpec512_320x16Bit_YLoop(void) 27: { 1.1.1.2 ! root 28: */ ! 29: ! 30: do /* y-loop */ ! 31: { ! 32: ! 33: Spec512_StartScanLine(); /* Build up palettes for every 4 pixels, store in 'ScanLinePalettes' */ ! 34: edx = 0; /* Clear index for loop */ ! 35: ! 36: /* Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen */ ! 37: eax = STScreenLineOffset[ScrY] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */ ! 38: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colours */ ! 39: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */ ! 40: esi = (Uint16 *)pPCScreenDest; /* PC format screen */ ! 41: /* 1.1 root 42: 43: // Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen 44: mov eax,[ScrY] 45: mov eax,STScreenLineOffset[eax*4] // Offset for this line 46: add eax,[STScreenLeftSkipBytes] // Amount to skip on left hand side 47: mov edi,[pSTScreen] // ST format screen 4-plane 16 colours 48: add edi,eax 49: mov ebp,[pSTScreenCopy] // Previous ST format screen 50: add ebp,eax 51: mov esi,[pPCScreenDest] // PC format screen, byte per pixel 256 colours 1.1.1.2 ! root 52: */ ! 53: /* 1.1 root 54: jmp Line_ConvertSpec512_320x16Bit 55: } 56: } 57: 58: NAKED void Line_ConvertSpec512_320x16Bit(void) 59: { 1.1.1.2 ! root 60: */ ! 61: ! 62: /* 1.1 root 63: mov eax,[STScreenWidthBytes] // Amount to draw across 64: shr eax,3 // in 16-pixels(8 bytes) 65: mov [ScrX],eax 1.1.1.2 ! root 66: */ ! 67: ScrX=STScreenWidthBytes>>3; /* Amount to draw across in 16-pixels (8 bytes) */ ! 68: ! 69: do /* x-loop */ ! 70: { ! 71: ebx = *edi; /* Do 16 pixels at one time */ ! 72: ecx = *(edi+1); ! 73: /* 1.1 root 74: x_loop: 75: // Do 16 pixels at one time 76: mov ebx,[edi] 77: mov ecx,4[edi] 1.1.1.2 ! root 78: */ 1.1 root 79: 1.1.1.2 ! root 80: /* Convert planes to byte indices - as works in wrong order store to workspace so can read back in order! */ ! 81: LOW_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 82: PixelWorkspace[1] = ecx; ! 83: LOW_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 84: PixelWorkspace[3] = ecx; ! 85: LOW_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 86: PixelWorkspace[0] = ecx; ! 87: LOW_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 88: PixelWorkspace[2] = ecx; ! 89: ! 90: /* And plot, the Spec512 is offset by 1 pixel and works on 'chunks' of 4 pixels */ ! 91: /* So, we plot 1_4_4_3 to give 16 pixels, changing palette between */ ! 92: /* (last one is used for first of next 16-pixels) */ ! 93: ecx = PixelWorkspace[0]; ! 94: PLOT_SPEC512_LEFT_LOW_320_16BIT(0) ; ! 95: Spec512_UpdatePaletteSpan(); ! 96: /*mov ecx,[PixelWorkspace+1]*/ ! 97: ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+1 ); /* FIXME: I guess this will not work on some non-Intel architectures - Thothy */ ! 98: PLOT_SPEC512_MID_320_16BIT(1) ; ! 99: Spec512_UpdatePaletteSpan(); ! 100: /*mov ecx,[PixelWorkspace+5]*/ ! 101: ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+5 ); ! 102: PLOT_SPEC512_MID_320_16BIT(5) ; ! 103: Spec512_UpdatePaletteSpan(); ! 104: /*mov ecx,[PixelWorkspace+9]*/ ! 105: ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+9 ); ! 106: PLOT_SPEC512_MID_320_16BIT(9) ; ! 107: Spec512_UpdatePaletteSpan(); ! 108: /*mov ecx,[PixelWorkspace+13]*/ ! 109: ecx = *(Uint32 *)( ((Uint8 *)PixelWorkspace)+13 ); ! 110: PLOT_SPEC512_END_LOW_320_16BIT(13) ; 1.1 root 111: 1.1.1.2 ! root 112: /* 1.1 root 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 1.1.1.2 ! root 119: */ ! 120: esi += 16; /* Next PC pixels */ ! 121: edi += 2; /* Next ST pixels */ ! 122: ebp += 2; /* Next ST copy pixels */ ! 123: } ! 124: while( --ScrX ); /* Loop on X */ 1.1 root 125: 1.1.1.2 ! root 126: Spec512_EndScanLine(); 1.1 root 127: 1.1.1.2 ! root 128: pPCScreenDest = (void *)(((unsigned char *)pPCScreenDest)+PCScreenBytesPerLine); /* Offset to next line */ ! 129: ScrY += 1; ! 130: } ! 131: while( ScrY < STScreenEndHorizLine ); /* Loop on Y */ ! 132: ! 133: bScreenContentsChanged = TRUE; ! 134: /* 1.1 root 135: mov eax,[pPCScreenDest] 136: add eax,[PCScreenBytesPerLine] // Offset to next line 137: mov [pPCScreenDest],eax 138: 139: inc [ScrY] 140: mov eax,[STScreenEndHorizLine] 141: cmp [ScrY],eax 142: jne ConvertSpec512_320x16Bit_YLoop // And on Y 143: 144: mov [bScreenContentsChanged],TRUE 1.1.1.2 ! root 145: */ 1.1 root 146: 147: } 1.1.1.2 ! root 148:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.