鱼C论坛

 找回密码
 立即注册
查看: 1887|回复: 5

第十章的实验3遇到问题了,求帮助。。。

[复制链接]
发表于 2014-8-17 12:12:28 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
我感觉我的代码没错啊,可是运行结果不对呢。。。。这是源代码:

  1. assume cs:code,ds:data

  2. data segment
  3.         db 10 dup (0)
  4. data ends

  5. code segment

  6.         start:        mov ax, 12666
  7.                         mov bx, data
  8.                         mov ds, bx
  9.                        
  10.                         mov si, 0
  11.                         call dtoc
  12.                        
  13.                         mov dh, 1
  14.                         mov dl, 10
  15.                         mov cl, 2
  16.                         call show_str
  17.                        
  18.                         mov ax, 4c00H
  19.                         int 21H
  20.                
  21.         dtoc:        push dx
  22.                         push cx
  23.                         push ax
  24.                         push si
  25.                         push bx
  26.                        
  27.                         mov bx, 0        ;计数器,计算字符串的长度
  28.                 s1:        mov cx, 10
  29.                         mov dx, 0
  30.                         div cx
  31.                         mov cx, ax
  32.                         jcxz s2
  33.                         add dx, 30H
  34.                         push dx
  35.                         inc bx
  36.                         jmp short s1
  37.                
  38.                 s2:        add dx, 30H
  39.                         push dx
  40.                         inc bx
  41.                         mov cx, bx
  42.                         mov si, 0
  43.                
  44.                 s3:        pop ax
  45.                         mov [si], al
  46.                         inc si
  47.                         loop s3
  48.                        
  49.                         pop bx
  50.                         pop si
  51.                         pop ax
  52.                         pop cx
  53.                         pop dx
  54.                         ret
  55.                
  56. show_str:        push cx
  57.                         push ax
  58.                         push es
  59.                         push di
  60.                        
  61.                         mov ax, 0B800H
  62.                         mov es, ax
  63.                        
  64.                         mov al, 160
  65.                         mul dh
  66.                         mov di, ax
  67.                         mov al, 2
  68.                         dec dl
  69.                         mul dl
  70.                         add di, ax

  71.                 s:        mov cl, [si]
  72.                         mov ch, 0
  73.                         jcxz ok
  74.                         mov es:[di], cl
  75.                         mov es:[di + 1], bl
  76.                         inc si
  77.                         add di, 2
  78.                         loop s
  79.                        
  80.                 ok:        pop di
  81.                         pop es
  82.                         pop ax
  83.                         pop cx
  84.                
  85.                         ret

  86. code ends

  87. end start
复制代码
运行后的结果:


程序运行结果

程序运行结果
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

 楼主| 发表于 2014-8-17 12:14:00 | 显示全部楼层
为什么显示出来的只有一坨绿。。。:sweat:
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2014-8-17 16:22:38 | 显示全部楼层
学win32弄的现在8086看的不是太懂了,等高人
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-8-17 17:22:09 | 显示全部楼层
gyixue 发表于 2014-8-17 16:22
学win32弄的现在8086看的不是太懂了,等高人

:sweat:
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2014-8-17 17:59:27 | 显示全部楼层
:huffy::shock::ton::big:shy::mad::funk:
小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-1 05:50

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表