ax中的内容为什么不能正确显示

clife 2004-04-21 10:33:14
我是想要显示ax中的内容的(用2进制)可只能显示0000000000000000
请问怎么回事
data segment
;
data ends

code segment
assume cs:code,ds:data
start:
mov ax,1234h
mov cl,16
loop1:
shl ax,1
jb is1
jnb is0
is1:
mov dl,'1'
mov ah,2h
int 21h
jmp loop2
is0:
mov dl,'0'
mov ah,2h
int 21h
;
loop2:
dec cl
cmp cl,0
je OK
jmp loop1
OK:
mov ah,4ch
int 21h
code ends
end start
...全文
84 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
紫郢剑侠 2004-04-21
  • 打赏
  • 举报
回复
SAL/SHL - Shift Arithmetic Left / Shift Logical Left

Usage: SAL dest,count
SHL dest,count
Modifies flags: CF OF PF SF ZF (AF undefined)

+-+ +---------------+ +-+
|C|<---+|7 <---------- 0|<---+|0|
+-+ +---------------+ +-+

在程序中由于调用DOS的02子功能显示字符, AH的值会被改为02H, 所以要先保存AH的值.

; COM格式, MASM 5下通过
code segment
org 100h
assume cs:code
start:
mov ax, 1234h
mov cx, 2
mov dh, ah
@do2:
push cx
mov cx,8
@do1:
shl ah,1
push ax
jnc @is0
@is1:
mov dl,'1'
mov ah,2h
int 21h
jmp @while1
@is0:
mov dl,'0'
mov ah,2h
int 21h
;
@while1:
pop ax
loop @do1
mov ah, al
pop cx
@while2:
loop @do2
@OK:
mov ah,4ch
int 21h
code ends
end start
clife 2004-04-21
  • 打赏
  • 举报
回复
呵呵,谢谢两位了
xxhfortrue 2004-04-21
  • 打赏
  • 举报
回复
是我告诉你的(QQ中)
dunkel 2004-04-21
  • 打赏
  • 举报
回复
因为你后面的显示功能部分, 如 mov ah, 02h 等到以及破坏了原来的 ax 中的内容

21,458

社区成员

发帖
与我相关
我的任务
社区描述
汇编语言(Assembly Language)是任何一种用于电子计算机、微处理器、微控制器或其他可编程器件的低级语言,亦称为符号语言。
社区管理员
  • 汇编语言
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧