汇编语言输出ax时为什么要把值放在一个变量里才能正确输出?
汇编语言输出ax时为什么要把值放在一个变量里才能正确输出?
如果把 输出结果 那行的 result 替换成 al, result+1 ah 就不能正确输出,为什么?
data segment
result db ?,?
data ends
code segment
assume cs:code,ds:data
main proc far
start:
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
L:
;初始化数据
mov bh,1
mov bl,1
L1:
mov dl,bh
call output
call mulfun
mov dl,bl
call output
call deng
mov al,bh
mul bl
aam
mov result,al
mov result+1,ah
;输出结果
mov dl,result+1
call output
mov dl,result
call output
call space
inc bl
cmp bl,bh
jna L1
call retxx
mov bl,1
inc bh
cmp bh,9
jna L1
ret
main endp
;输出数
output proc near ;输出
add dl,30h
mov ah,02h
int 21h
ret
output endp
;输出乘号
mulfun proc near
push dx
mov dl,'*'
mov ah,02h
int 21h
pop dx
ret
mulfun endp
;输出等于号
deng proc near
push dx
mov dl,'='
mov ah,02h
int 21h
pop dx
ret
deng endp
;换行
retxx proc near
push dx
mov dl,0ah
int 21h
mov dl,0dh
int 21h
pop dx
ret
retxx endp
;输出空格
space proc near
push dx
mov dl,' '
mov ah,02h
int 21h
pop dx
ret
space endp
code ends
end start
如果把 输出结果 那行的 result 替换成 al, result+1 ah 就不能正确输出,为什么?
如果把 输出结果 那行的 result 替换成 al, result+1 ah 就不能正确输出,为什么?
data segment
result db ?,?
data ends
code segment
assume cs:code,ds:data
main proc far
start:
push ds
xor ax,ax
push ax
mov ax,data
mov ds,ax
L:
;初始化数据
mov bh,1
mov bl,1
L1:
mov dl,bh
call output
call mulfun
mov dl,bl
call output
call deng
mov al,bh
mul bl
aam
mov result,al
mov result+1,ah
;输出结果
mov dl,result+1
call output
mov dl,result
call output
call space
inc bl
cmp bl,bh
jna L1
call retxx
mov bl,1
inc bh
cmp bh,9
jna L1
ret
main endp
;输出数
output proc near ;输出
add dl,30h
mov ah,02h
int 21h
ret
output endp
;输出乘号
mulfun proc near
push dx
mov dl,'*'
mov ah,02h
int 21h
pop dx
ret
mulfun endp
;输出等于号
deng proc near
push dx
mov dl,'='
mov ah,02h
int 21h
pop dx
ret
deng endp
;换行
retxx proc near
push dx
mov dl,0ah
int 21h
mov dl,0dh
int 21h
pop dx
ret
retxx endp
;输出空格
space proc near
push dx
mov dl,' '
mov ah,02h
int 21h
pop dx
ret
space endp
code ends
end start
如果把 输出结果 那行的 result 替换成 al, result+1 ah 就不能正确输出,为什么?
...全文
相关推荐
汇编语言实现输出helloworld
简单的程序,没办法,为了尊重网站吧,谅解哈~
汇编语言判断一个数是否为0
判断一个数是否为0,为负,为正,为0的话输出0,如果为负的话输出-1,如果他为正数的话输出1,通过此程序可以很好好的学习汇编语言
将AX寄存器中的16位数分成4组,每组4位,然后把这四组数分别放在AL、BL、CL和DL中。
将AX寄存器中的16位数分成4组,每组4位,然后把这四组数分别放在AL、BL、CL和DL中。
用汇编语言实现dx,ax双字右移
汇编实现双字右移 汇编实现双字右移汇编实现双字右移汇编实现双字右移汇编实现双字右移汇编实现双字右移
汇编语言在屏幕上输出中文字符
在屏幕上输出中文字符“长春大学”。 code segment assume cs:code, ds:code begin: ;----使文本显示模式扩展为全屏---- mov ax,12h INT 10H ;置图形模式 。。。。。。。。。。。。。 。。。。。。。。。。。。


