|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码如下:
- assume cs:code
- data segment
- db 10 dup(0)
- data ends
- code segment
- start: mov ax,12667 ;12666 = 317ah
- mov bx,data
- mov ds,bx
- mov si,1 ;使得12666中1前边为0
- call dtoc
-
- mov dh,8
- mov dl,3
- mov cl,2
- call show_str
-
- mov ax,4c00h
- int 21h
-
-
-
- dtoc:
- mov dx,0
- mov bx,10
- s: mov cx,ax
- div bx
- add dl,30h
- mov [si],dl
- mov dl,0
- jcxz return
-
- inc si
- loop s
-
- return: ret
-
- show_str:
- dec si
- mov ax,0b800h
- mov es,ax
- mov ch,0
-
- mov bx,cx ;sava cx value to bx
-
- mov al,0a0h
- mul dh ;address of row in ax
- add dl,dl ;address of column in dl
- mov dh,0
- add ax,dx
- mov bp,ax
-
- mov ch,0
- s1: mov cl,[si]
- jcxz re ;Is the value in [si] zero
-
- mov es:[bp],cl
- mov es:[bp+1],bl
-
- dec si
- add bp,2
- inc cx
- loop s1
-
- re: ret
-
- code ends
- end start
复制代码 |
|