|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
我感觉我的代码没错啊,可是运行结果不对呢。。。。这是源代码:
- assume cs:code,ds:data
- 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, 1
- mov dl, 10
- mov cl, 2
- call show_str
-
- mov ax, 4c00H
- int 21H
-
- dtoc: push dx
- push cx
- push ax
- push si
- push bx
-
- mov bx, 0 ;计数器,计算字符串的长度
- s1: mov cx, 10
- mov dx, 0
- div cx
- mov cx, ax
- jcxz s2
- add dx, 30H
- push dx
- inc bx
- jmp short s1
-
- s2: add dx, 30H
- push dx
- inc bx
- mov cx, bx
- mov si, 0
-
- s3: pop ax
- mov [si], al
- inc si
- loop s3
-
- pop bx
- pop si
- pop ax
- pop cx
- pop dx
- ret
-
- show_str: push cx
- push ax
- push es
- push di
-
- mov ax, 0B800H
- mov es, ax
-
- mov al, 160
- mul dh
- mov di, ax
- mov al, 2
- dec dl
- mul dl
- add di, ax
- s: mov cl, [si]
- mov ch, 0
- jcxz ok
- mov es:[di], cl
- mov es:[di + 1], bl
- inc si
- add di, 2
- loop s
-
- ok: pop di
- pop es
- pop ax
- pop cx
-
- ret
- code ends
- end start
复制代码 运行后的结果:
|
-
程序运行结果
|