主题:汇编的数字输出为乱码?
最近编了一个小程序,目的:将ax中的数分成四组,并输出到AL,BL,CL,DL中。要求输出形式为:
the result of the question 5.3:
1 is the num of AL;
2 is the num of BL;
3 is the num of CL;
4 is the num of DL.
可我的这个程序的输出却是:
the result of the question 5.3:
☺ is the num of AL;
☻ is the num of BL;
♥ is the num of CL;
♦ is the num of DL.(其中☺等在输出窗口上显示为笑脸和棱形等,不是数字1,2,3,4)
请问各位高手,这是怎么一回事?应该如何改?源程序如下:
;**************************************************
data_seg segment
a db 'the result of the question 5.3:',0dh,0ah,'$'
b db ?
c db ?
d db ?
e db ?
string1 db ' is the num of AL;',0dh,0ah,'$'
string2 db ' is the num of BL;',0dh,0ah,'$'
string3 db ' is the num of CL;',0dh,0ah,'$'
string4 db ' is the num of DL.',0dh,0ah,'$'
data_seg ends
;**************************************************
code_seg segment
assume ds:data_seg,cs:code_seg
start:
mov ax,data_seg
mov ds,ax
mov dx,offset a ;output a string
mov ah,9
int 21h
mov ax,1234h ;get the first 4 bit of the num(1234h)
mov cl,4
rol ax,cl
and ax,000fh
mov b,al
mov ax,1234h ;get the second 4 bit of the num(1234h)
mov cl,8
rol ax,cl
and ax,000fh
mov c,al
mov ax,1234h ;get the third 4 bit of the num(1234h)
mov cl,0ch
rol ax,cl
and ax,000fh
mov d,al
mov ax,1234h ;get the last 4 bit of the num(1234h)
and ax,000fh
mov e,al
mov ah,2 ;output the fitst 4 bit of the num
mov dl,b
int 21h
mov dx,offset string1
mov ah,9
int 21h
mov ah,2 ;output the second 4 bit of the num
mov dl,c
int 21h
mov dx,offset string2
mov ah,9
int 21h
mov ah,2 ;output the third 4 bit of the num
mov dl,d
int 21h
mov dx,offset string3
mov ah,9
int 21h
mov ah,2 ;output the last 4 bit of the num
mov dl,e
int 21h
mov dx,offset string4
mov ah,9
int 21h
mov al,b
mov bl,c
mov cl,d
mov dl,e
mov ah,4ch
int 21h
code_seg ends
;**************************************************
end start
the result of the question 5.3:
1 is the num of AL;
2 is the num of BL;
3 is the num of CL;
4 is the num of DL.
可我的这个程序的输出却是:
the result of the question 5.3:
☺ is the num of AL;
☻ is the num of BL;
♥ is the num of CL;
♦ is the num of DL.(其中☺等在输出窗口上显示为笑脸和棱形等,不是数字1,2,3,4)
请问各位高手,这是怎么一回事?应该如何改?源程序如下:
;**************************************************
data_seg segment
a db 'the result of the question 5.3:',0dh,0ah,'$'
b db ?
c db ?
d db ?
e db ?
string1 db ' is the num of AL;',0dh,0ah,'$'
string2 db ' is the num of BL;',0dh,0ah,'$'
string3 db ' is the num of CL;',0dh,0ah,'$'
string4 db ' is the num of DL.',0dh,0ah,'$'
data_seg ends
;**************************************************
code_seg segment
assume ds:data_seg,cs:code_seg
start:
mov ax,data_seg
mov ds,ax
mov dx,offset a ;output a string
mov ah,9
int 21h
mov ax,1234h ;get the first 4 bit of the num(1234h)
mov cl,4
rol ax,cl
and ax,000fh
mov b,al
mov ax,1234h ;get the second 4 bit of the num(1234h)
mov cl,8
rol ax,cl
and ax,000fh
mov c,al
mov ax,1234h ;get the third 4 bit of the num(1234h)
mov cl,0ch
rol ax,cl
and ax,000fh
mov d,al
mov ax,1234h ;get the last 4 bit of the num(1234h)
and ax,000fh
mov e,al
mov ah,2 ;output the fitst 4 bit of the num
mov dl,b
int 21h
mov dx,offset string1
mov ah,9
int 21h
mov ah,2 ;output the second 4 bit of the num
mov dl,c
int 21h
mov dx,offset string2
mov ah,9
int 21h
mov ah,2 ;output the third 4 bit of the num
mov dl,d
int 21h
mov dx,offset string3
mov ah,9
int 21h
mov ah,2 ;output the last 4 bit of the num
mov dl,e
int 21h
mov dx,offset string4
mov ah,9
int 21h
mov al,b
mov bl,c
mov cl,d
mov dl,e
mov ah,4ch
int 21h
code_seg ends
;**************************************************
end start