我用这段代码,但是在结果输不出来,请高手指教!
stack segment
;
stack ends
dataq segment
data DW 70 DUP(1),2,3,4,5,6,7,8,9,11,12,20 DUP(7)
dataq ends
program segment
main proc far
assume cs:program,ss:stack,ds:dataq
start:
push ds
sub ax,ax
push ax
begin: lea bx,data
push bx
mov cx,100
rotate2: mov ax,[bx]
add bx,2
test ax,01h
loopnz rotate2
jnz stop
jcxz stop2
rotate3: mov dx,[bx]
add bx,2
test dx,01h
loopnz rotate3
jnz stop
jcxz stop2
cmp ax,dx
jb rotate3
mov ax,dx
jmp rotate3
mov ch,2
mov cl,4
stop2: rol ax,cl
mov ah,2
int 21h
dec ch
jnz stop2
stop: jmp begin
stop1: ret
main endp
program ends
end start
汇编语言
------解决方案--------------------
忘了加载DS
mov ax,dataq
mov ds,ax
test ax,1
只有ax为零才相等
loopnz rotate2
jnz stop
stop: jmp begin
这3句死循环
写个显示函数
显示al中的值
display:
push ax ;保护现场
push cx
push dx
mov dh,al ;暂时存放al的值
mov ch,2
mov cl,4
shr al,cl ;先显示高位