| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 762 人关注过本帖
标题:求助:判断闰年的问题
只看楼主 加入收藏
hyhxhzxh
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2010-10-19
收藏
 问题点数:0 回复次数:2 
求助:判断闰年的问题
我刚学汇编不久,对汇编很不熟悉,请高手帮忙分析一下这段程序,我不知道为什么错误了
DATAS SEGMENT
    MESS DB 13,10,'Please input a year: $'
    Y DB 13,10,'YES! $'
    N DB 13,10,'NO! $'
    CONTINUE DB 13,10,'Continue? (y-yes) $'
    w DW 0
    buff DB 5,?,5 DUP(?),10,13,'$'
DATAS ENDS

CODES SEGMENT
    ASSUME CS:CODES,DS:DATAS
START:     MOV AX,DATAS
           MOV DS,AX
To_continue:
           LEA DX,MESS
           MOV AH,9
           INT 21h

           LEA DX,buff
           MOV AH,0AH
           INT 21h
           
           MOV CL, [buff+1]
           LEA DI,buff+2
           PUSH CX         
           DEC CX
           LEA SI,buff+2
     tt1:  INC SI
           LOOP tt1
           POP CX

           MOV DH,30h
           MOV BL,10
           MOV AX,1
           LOOP1: PUSH AX
           SUB BYTE PTR [SI],DH
           MUL BYTE PTR [SI]
           ADD w,AX
           POP AX
           MUL BL
           DEC SI
           LOOP LOOP1
           PUSH BX
           PUSH CX
           PUSH DX
              
           MOV AX,w
           MOV CX,AX
              
           MOV DX,0
           MOV BX,4
           DIV BX
           CMP DX,0
           JNZ lab1
              
           MOV AX,CX
           MOV BX,100
           DIV BX
           CMP DX,0
           JNZ lab2
              
           MOV AX,CX
           MOV BX,400
           DIV BX
           CMP DX,0
           JZ lab2
              
     lab1: CLC
           JMP lab3
              
     lab2: STC
              
     lab3: POP DX
           POP CX
           POP BX
           JC a1
           LEA DX,N
           MOV AH,9
           INT 21h

     com:  LEA dx,CONTINUE
           MOV AH,09H
           INT 21H
           
           MOV AH,01H
           INT 21H
           CMP Al,'y'
           JE  To_continue
           JMP exit
    a1:    LEA DX,Y
           MOV AH,9
           INT 21h
           JMP com
    exit:  MOV AH,4ch
           INT 21h
CODES ENDS
    END START
搜索更多相关主题的帖子: 闰年 判断 
2010-10-19 21:18
xiaomarn
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:5
帖 子:348
专家分:2026
注 册:2009-3-18
收藏
得分:0 
DATAS SEGMENT
    MESS DB 13,10,'Please input a year: $'
    Y DB 13,10,'YES! $'
    N DB 13,10,'NO! $'
    CONTINUE DB 13,10,'Continue? (y-yes) $'
    w DW 0
    buff DB 5,?,5 DUP(?),10,13,'$'
DATAS ENDS

CODES SEGMENT
    ASSUME CS:CODES,DS:DATAS
START:     MOV AX,DATAS
           MOV DS,AX
Tocon:
           LEA DX,MESS
           CALL DISMSG

           LEA DX,buff
           MOV AH,0AH
           INT 21h
           
           MOV CL, [buff+1]
           LEA DI,buff+2
           PUSH CX         
           DEC CX
           LEA SI,buff+2
     tt1:  INC SI
           LOOP tt1
           
           POP CX
           MOV DH,30h
           MOV BL,10
           MOV AX,1
           CALL ASCDEC
           
           PUSH BX
           PUSH CX
           PUSH DX
              
           MOV AX,w
           MOV CX,AX
              
           MOV DX,0
           MOV BX,4
           DIV BX
           CMP DX,0
           JNZ lab1
              
           MOV AX,CX
           MOV BX,100
           DIV BX
           CMP DX,0
           JNZ lab2
              
           MOV AX,CX
           MOV BX,400
           DIV BX
           CMP DX,0
           JZ lab2
              
     lab1: CLC
           JMP lab3
              
     lab2: STC
              
     lab3: POP DX
           POP CX
           POP BX
           JC a1
           LEA DX,N
           CALL DISMSG

     com:  LEA dx,CONTINUE
           CALL DISMSG
           
           MOV AH,01H
           INT 21H
           CMP Al,'y'
           JE  Tocon            
           JMP exit
    a1:    LEA DX,Y
           CALL DISMSG
           JMP com
    exit:  MOV AH,4ch
           INT 21h

ASCDEC PROC
LOOP1:
           PUSH AX
           SUB BYTE PTR [SI],DH
           MUL BYTE PTR [SI]
           ADD w,AX
           POP AX
           MUL BL
           DEC SI
           LOOP LOOP1
           ret
ASCDEC ENDP

DISMSG PROC
    MOV AH,9H
    INT 21H
    RET
DISMSG ENDP
CODES ENDS
    END START

2010-10-20 17:21
fan20121221
Rank: 1
等 级:新手上路
帖 子:17
专家分:8
注 册:2012-12-10
收藏
得分:0 
求每行注释,新手看不懂!
2012-12-11 21:57
快速回复:求助:判断闰年的问题
数据加载中...
 
   



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

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