#include "stdafx.h"
#include <cstdlib>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
short X;
short Y;
long count = 0;
cout << "Podschet par (X,Y) iz [-128..127] and (|X|-|Y|) mod 4 = 0" << endl;
__asm {
mov word ptr X, -128
vnesh:
mov cx, 256
mov word ptr Y, -128
vnutr:
mov ax, word ptr X
test ax, ax
jns x_uzheplus
neg ax
x_uzheplus :
mov dx, word ptr Y
test dx, dx
jns y_uzheplus
neg dx
y_uzheplus :
sub ax, dx
test ax, 3
jnz nepodhod
inc dword ptr count
nepodhod:
inc word ptr Y
loop vnutr
inc word ptr X
cmp word ptr X, 127
jle vnesh
}
cout << hex << count << endl;
cout << "count " << dec << count << endl;
system("pause");
return 0;
}