| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 493 人关注过本帖
标题:请问这个程序错在哪
只看楼主 加入收藏
flyfx1989
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2010-12-1
结帖率:85.71%
收藏
已结贴  问题点数:20 回复次数:2 
请问这个程序错在哪
D SEGMENT
D1 DB 20
    DB ?
    DB 2 DUP(?)
EMON DB 'JAN' ,'FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'
CHAR DB 3 DUP(?),0DH,0AH,'$'
D2 DB 'INPUT MONTH',0DH,0AH,'$'
D3 DB ?
D ENDS
C SEGMENT
 ASSUME CS:C,DS:D,ES:D

 MAIN PROC FAR
MOV AX,D
MOV DS,AX
MOV ES,AX
START:
CALL INPUT
CALL LOCATE
CALL DISPLAY
JMP START
EXIT:MOV AH,4CH
INT 21H
RET
MAIN ENDP

INPUT PROC NEAR
LEA DX,D2
MOV AH,9
INT 21H
LEA DX,D1
MOV AH,0AH
INT 21H
MOV AL,D1+2
SUB AL,'0'
MOV BL,10
MUL BL
MOV AH,D1+3
SUB AH,'0'
ADD AL,AH
MOV D3,AL
RET
INPUT ENDP

LOCATE PROC NEAR
MOV AL,D3
DEC AL
MOV BL,3
MUL BL
MOV SI,0
MOV BX,OFFSET EMON
MOV AH,0
ADD BX,AX
LOP:
MOV CX,3
MOV AL,[BX+SI]
MOV CHAR[SI],AL
INC SI
LOOP LOP
RET
LOCATE ENDP

DISPLAY PROC NEAR
LEA DX,CHAR
MOV AH,9
INT 21H
RET
DISPLAY ENDP

CODE ENDS
     END START
2010-12-12 21:34
zaixuexi
Rank: 12Rank: 12Rank: 12
来 自:上海
等 级:火箭侠
威 望:8
帖 子:858
专家分:3233
注 册:2010-12-1
收藏
得分:5 
D SEGMENT
D1  DB 3
    DB ?
    DB 2 DUP(?)
EMON DB 'JAN' ,'FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'
CHAR DB 3 DUP(?),0DH,0AH,'$'
D2 DB 'INPUT MONTH',0DH,0AH,'$'
D3 DB ?
D ENDS
C SEGMENT
ASSUME CS:C,DS:D,ES:D

MAIN PROC FAR

START:
MOV AX,D
MOV DS,AX
MOV ES,AX
CALL INPUT
CALL LOCATE
CALL DISPLAY
JMP START
EXIT:
MOV AH,4CH
INT 21H
MAIN ENDP

INPUT PROC NEAR
LEA DX,D2
MOV AH,9
INT 21H
LEA DX,D1
MOV AH,0AH
INT 21H
MOV AL,D1+2
SUB AL,'0'
MOV BL,10
MUL BL
MOV AH,D1+3
SUB AH,'0'
ADD AL,AH
MOV D3,AL
RET
INPUT ENDP

LOCATE PROC NEAR
MOV AL,D3
DEC AL
MOV BL,3
MUL BL
MOV SI,0
MOV BX,OFFSET EMON
MOV AH,0
ADD BX,AX
LOP:
MOV CX,3
MOV AL,[BX+SI]
MOV CHAR[SI],AL
INC SI
LOOP LOP
RET
LOCATE ENDP

DISPLAY PROC NEAR
LEA DX,CHAR
MOV AH,9
INT 21H
RET
DISPLAY ENDP

C ENDS
END START
我改了一点,没看懂你的locate要干什么事,呵呵.

技术问题,请不要以短消息方式提问
2010-12-12 22:31
xiaomarn
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:小飞侠
威 望:5
帖 子:348
专家分:2026
注 册:2009-3-18
收藏
得分:15 
程序代码:
data SEGMENT
    D1     DB 20
        DB ?
        DB 2 DUP(?)
    EMON DB 'JAN' ,'FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC'
    crlf db 0dh,0ah
    CHAR DB 3 DUP(?),0DH,0AH,'$'
    D2 DB 'INPUT MONTH',0DH,0AH,'$'
    D3 DB ?
    errmsg db 'input error!','$'
data ENDS

code SEGMENT
ASSUME CS:code,DS:data,ES:data

MAIN PROC FAR
START:
    MOV AX,data
    MOV DS,AX
    MOV ES,AX

    CALL INPUT
    CALL LOCATE
    CALL DISPLAY
    ;JMP START
EXIT:MOV AH,4CH
    INT 21H
    RET
MAIN ENDP

INPUT PROC NEAR
    LEA DX,D2
    MOV AH,9
    INT 21H
    LEA DX,D1
    MOV AH,0AH
    INT 21H
    MOV AL,D1+2
    SUB AL,'0'
    cmp al,1
    ja mm
    MOV BL,10
    MUL BL
    MOV AH,D1+3
    cmp ah,0dh
    jz cr
    SUB AH,'0'   

    cmp ah,2
    ja err
    ADD AL,AH
mm:
    MOV D3,AL
    RET
cr:
    mov d3,1
    ret
err:
    mov dx,offset errmsg
    mov ah,9
    int 21h
   

    mov ah,4ch
    int 21h
INPUT ENDP

LOCATE PROC NEAR
    MOV AL,D3
    DEC AL
    MOV BL,3
    MUL BL
    MOV SI,0
    MOV BX,OFFSET EMON
    MOV AH,0
    ADD BX,AX
    MOV CX,3
LOP:   

    MOV AL,[BX+SI]
    MOV CHAR[SI],AL
    INC SI
    LOOP LOP
    RET
LOCATE ENDP

DISPLAY PROC NEAR
    LEA DX,crlf
    MOV AH,9
    INT 21H
    RET
DISPLAY ENDP

CODE ENDS
     END START 

2010-12-13 20:03
快速回复:请问这个程序错在哪
数据加载中...
 
   



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

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