September 2017
Beginner to intermediate
290 pages
6h 58m
English
Sometimes we may want a macro instruction or a code fragment to be assembled differently depending on certain conditions. Both MASM and GAS provide this functionality too, but let's get back to FASM (as the most convenient one) and consider the following macro instruction:
macro exordd p1, p2{ if ~p1 in <eax, ebx, ecx, edx, esi, edi, ebp, esp> &\ ~p2 in <eax, ebx, ecx, edx, esi, edi, ebp, esp> push eax mov eax, [p2] xor [p1], eax pop eax else if ~p1 in <eax, ebx, ecx, edx, esi, edi, ebp, esp> xor [p1], p2 else if ~p2 in <eax, ebx, ecx, edx, esi, edi, ebp, esp> xor p1, [p2] else xor p1, p2 end if end if}
It may appear a bit complicated at first, but the purpose of the macro is rather simple. We extend an XOR instruction ...
Read now
Unlock full access