主题:关于0dh,09h的用法
如这个程序:
;已知S=1*1+2*2+3*3+4*4+……+N*N,从键盘输入N计算S的值
data segment
msg1 db 'please input a num(1~9):$'
msg2 db 0dh,0ah,'s=','$'
errmsg db 'error.$'
s db ?
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea dx,msg1
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,'1'
jb error
cmp al,'9'
ja error
and al,0fh
mov bl,al
mov dx,0
again:
mov al,bl
mul bl
add dx,ax
dec bl
jne again
mov ax,dx
mov bx,10
mov cx,0
lea si,s
lop1:mov dx,0
div bx
push dx
inc cx
or ax,ax
jne lop1
lop2:pop ax
add al,30h
mov [si],al
inc si
loop lop2
mov [si],byte ptr '$'
lea dx,msg2
mov ah,09h
int 21h
lea dx,s
jmp exit
error:
lea dx,errmsg
exit:mov ah,09h
int 21h
mov ah,4ch
int 21h
code ends
end start
该程序中的开头有0dh,0ah,他们是什么意思呢,起什么作用?谢谢回帖
;已知S=1*1+2*2+3*3+4*4+……+N*N,从键盘输入N计算S的值
data segment
msg1 db 'please input a num(1~9):$'
msg2 db 0dh,0ah,'s=','$'
errmsg db 'error.$'
s db ?
code segment
assume cs:code,ds:data
start:
mov ax,data
mov ds,ax
lea dx,msg1
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,'1'
jb error
cmp al,'9'
ja error
and al,0fh
mov bl,al
mov dx,0
again:
mov al,bl
mul bl
add dx,ax
dec bl
jne again
mov ax,dx
mov bx,10
mov cx,0
lea si,s
lop1:mov dx,0
div bx
push dx
inc cx
or ax,ax
jne lop1
lop2:pop ax
add al,30h
mov [si],al
inc si
loop lop2
mov [si],byte ptr '$'
lea dx,msg2
mov ah,09h
int 21h
lea dx,s
jmp exit
error:
lea dx,errmsg
exit:mov ah,09h
int 21h
mov ah,4ch
int 21h
code ends
end start
该程序中的开头有0dh,0ah,他们是什么意思呢,起什么作用?谢谢回帖