| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 615 人关注过本帖
标题:帮我看下哪错了
只看楼主 加入收藏
Depoi
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-4-18
结帖率:0
收藏
已结贴  问题点数:0 回复次数:3 
帮我看下哪错了
data segment
    num1message db 'please input num:','$'
    num2message db 'please input num2:','$'
    resultmessage db 'result:','$'
    yushumessage db 'yushu:','$'
    choiced db 'add sub mul div','$'
    pleasechoice db 'choice num you wan','$'
    continue db '-----------------------------','$'
    exit db 'if you want to exit,input 0','$'
    exit_input db ?
    num1 db 50,0,50 dup(?)
    num2 db 50,0,50 dup(?)
    result dw ?
    yushu dw ?
    factor db 10
data ends

stack segment
    dw 100 dup(?)
    tos label word
stack ends

code segment
   assume cs:code,ds:data
main proc far
     start:
             mov ax,stack
             mov ds,ax
             lea sp,tos
             push ds
             xor ax,ax
             push ax
             mov ax,data
             mov ds,ax
       loop_main:
            call init
            call choice
             lea dx,num1message;
             call message
             lea dx,num1;
             call input ;
             push bx
            
             mov dl,0ah
             mov ah,02h
             int 21h
             mov dl,0dh
             mov ah,02h
             int 21h
             lea dx,num2message
             call message
             lea dx,num2
             call input
             push ax
             cmp al,'1'
             jz result_sum
             cmp choiced,'2'
             jz result_sub
             cmp choiced,'3'
             jz result_mul
             cmp choiced,'4'
             jz result_div
       result_sum:
             call sum
             jmp printf_result
        result_sub:
                call substract
                jmp printf_result
         result_mul:
             call mult
             jmp printf_result
             result_div:
                call divs
           printf_result:
                          call ctr1
                          lea dx,resultmessage
                          call message
                          call output
                          ;------------
                          call ctr1
                          cmp choiced,'4'
                          jnz end_print
                          lea dx,yushumessage
                          call message
                          mov ax,yushu
                          mov result,ax
                          call output
                          call ctr1
                          ;------------------
              end_print:
                     lea dx,exit
                     call message
                     call ctr1
                     lea dx,continue
                     call message
                     call ctr1
                     mov ah,01h
                     int 21h
                     cmp al,'0'
                     jnz loop_main
                     pop ax
                     pop ds
                     mov ax,4c00h
                     int 21h
  main endp
  ;-------------------------sub  program
  sum proc near
      push bp
      mov bp,sp
      push si
      push di
      mov si,[bp+6] ;
      mov di,[bp+4] ;
      add di,si
      mov result,di
      pop di
      pop si
      pop bp
      ret 4
      sum endp
    substract proc near
          push bp
          mov bp,sp
          push si
          push di
          mov di,[bp+6]
          mov si,[bp+4]
          sub di,si
          mov result,di
          pop di
          pop si
          pop bp
          ret 4
       substract endp
     mult proc near
         push bp
         mov bp,sp
         push ax
         push bx
         mov ah,0
         mov al,byte ptr [bp+6]
         mov bh,0
         mov bl,byte ptr [bp+4]
         mul bl
         mov result,ax
         pop bx
         pop ax
         pop bp
       ret 4
     mult endp
   divs proc near
       push bp
       mov bp,sp
       push ax
       push bx
       mov ax,[bp+6]
       mov dx,0
       mov bx,[bp+4]
       div bx
       mov result,ax
       mov yushu,dx
       pop dx
       pop ax
       pop bp
       ret 4
     divs endp
     init proc near
       lea dx,choiced
       call message
       call ctr1
       lea dx,pleasechoice
       call message
       call ctr1
      ret
      init endp
      choice proc near
          mov ah,01h
          int 21h
          mov choiced,al
          call ctr1
        ret
        choice endp
        ctr1 proc near
           mov dl,0ah
           mov ah,02h
           int 21h
           mov dl,0dh
           int 21h
           ret
           ctr1 endp
       input proc near
          mov al,0
          mov ah,0ah
          int 21h
          add dx,1
          mov si,dx
          mov cl,[si]
          mov ch,0
          mov bx,0
         next:  mov ax,bx
                mul factor
                mov bx,ax
                inc si
                mov al,[si]
                mov ah,0
                sub al,30h
                add bx,ax
                loop next
            ret
        input endp
        output proc near
             mov ax,result
             mov  dx,0
             mov cx,0
             loop1: div word ptr factor
                   push dx
                   inc cx
                   cmp ax,0
                   jz show
                   jmp loop1
              show: pop dx
              add dx,30h
              mov ah,02h
              int 21h
             loop show
             ret
            
         output endp
          message proc near
          mov ah,09h
          ret
          message endp
    code ends
 end start
搜索更多相关主题的帖子: continue please choice factor 
2011-05-15 22:51
Depoi
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-4-18
收藏
得分:0 
帮忙运行一下。。只有一个错误。谢谢额
2011-05-16 00:19
zaixuexi
Rank: 12Rank: 12Rank: 12
来 自:上海
等 级:火箭侠
威 望:8
帖 子:858
专家分:3233
注 册:2010-12-1
收藏
得分:20 
1. 代码能不能对齐再发上来?
2. 语法错误的问题尽量不要发上来
3. 要发的话,也要把编译器报的错误一起贴上来,谁知道你的一个错误是语法错误还是逻辑错误
4. jnz loop_main
   ->
   jz  s0
   jmp loop_main
s0:
   pop ax
   pop ds
   mov ax,4c00h
   int 21h

  

技术问题,请不要以短消息方式提问
2011-05-16 09:47
Depoi
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2011-4-18
收藏
得分:0 
error a2006: : start
2011-05-16 11:36
快速回复:帮我看下哪错了
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021226 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved