|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
自己写的作业,还是有多余的代码,慢慢来吧。
- assume cs:code
- data segment
- db 10 dup(0)
- data ends
- code segment
- start:
- mov ax,12666
- mov bx,data
- mov ds,bx
- mov si,0
- call dtoc
- mov dh,8
- mov dl,3
- mov cl,2
- call show_str
-
- mov ax,4c00h
- int 21h
-
- dtoc:
- push cx
- push ax
- push bx
- push si
- push dx
-
- s0: ;得到每位的值
- mov cx,ax
- jcxz input
- mov dx,0
- mov bx,10
- div bx
- mov bx,ax
- add dx,30h
- mov ax,dx
- push ax
- mov ax,bx
- inc si
- jmp s0
-
- input:
- mov cx,si
- mov si,0
- s1: ;将数值写入数据段
- pop ax
- mov [si],al
- inc si
- loop s1
- mov dl,0
- mov [si],dl
-
- pop dx
- pop si
- pop bx
- pop ax
- pop cx
- ret
-
- show_str:
- push cx
- push si
- push es
- push dx
-
- mov al,160
- mul dh
- mov bx,ax
-
- mov al,2
- mul dl
- add bx,ax
-
- mov ax,0b800h
- mov es,ax
-
- mov al,cl
- mov cl,0
-
- s:
- mov ch,[si]
- jcxz ok
-
- mov es:[bx],[si]
- mov es:[bx+1],cl
- add bx,2
- inc si
- jmp s
-
- ok: pop dx
- pop es
- pop si
- pop cx
- ret
- code ends
- end start
复制代码 |
|