diff --git a/code/blitblit.h b/code/blitblit.h index 6a3165a0..4fdd1ea9 100644 --- a/code/blitblit.h +++ b/code/blitblit.h @@ -2328,9 +2328,8 @@ inline void BlitTrans::BlitForward(void * dest, void const * sour mov ecx,[len] dec edi inc ecx - } -again: - __asm { + + again: dec ecx jz fini mov al,[esi] @@ -2340,8 +2339,9 @@ inline void BlitTrans::BlitForward(void * dest, void const * sour jz again mov [edi],al jmp again + + fini: } -fini:; } @@ -2358,9 +2358,8 @@ inline void BlitTransXlat::BlitForward(void * dest, void const * sub edi,2 mov esi,[source] xor eax,eax - } -again: - __asm { + + again: dec ecx jz over add edi,2 @@ -2371,8 +2370,9 @@ inline void BlitTransXlat::BlitForward(void * dest, void const * mov dx,[ebx+eax*2] mov [edi],dx jmp again + + over: } -over:; } @@ -2390,14 +2390,12 @@ inline void BlitTransRemapXlat::BlitForward(void * dest, void co mov ebx,[remapper] mov edx,[translator] xor eax,eax - } + again: /* ** This block is 11 cycles per pixel, if not transparent, and 5 ** cycles per pixel, if transparent. */ -again: - __asm { dec ecx jz over add edi,2 @@ -2409,8 +2407,9 @@ inline void BlitTransRemapXlat::BlitForward(void * dest, void co mov ax,[edx+eax*2] // Second remap step (8 bit to 16 bit). mov [edi],ax jmp again + + over: } -over:; } diff --git a/code/lcw.cpp b/code/lcw.cpp index 777a5afa..85e10710 100644 --- a/code/lcw.cpp +++ b/code/lcw.cpp @@ -241,16 +241,13 @@ int LCW_Comp(void const * source, void * dest, int datasize) stosb //; write out a len of 1 lodsb //; get the byte stosb //; save it - } -loopstart: - __asm { + loopstart: mov [ndest],edi //; save offset of compressed data mov edi,[a1stsrc] //; get the offset to the first byte of data mov [count],1 //; set the count of run to 0 - } -searchloop: - __asm { + + searchloop: sub eax,eax mov al,[esi] //; get the current byte of data cmp al,[esi+64] @@ -284,14 +281,12 @@ int LCW_Comp(void const * source, void * dest, int datasize) mov [ndest],edi //; save offset of compressed data mov edi,ebx jmp searchloop - } -notlongenough: - __asm { + + notlongenough: mov edi,ebx - } -notrunlength: -oploop: - __asm { + + notrunlength: + oploop: mov ecx,esi //; get the address of the last byte +1 sub ecx,edi //; get the total number of bytes left to comp jz short searchdone @@ -316,9 +311,8 @@ int LCW_Comp(void const * source, void * dest, int datasize) jne short notend //; if found mismatch then di - bx = match count inc edi //; else cx = 0 and di + 1 - bx = match count - } -notend: - __asm { + + notend: mov esi,edx //; restore si mov eax,edi //; get the dest sub eax,ebx //; sub the start for total bytes that match @@ -330,9 +324,8 @@ int LCW_Comp(void const * source, void * dest, int datasize) dec ebx //; back it up for the actual match offset mov [matchoff],ebx //; save the offset for later jmp searchloop //; loop until we searched it all - } -searchdone: - __asm { + + searchdone: mov ecx,[count] //; get the count of the longest run mov edi,[ndest] //; get the offset of our compressed data cmp ecx,2 //; see if its not enough run to matter @@ -345,9 +338,8 @@ int LCW_Comp(void const * source, void * dest, int datasize) sub eax,[matchoff] //; sub the offset of the match cmp eax,0FFFh //; if its less than 12 bits its a short ja short medrun //; if its not, its a medium - } -//shortrun: - __asm { + + //shortrun: sub ebx,ebx mov bl,cl //; get the length (3-10) sub bl,3 //; sub 3 for a 3 bit number 0-7 @@ -355,9 +347,8 @@ int LCW_Comp(void const * source, void * dest, int datasize) add ah,bl //; add in the length for the high nibble xchg ah,al //; reverse the bytes for a word store jmp short srunnxt //; do the run fixup code - } -medrun: - __asm { + + medrun: cmp ecx,64 //; see if its a short run ja short longrun //; if not, oh well at least its long @@ -366,66 +357,57 @@ int LCW_Comp(void const * source, void * dest, int datasize) mov al,cl //; put it in al for the stosb stosb //; store it jmp short medrunnxt //; do the run fixup code - } -lenin: - __asm { + + lenin: cmp [inlen],0 //; is it doing a length? // cmp [DWORD PTR inlen],0 //; is it doing a length? jnz short len //; if so, skip code - } -lenin1: - __asm { + + lenin1: mov [lenoff],edi //; save the length code offset mov al,80h //; set the length to 0 stosb //; save it - } -len: - __asm { + + len: mov ebx,[lenoff] //; get the offset of the length code - cmp [ebx],0BFh //; see if its maxed out + cmp byte ptr [ebx],0BFh //; see if its maxed out // cmp [BYTE PTR ebx],0BFh //; see if its maxed out je lenin1 //; if so put out a new len code - } -//stolen: - __asm { - inc [ebx] //; inc the count code + + //stolen: + inc byte ptr [ebx] //; inc the count code // inc [BYTE PTR ebx] //; inc the count code lodsb //; get the byte stosb //; store it mov [inlen],1 //; we are now in a length so save it // mov [DWORD PTR inlen],1 //; we are now in a length so save it jmp short nxt //; do the next code - } -longrun: - __asm { + + longrun: mov al,0ffh //; its a long so set a code of FF stosb //; store it mov eax,[count] //; send out the count stosw //; store it - } -medrunnxt: - __asm { + + medrunnxt: mov eax,[matchoff] //; get the offset sub eax,[a1stsrc] //; make it relative tot he start of data - } -srunnxt: - __asm { + + srunnxt: stosw //; store it //; this code common to all runs add esi,[count] //; add in the length of the run to the source mov [inlen],0 //; set the in leght flag to false // mov [DWORD PTR inlen],0 //; set the in leght flag to false - } -nxt: - __asm { + + nxt: cmp esi,[end_of_data] //; see if we did the whole pic jae short outofhere //; if so, cool! were done jmp loopstart - } -outofhere: - __asm { + + outofhere: mov ax,080h //; remember to send an end of data code stosb //; store it mov eax,edi //; get the last compressed address @@ -436,4 +418,3 @@ int LCW_Comp(void const * source, void * dest, int datasize) return(retval); } #endif - diff --git a/code/winasm.asm b/code/winasm.asm index 281bb787..f02ccaed 100644 --- a/code/winasm.asm +++ b/code/winasm.asm @@ -983,8 +983,8 @@ Draw_Voxel_Regular_Normals_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] xor ecx, ecx mov cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1112,8 +1112,8 @@ Draw_Voxel_Reverse_Normals_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] xor ecx, ecx mov cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1242,8 +1242,8 @@ Draw_Voxel_Regular_Lighting_Normals_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] xor ecx, ecx mov cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1375,8 +1375,8 @@ Draw_Voxel_Reverse_Lighting_Normals_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] xor ecx, ecx mov cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1508,8 +1508,8 @@ Draw_Voxel_Regular_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] mov ecx, 0FFh sub cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1636,8 +1636,8 @@ Draw_Voxel_Reverse_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] mov ecx, 0FFh sub cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1764,8 +1764,8 @@ Draw_Voxel_Regular_UNUSED_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] mov ecx, 0FFh sub cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -1893,8 +1893,8 @@ Draw_Voxel_Reverse_UNUSED_ASM proc C uses esi edi ebx ecx edx \ mov esi, arg1 push ebp - movsx ebp, [esi + TRANSFORM_COMPONENT(3,I)] - movsx edx, [esi + TRANSFORM_COMPONENT(3,J)] + movsx ebp, WORD PTR [esi + TRANSFORM_COMPONENT(3,I)] + movsx edx, WORD PTR [esi + TRANSFORM_COMPONENT(3,J)] mov ecx, 0FFh sub cl, [esi].ZSize mov edi, offset VoxelPixelDeltaTable @@ -2024,6 +2024,7 @@ _Int3 endp ;endp + _TEXT$mmx ends _TEXT$mycode segment page public use32 'CODE' ; segment mycode page public use32 'code' ; Need stricter segment alignment public C Asm_Interpolate @@ -2250,13 +2251,14 @@ Asm_Interpolate_Line_Double endp ;ends + _TEXT$mycode ends .data;dataseg TopLine dd 640 dup (?) BottomLine dd 640 dup (?) LineBuffer dd 640 dup (?) - .code _TEXT$mycode ; segment mycode page public use32 'code' ; Need stricter segment alignment + _TEXT$mycode segment page public use32 'CODE' ; segment mycode page public use32 'code' ; Need stricter segment alignment Interpolate_Single_Line proc near \ @@ -2531,4 +2533,6 @@ Asm_Create_Palette_Interpolation_Table proc near Asm_Create_Palette_Interpolation_Table endp + _TEXT$mycode ends + end diff --git a/code/xsurface.cpp b/code/xsurface.cpp index 1d299669..9c834b81 100644 --- a/code/xsurface.cpp +++ b/code/xsurface.cpp @@ -811,12 +811,12 @@ static void *surface_quick_fill(void *buf, int count, int color) mov edi, [buf] cmp ecx, 0 - jle short $end + jle short fill_end mov eax, [color] rep stosd - $end: + fill_end: mov eax, edi pop edi /// Bug fixed in TS but not in ShapeSet }