View Single Post
Old 6th November 2019, 11:43   #1  |  Link
bassquake
Registered User
 
Join Date: Jan 2007
Posts: 45
How do I move inline assembly to external file?

I'm currently recompiling virtualdub plugins and need to move the inline assembly code to an external asm file but I dont know how to call it in the cpp.

As an example, here's a very simple bit of inline code:

Code:
void LUT_iSSE (Pixel32 *dst,int *LUT,int psize)
{
	__asm {
		mov     edi, [dst]
		mov     esi, [LUT]
		mov     ecx, [psize]

		align     16
		GLoop:      mov     eax, [edi]
				xor ebx, ebx
				mov     edx, eax
				mov     bl, ah
				and     edx, 0xff0000
				and eax, 0xff
				shr     edx, 16
				movd    mm0, [esi + eax * 4 + (512 * 4)]
				prefetchnta[edi + 512]
				por     mm0, [esi + ebx * 4 + (256 * 4)]
				por     mm0, [esi + edx * 4]
				movd[edi], mm0
				add     edi, 4
				dec     ecx
				jnz     GLoop
				emms
	}
}
Can someone post what I would put there instead and what the asm file should have in it or point me in the right direction online? I'm guessing Extern "C" is involved somewhere!

Greatly appreciated!
bassquake is offline   Reply With Quote