SO伙计们,我是这个汇编编程的新手,我很高兴地说实话,因为它提醒我是否使用C编程。现在给我一个任务,其中我必须在给定的位中找到1的数量。以下是我的代码:
MOV AX,06 ; loads AL with 6
MOV CX,08H ; counter for iterations
MOV BX,00H ; counter to add when 1 is obtained in CF
RCR AX,08H; rotates AX 8 times
HERE:
JC Carry; will work if there is 1 is CF
Carry: INC BX; this will add 1 into BL
LOOP HERE
HLT
我的逻辑正确吗?