1个回答
2015-12-02
展开全部
code segment
assume cs:code
org 100h
start:
jmp bbb
str1 db 250 dup(' ')
num db ?
msg1 db 10,13,'please input string:','$'
y db 10,13,0,0,0,'$'
bbb:
push cs
pop ds
lea dx,msg1
mov ah,9
int 21h
MOV cx,0
lea di,str1
again1:
mov ah,1
int 21h
cmp al,'$'
je line1
mov byte ptr[di],al
inc cx
inc di
jmp again1
line1:
mov byte ptr[num],cl
mov al,byte ptr[num]
mov ah,0
mov cl,10
div cl
mov byte ptr[y+4],ah ;保存个位
mov ah,0
div cl
mov byte ptr[y+3],ah ;保存十位
mov ah,0
mov byte ptr[y+2],al ;保存百位
mov al,byte ptr[y+2]
add al,30h ;百位转ASC2
mov byte ptr[y+2],al
mov al,byte ptr[y+3]
add al,30h ;十位转ASC2
mov byte ptr[y+3],al
mov al,byte ptr[y+4]
add al,30h ;个位转ASC2
mov byte ptr[y+4],al
mov ah,9
lea dx,y
int 21h
mov ah,4ch
int 21h
code ends
end start
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询