汇编语言 如何显示数字
assume cs:codecode segment
mov ax,0b800h
mov es,ax
mov al,52
mov es:,al
go:
jmp go
mov ax,4c00h
int 21h
code ends
end
如何显示 52这个数字 本帖最后由 ソ孤单背影 于 2013-11-7 22:22 编辑
assume cs:code ds:data
code segment
start:
mov ax,0b800h
mov es,ax
mov al,35h;35h是5的ASCII值
mov es:,ax
mov al,32h;32h是2的ASCII值
mov es:,ax
mov ax,4c00h
int 21h
code ends
end start
也可以如下:
assume cs:code ds:data
data segment db '52'data ends
data ends
code segment
start:
mov ax,data
mov ds,ax
mov ax,0b800h
mov es,ax
mov bx,0
mov si,0
mov cx,2
s:
mov al,
mov es:,ax ;(低字节存储字符的AscII码,高字节存储字符的属性)
inc bx
add si,2
loop s
mov ax,4c00h
int 21h
code ends
end start
code segment
assume cs:code
main proc far
satart:
movbx,0
da1:
mov ah,01h
int 21h
cmp al,0dh
jz nextd
mov ah,0
sub al,30
xchgax,bx
movcx,10
mul cx
add ax,bx
jmp da1
nextd:
mov dl,13
mov ah ,2
int21h
movdl,10
mov ah,2
int 21h
mov ah,4ch
int 21h
main endp
code ends
end satart
汇编语言不能直接显示数字,但是可以直接显示一个ascii码,所以你要心事数字52,就要先得到5的ascii码'5',并显示;再得到2的ascii码‘2’再显示。
页:
[1]