一个作业题,看看吧,
4.2把AX中存放的16位二进制数K看作是8个二进制的“四分之一字节”。试编写程序要求数一下值为3(即11B)的四分之一字节数,并将该数(即11B的个数)在终端上显示出来。下面这个代码完成任务。想问一下第二个行不??上机实验不行啊
data segment
sq dw 198
data ends
code segment
assume cs:code
start: mov ax,data
mov ds,ax
mov dl,0
mov cx,8
compare:test ax,03h
jne noequal
inc dl
noequal: ror ax,1
ror ax,1
loop compare
add dl,'0'
mov ah,02h
int 21h
mov ax,4c00h
int 21h
code ends
end start
为何呢这个不行啊?
data segment
sq dw 198
data ends
code segment
assume cs:code
start: mov ax,data
mov ds,ax
mov dl,0
mov cx,8
compare:test ax,03h
jne noequal
inc dl
noequal: ror ax,1
ror ax,1
loop compare
add dl,'0'
mov ah,02h
int 21h
mov ax,4c00h
int 21h
code ends
end start