| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 932 人关注过本帖
标题:求改错 星座查询系统
只看楼主 加入收藏
qq651325419
Rank: 1
来 自:福建厦门
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-7-13
结帖率:0
收藏
已结贴  问题点数:10 回复次数:6 
求改错 星座查询系统
crlf  macro              ;回车换行的宏定义
      mov ah,02h
      mov dl,13
      int 21h
      mov dl,10
      int 21h
      endm
data segment
     str1      db      '###################################################',10,13,'$'
     str2      db      '        Welcome to star-search programe            ',10,13,'$'
     str3      db      '           Thank you for using                     ',10,13,'$'
     str4      db      '               date:2008-1-23                      ',10,13,'$'
     str5      db      '###################################################',10,13,'$'
     str6      db      'Did you want to enter the number which you are going to search by?(Y/N):',10,13,'$'
     str7      db      'Please enter the number you want to search by(**-**):',10,13,'$'
     str8      db      'You had entered an wrong character,please enter again:',10,13,'$'
     str9      db      'The numbers you had entered arent reach the order,please enter again.',10,13,'$'
     str10     db      'The numbers you had entered are over the limit,please enter again.',10,13,'$'
     str11     db      'Sorry,the programe couldnt find the star you want to search for!',10,13,'$'
     str12     db      'Did you want to start another search?(Y/N):',10,13,'$'
     month     label    byte
               max_len  db    6
               act_len  db    ?
               kb_month db    20  dup(?)
     star      db      '01','19',' Capricorn  '
               db      '02','18',' Aquarius   '
               db      '03','20',' Pisces     '
               db      '04','20',' Aries      '
               db      '05','20',' Taurus     '
               db      '06','21',' Gemini     '
               db      '07','22',' Cancer     '
               db      '08','22',' Leo        '
               db      '09','22',' Virgo      '
               db      '10','22',' Libra      '
               db      '11','21',' Scorpio    '
               db      '12','21',' Sagittarius'
     descrn    db      14  dup(20h),13,10,'$'       ;定义di缓冲区的内存空间,初始值为0
     select    db      ?            ;定义用户选择信息的内存空间
data ends
code segment
main    proc   far
        assume cs:code,ds:data,es:data
start:  push   ds                ;对寄存器中的数据进行保护
        push   es
        sub    ax,ax
        push   ax
        mov    ax,data
        mov    ds,ax
        mov    es,ax
        lea    dx,str1           ;显示程序名称及作者信息
        mov    ah,09h
        int    21h
        crlf
        lea    dx,str2
        mov    ah,09h
        int    21h
        crlf
        lea    dx,str3
        mov    ah,09h
        int    21h
        crlf
        lea    dx,str4
        mov    ah,09h
        int    21h
        crlf
        lea    dx,str5
        mov    ah,09h
        int    21h
        crlf
start1: lea    dx,str6         ;提示用户是否要开始查询
        mov    ah,09h
        int    21h
circle: mov    ah,01h          ; 接收用户选择信息
        int    21h
        mov    select,al               
        cmp    select,'N'
        je     exit
        cmp    select,'n'
        je     exit
        cmp    select,'Y'
        je     search
        cmp    select,'y'
        je     search
        mov    ah,09h
        lea    dx,str8
        int    21h
        jmp    circle
exit:   mov    ax,4c00h        ;返回DOS系统
        int    21h
search: crlf
        lea    dx,str7         ;提示用户输入要查找星座的月份和日期信息
        mov    ah,09h
        int    21h
        lea    dx,month         ;接收用户输入的信息
        mov    ah,0ah
        int    21h
        cmp    act_len,0
        je     search         ;如果输入字符串的长度为0,则要求用户重新输入
        mov    al,kb_month
        cmp    al,'Q'
        je     exit
        cmp    al,'q'
        je     exit
        cmp    act_len,5
        jl     error          ;如果用户输入的格式没有符合要求(**-**),就报错
        mov    ah,kb_month+1   ;把月份的个位赋给ah(月份的十位已经赋给al)
        mov    bh,kb_month+3   ;把日期的十位赋给bh
        mov    bl,kb_month+4   ;把日期的个位赋给bl
        cmp    al,'2'
        jnb    error1          ;如果用户输入的月份大于12,就报错
        cmp    bh,'4'
        jnb    error2          ;如果用户输入的日期大于31,就报错
        mov    cx,12           
        lea    si,star          ;把星座名称的信息的偏移地址赋给si
compare:cmp    ax,word  ptr[si]     ;比较月份信息
        je     date                 ;如果相等的话就跳转到比较日期的部分
        add    si,16
        loop   compare
        crlf
        lea    dx,str11
        mov    ah,09h
        int    21h                 ;如果没有找到,输出提示信息
        jmp    exit
date:   add    si,2
        mov    ah,[si]
        mov    al,[si+1]            ;将日期的十位和个位分别赋给ax的高位和低位
        cmp    bx,ax                ;比较日期
        jle    less                 ;如果小于等于的话,就跳转到less
        jmp    great                ;如果大于的话,就跳转到great
less:   mov    cx,07                ;如果小于等于的话,表示找到需要的星座,就输出这个星座的名称
        lea    di,descrn
        sub    di,3                 ;使输出的只是星座的名称,而不输出前面的月份和日期信息
        rep    movsw                ;将si(star)里的内容赋给di,传送14个字符
        crlf
        lea    dx,descrn
        mov    ah,09h
        int    21h
        crlf
        lea    dx,str12              ;询问用户是否要继续查找下一个星座
        mov    ah,09h
        int    21h
renew:  crlf
        mov    ah,01h                 ;接收用户的选择信息
        int    21h
        cmp    al,'Y'
        je     search
        cmp    al,'y'
        je     search
        cmp    al,'N'
        je     exit
        cmp    al,'n'
        je     exit
        lea    dx,str8               ;提示用户没有按要求输入,要求重新输入
        mov    ah,09h
        int    21h
        jmp    renew
great:  mov    cx,07              ;如果日期大于的话,说明符合要求的星座为当前星座的下一个,输出符合要求的星座
        add    si,16
        lea    di,descrn
        sub    di,3
        rep    movsw
        crlf
        lea    dx,descrn
        mov    ah,09h
        int    21h
        lea    dx,str12              ;询问用户是否要继续查找下一个星座
        mov    ah,09h
        int    21h
        jmp    renew
error:  crlf
        lea    dx,str9          ;如果用户没有按(**-**)输入信息,提示其重新输入
        mov    ah,09h
        int    21h
        jmp    search
error1: crlf
        lea    dx,str10          ;如果用户输入的信息超出限制,提示其重新输入
        mov    ah,09h
        int    21h
        jmp    search
error2: crlf
        lea    dx,str10
        mov    ah,09h
        int    21h
        jmp    search
main    endp
code    ends
        end    start
  
        
        
        
        
        
        
        
        

        
         
搜索更多相关主题的帖子: 星座 系统 改错 查询 
2010-07-13 19:08
qq651325419
Rank: 1
来 自:福建厦门
等 级:新手上路
帖 子:2
专家分:0
注 册:2010-7-13
收藏
得分:0 
大侠们 帮帮小弟  周五就要交了
2010-07-13 19:08
okayyyy
Rank: 2
等 级:论坛游民
威 望:2
帖 子:102
专家分:70
注 册:2010-6-15
收藏
得分:5 
undefined symbol : start
2010-07-17 19:22
okayyyy
Rank: 2
等 级:论坛游民
威 望:2
帖 子:102
专家分:70
注 册:2010-6-15
收藏
得分:0 
大概是我看到 变量使用最乱的代码了










2010-07-17 19:49
okayyyy
Rank: 2
等 级:论坛游民
威 望:2
帖 子:102
专家分:70
注 册:2010-6-15
收藏
得分:0 
我倒,dos中断这么麻烦。
以前的评论作废。
贴一段代码 慢慢改。重当温习dos中断
程序代码:
crlf  macro              ;回车换行的宏定义
      mov ah,02h
      mov dl,13
      int 21h
      mov dl,10
      int 21h
      endm

data segment
    
     str1      db      '###################################################',10,13,'$'
               db      '        Welcome to star-search programe            ',10,13,'$'
               db      '           Thank you for using                     ',10,13,'$'
               db      '               date:2008-1-23                      ',10,13,'$'
               db      '###################################################',10,13,'$'
     dwoffset  dw       ($-str1)/5      
     str6      db      'Did you want to enter the number which you are going to search by?(Y/N):',10,13,'$'
     str7      db      'Please enter the number you want to search by(**-**):',10,13,'$'
     str8      db      'You had entered an wrong character,please enter again:',10,13,'$'
     str9      db      'The numbers you had entered arent reach the order,please enter again.',10,13,'$'
     str10     db      'The numbers you had entered are over the limit,please enter again.',10,13,'$'
     str11     db      'Sorry,the programe couldnt find the star you want to search for!',10,13,'$'
     str12     db      'Did you want to start another search?(Y/N):',10,13,'$'
     month     label    byte
               max_len  db    5
               act_len  db    ?
               kb_month db    20  dup(?)
     star      db      '01','19',' Capricorn  ' 10,13,'$'
               db      '02','18',' Aquarius   ' 10,13,'$'
               db      '03','20',' Pisces     ' 10,13,'$'
               db      '04','20',' Aries      ' 10,13,'$'
               db      '05','20',' Taurus     ' 10,13,'$'
               db      '06','21',' Gemini     ' 10,13,'$'
               db      '07','22',' Cancer     ' 10,13,'$'
               db      '08','22',' Leo        ' 10,13,'$'
               db      '09','22',' Virgo      ' 10,13,'$'
               db      '10','22',' Libra      ' 10,13,'$'
               db      '11','21',' Scorpio    ' 10,13,'$'
               db      '12','21',' Sagittarius' 10,13,'$'
    staroffset db      ($-star)/12
     descrn    db      14  dup(20h),13,10,'$'       ;定义di缓冲区的内存空间,初始值为0
     select    db      ?            ;定义用户选择信息的内存空间
data ends 

code segment

        assume cs:code,ds:data
start: 
        mov ax,data
        mov ds,ax
;--------------------------------------------------------------------------------   
 ;显示作者信息
;--------------------------------------------------------------------------------
        mov dx,offset str1
        mov ah,9
        mov cx,5   
welcomemessage:    

        int 21h
        add dx,dwoffset
        loop welcomemessage
;--------------------------------------------------------------------------------
; 选择Y或y,则开始查询;否则退出程序
;--------------------------------------------------------------------------------
start1: lea dx,str6         ;提示用户是否要开始查询
        mov ah,09h
        int 21h
circle: mov ah,1h           
        cmp al,'y'
        je search
        cmp al,'Y'
        je search       
        jmp exit
;--------------------------------------------------------------------------------
; 判断输入是否满足**-**,就是
;-------------------------------------------------------------------------------- 

search:
        crlf
        mov dx,offset str7
        mov ah,9
        int 21h
        mov dx,offset month
        mov ah,0ah
        int 21h 
;--------------------------------------------------------------------------------
;
;--------------------------------------------------------------------------------
  
exit:
        mov ax,4c00h
        int 21h

code    ends
        end    start



[ 本帖最后由 okayyyy 于 2010-7-19 07:42 编辑 ]
2010-07-17 20:13
你们都要疼我哦
Rank: 11Rank: 11Rank: 11Rank: 11
来 自:火星
等 级:贵宾
威 望:49
帖 子:1296
专家分:2746
注 册:2008-7-13
收藏
得分:5 
膜拜

小妹,哥哥看你骨骼清奇,绝非凡人,将来必成大业,不如这样,你先把裤裤脱了,待哥哥为你开启灵窍,然后我们一起努力钻研如何
2010-07-18 01:43
yuyuhongss
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2010-8-13
收藏
得分:0 
好厉害呀
2010-08-13 14:03
快速回复:求改错 星座查询系统
数据加载中...
 
   



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

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