باید از byte ptr استفاده میکردین راه آسونتر 8 بار شیفت میدادین بعد اگر کری 1 بود یکی به کانتر اضافه میکردین
#include <iostream>
using namespace std;
void main()
{
int a,b=0;
cout << "Insert a number(0 to 255): ";
cin >> a;
for(int i=0;i<8;i++)
{
_asm{
mov al,byte ptr a
mov bl,1
and bl,al
add byte ptr b, bl
}
a/=2;
}
cout<<"Your number in Binary has "<<b<<" digit 1.\n";
}
موفق باشی