mov eax,? ; 11223344h
mov edi,offset data
.0: call .2
call .1
call .1
.1: bswap eax
.2: call .4
call .3
.3: bswap eax
ror eax,8
.4: call .5
xchg ah,al
.5: stosd ; пишем результат из EAX
ret
data: dd 24 dup(?) ; буфер для записи результа
|
mov eax,? mov cl,D0h .1: cmp ah,al jb .2 xchg ah,al .2: ror eax,cl add cl,8 jnz .1 ror eax,8 ret |
mov eax,? xor ebx,ebx inc ebx .1: rcr eax,1 rcl ebx,1 jnc .1 mov eax,ebx |
mov eax,? mov edx,? mov ecx,4 call .1 jnz .exit push edx,edx mov edx,eax call .0 pop edx,eax jnz .exit .0: mov ecx,2 .1: ror eax,8 ; обнаружение нулевого байта в eax push eax xor eax,edx mov ebx,7EFEFEFFh add ebx,eax not eax xor eax,ebx test eax,81010100h pop eax loopz .1 .exit: ret |
mov rax,?
mov rcx,4
mov rdx,rax
.1: ror rax,8
push rax
xor rax,rdx
mov rbx,7EFEFEFEFEFEFEFFh
add rbx,rax
not rax
xor rax,rbx
test rax,8101010101010100h
pop rax
loopz .1
ret
|
EAX=00011111h EBX=00111101h ECX=1F001100h EDX=03001001h Результат: EAX=1C100010h |
; R = (A^B^C^D)&((A|B)^(C|D)) xor eax,ebx or ebx,eax xor eax,ecx or ecx,edx xor eax,edx xor ebx,ecx and eax,ebx |
; R = ((A^B)|(B^C))&~(A^B^C^D) xor eax,ebx xor ebx,ecx xor edx,eax xor edx,ecx or eax,ebx not edx and eax,edx |
; R = ((A&B)|(C&D))&(A^B^C^D) mov esi,eax xor esi,ebx xor esi,ecx xor esi,edx and eax,ebx and ecx,edx or eax,ecx and eax,esi |
xor a,b xor a,c or b,c not a and a,b |
xor a,b xor a,c or b,a or b,c xor a,b |
mov eax,?
mov edi,offset .buff
test eax,eax
jns .1
neg eax
mov byte [edi],'-'
inc edi
.1: push -'0'
xor ecx,ecx
mov cl,10
.2: cdq
div ecx
push edx
test eax,eax
jnz .2
.3: pop eax
add al,'0'
stosb
jnz .3
ret
.buff db 30 rep(?)
|