. : : Assembly Language : : .  |  首页  |  我提出的问题  |  我参与的问题  |  我的收藏  |  消息中心   |  游客  登录  | 
提问 | 未解决 | 已解决 | 精华区 | 搜索 |
  《汇编语言》论坛 ->CALL和RET指令
主题 : :  第十章 实验3我很纠结,想问问我这个程序到底在哪;我的结果没有正常显示  [待解决] 回复[ 1次 ]   点击[ 249次 ]  
quexiao521
[帖 主] [ 发表时间:2011-06-27 15:20 ] 
荣誉值:4
信誉值:0
注册日期:2011-04-27 23:01
assume cs:code
data   segment
db     10  dup (0)
data   ends
code   segment
start: mov ax,1266
       mov bx,data
       mov ds,bx
       mov si,0
       call dtoc

       mov dh,8
       mov dl,3
       mov cl,2
       call show_str

       mov ah,4ch
       int 21h
  dtoc:  push cx
         push bx
  dtoc1: mov dx,0         ;用16位除法所以把DX清0
         mov bx,10
         div bx           ;商保存在ax,余数保存在dx
         mov cx,ax        ;ax/10=0 ,程序就不再向下执行而是跳到ok
         jcxz ok
         add dx,30h       ;把结果加上30h转化为字符
         mov [si],dl      ;把转化了的字符传给数据段以便show_str子程序调用
         inc si           
         jmp short dtoc1
     ok: mov bl,0 
         mov [si],bl
         pop bx
         pop cx
         ret    
  
       
show_str:push ax
         push bx
         push cx
         push si
         mov ax,0b800h
         mov es,ax
         mov di,0
         mov al,160
         mul dh
         mov bx,ax
         mov al,2
         mul dl
         sub ax,2
         add bx,ax
         mov ah,02
         mov ch,0
     str:mov cl,[di]
         jcxz ok1
         mov al,cl
         mov es:[bx+si],ax
         inc di
         add si,2
         jmp str
     ok1:pop si
         pop cx
         pop bx
         pop ax
         ret
code  ends
end  start

请高手帮忙,我的show_str子程序没有问题,就是dtoc子程序出现了问题;其中12666的显示我是倒着的
需要登录后才能回帖 -->> 请单击此处登录
    Copyright © 2006-2024   ASMEDU.NET  All Rights Reserved