|
|
1.1.1.2 ! root 1: /* Screen Conversion, Medium Res to 640x16Bit */ 1.1 root 2: 3: void ConvertMediumRes_640x16Bit(void) 4: { 1.1.1.2 ! root 5: Uint32 *edi, *ebp; ! 6: Uint16 *esi; ! 7: register Uint32 eax, ebx, ecx, edx; ! 8: ! 9: edx=0; ! 10: ! 11: Convert_StartFrame(); /* Start frame, track palettes */ ! 12: ScrY = STScreenStartHorizLine; /* Starting line in ST screen */ ! 13: ! 14: do /* y-loop */ ! 15: { 1.1 root 16: /* 17: NAKED void ConvertMediumRes_640x16Bit_YLoop(void) 18: { 1.1.1.2 ! root 19: */ ! 20: ! 21: eax = STScreenLineOffset[ScrY] + STScreenLeftSkipBytes; /* Offset for this line + Amount to skip on left hand side */ ! 22: edi = (Uint32 *)((Uint8 *)pSTScreen + eax); /* ST format screen 4-plane 16 colours */ ! 23: ebp = (Uint32 *)((Uint8 *)pSTScreenCopy + eax); /* Previous ST format screen */ ! 24: esi = (Uint16 *)pPCScreenDest; /* PC format screen */ ! 25: /* 1.1 root 26: // Get screen addresses, 'edi'-ST screen, 'ebp'-Previous ST screen, 'esi'-PC screen 27: mov eax,[ScrY] 28: mov eax,STScreenLineOffset[eax*4] // Offset for this line 29: add eax,[STScreenLeftSkipBytes] // Amount to skip on left hand side 30: mov edi,[pSTScreen] // ST format screen 4-plane 16 colours 31: add edi,eax 32: mov ebp,[pSTScreenCopy] // Previous ST format screen 33: add ebp,eax 34: mov esi,[pPCScreenDest] // PC format screen, byte per pixel 256 colours 1.1.1.2 ! root 35: */ 1.1 root 36: 1.1.1.2 ! root 37: if( AdjustLinePaletteRemap() & 0x00030000 ) /* Change palette table */ ! 38: /*???goto Line_ConvertLowRes_640x16Bit*/; ! 39: /* 1.1 root 40: call AdjustLinePaletteRemap // Change palette table, DO NOT corrupt edx,edi,esi or ebp! 41: test eax,0x00030000 42: je Line_ConvertLowRes_640x16Bit // resolution change(MUST be first) 43: jmp Line_ConvertMediumRes_640x16Bit // 0 palette same, can do check tests 44: } 45: } 46: NAKED void Line_ConvertMediumRes_640x16Bit(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 1.1.1.2 ! root 52: */ ! 53: ScrX=STScreenWidthBytes>>2; /* Amount to draw across in 16-pixels (4 bytes) */ ! 54: ! 55: ! 56: do /* x-loop */ ! 57: { ! 58: ! 59: /* 1.1 root 60: x_loop: 61: #ifdef TEST_SCREEN_UPDATE 62: mov WORD PTR [esi+0],0 63: mov WORD PTR [esi+4],0 64: mov WORD PTR [esi+8],0 65: mov WORD PTR [esi+12],0 66: mov WORD PTR [esi+16],0 67: mov WORD PTR [esi+20],0 68: mov WORD PTR [esi+24],0 69: mov WORD PTR [esi+28],0 70: #endif //TEST_SCREEN_UPDATE 1.1.1.2 ! root 71: */ ! 72: ! 73: ! 74: /* Do 16 pixels at one time */ ! 75: ebx=*edi; ! 76: /* ScrUpdateFlag seems not to be set correctly?! - Thothy */ ! 77: if( 1||(ScrUpdateFlag&0xe0000000) || ebx!=*ebp ) /* Does differ? */ ! 78: { /* copy word */ 1.1 root 79: 1.1.1.2 ! root 80: /* 1.1 root 81: // Do 16 pixels at one time 82: mov ebx,[edi] 83: // Full update? or just test changes? 84: test [ScrUpdateFlag],0xe0000000 85: jne copy_word // Force 86: // Does differ? 87: cmp ebx,[ebp] 88: je next_word // Pixels are same as last frame, so ignore 89: 90: copy_word: 91: mov [bScreenContentsChanged],TRUE 1.1.1.2 ! root 92: */ ! 93: ! 94: bScreenContentsChanged=TRUE; 1.1 root 95: 96: 1.1.1.2 ! root 97: #if SDL_BYTEORDER == SDL_BIG_ENDIAN ! 98: /* Plot in 'right-order' on big endian systems */ ! 99: if( !bScrDoubleY ) /* Double on Y? */ ! 100: { ! 101: MED_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 102: PLOT_MED_640_16BIT(12) ; ! 103: MED_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 104: PLOT_MED_640_16BIT(4) ; ! 105: MED_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 106: PLOT_MED_640_16BIT(8) ; ! 107: MED_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 108: PLOT_MED_640_16BIT(0) ; ! 109: } ! 110: else ! 111: { ! 112: Uint32 *save_ebp; ! 113: save_ebp = ebp; ! 114: ebp = (Uint32 *)PCScreenBytesPerLine; ! 115: MED_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 116: PLOT_MED_640_16BIT_DOUBLE_Y(12) ; ! 117: MED_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 118: PLOT_MED_640_16BIT_DOUBLE_Y(4) ; ! 119: MED_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 120: PLOT_MED_640_16BIT_DOUBLE_Y(8) ; ! 121: MED_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 122: PLOT_MED_640_16BIT_DOUBLE_Y(0) ; ! 123: ebp = save_ebp; ! 124: } ! 125: #else ! 126: /* Plot in 'wrong-order', as ebx is 68000 endian */ ! 127: if( !bScrDoubleY ) /* Double on Y? */ ! 128: { ! 129: MED_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 130: PLOT_MED_640_16BIT(4) ; ! 131: MED_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 132: PLOT_MED_640_16BIT(12) ; ! 133: MED_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 134: PLOT_MED_640_16BIT(0) ; ! 135: MED_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 136: PLOT_MED_640_16BIT(8) ; ! 137: } ! 138: else ! 139: { ! 140: Uint32 *save_ebp; ! 141: save_ebp = ebp; ! 142: ebp = (Uint32 *) PCScreenBytesPerLine; ! 143: MED_BUILD_PIXELS_0 ; /* Generate 'ecx' as pixels [4,5,6,7] */ ! 144: PLOT_MED_640_16BIT_DOUBLE_Y(4) ; ! 145: MED_BUILD_PIXELS_1 ; /* Generate 'ecx' as pixels [12,13,14,15] */ ! 146: PLOT_MED_640_16BIT_DOUBLE_Y(12) ; ! 147: MED_BUILD_PIXELS_2 ; /* Generate 'ecx' as pixels [0,1,2,3] */ ! 148: PLOT_MED_640_16BIT_DOUBLE_Y(0) ; ! 149: MED_BUILD_PIXELS_3 ; /* Generate 'ecx' as pixels [8,9,10,11] */ ! 150: PLOT_MED_640_16BIT_DOUBLE_Y(8) ; ! 151: ebp = save_ebp; ! 152: } ! 153: #endif ! 154: } ! 155: ! 156: esi += 16; /* Next PC pixels */ ! 157: edi += 1; /* Next ST pixels */ ! 158: ebp += 1; /* Next ST copy pixels */ ! 159: } ! 160: while( --ScrX ); /* Loop on X */ ! 161: /* 1.1 root 162: next_word: 163: add esi,16*2 // Next PC pixels 164: add edi,4 // Next ST pixels 165: add ebp,4 // Next ST copy pixels 166: 167: dec [ScrX] 168: jne x_loop // Loop on X 1.1.1.2 ! root 169: */ 1.1 root 170: 1.1.1.2 ! root 171: pPCScreenDest = (void *)(((unsigned char *)pPCScreenDest)+PCScreenBytesPerLine*2); /* Offset to next line */ ! 172: ScrY += 1; ! 173: } ! 174: while( ScrY < STScreenEndHorizLine ); /* Loop on Y */ ! 175: /* 1.1 root 176: mov eax,[pPCScreenDest] 177: add eax,[PCScreenBytesPerLine] // Offset to next line 178: add eax,[PCScreenBytesPerLine] 179: mov [pPCScreenDest],eax 180: 181: inc [ScrY] 182: mov eax,[STScreenEndHorizLine] 183: cmp [ScrY],eax 184: jne ConvertMediumRes_640x16Bit_YLoop // And on Y 185: 186: pop ebx 187: pop esi 188: pop edi 189: pop ebp 190: 191: ret 192: } 193: */ 1.1.1.2 ! root 194: ! 195: } ! 196:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.