汇编实验掌握响铃方法,掌握年月日输入方法加上闰年的判断,大小月的判断

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

DATAS SEGMENT

;此处输入数据段代码

KONG DB 0DH,0AH,'the day is:',0DH,0AH,'$'

YEAR DB'input year:',0DH,0AH,'$'

MONTH DB 0DH,0AH,'input month:',0DH,0AH,'$'

DAY DB 0DH,0AH,'input day:',0DH,0AH,'$'

ERROR DB 0DH,0AH,'the input is wrong! please input agin!',0DH,0AH,'$'

OU1 DB 0DH,0AH,'This is a leap year,and the february has 29 days $'

OU2 DB 0DH,0AH,'This is not a leap year! and the february onloy has 28 days$' DATA DB 10 DUP('-'),'$'

DATAS ENDS

STACKS SEGMENT

;此处输入堆栈段代码

STACKS ENDS

CODES SEGMENT

ASSUME CS:CODES,DS:DATAS,SS:STACKS

START:

MOV AX,DATAS

MOV DS,AX

;此处输入代码段代码

MOV DX,OFFSET YEAR

MOV AH,09H

INT 21H

CALL BELL

CALL INYEAR

CALL IFYEAR

;MOV BX,DI

MOV DX,OFFSET MONTH

MOV AH,09H

INT 21H

CALL INMONTH

MOV DX,OFFSET DAY

MOV AH,09H

INT 21H

CALL PAN

CALL BELL;CALL BELL

MOV DX,OFFSET KONG

MOV AH,09H

INT 21H

LEA DX,OFFSET DATA

MOV AH,09H

INT 21H

MOV AH,4CH

INT 21H

BELL PROC NEAR ;响铃一次

MOV DL,07H

MOV AH,2

INT 21H

RET

BELL ENDP

INYEAR PROC NEAR ;输入年

LEA DI,DATA

MOV CX,04H

L0:MOV AH,01H

INT 21H

MOV [DI],AL

INC DI

LOOP L0

RET

INYEAR ENDP

INMONTH PROC NEAR ;输入月MOV BX,00H

LEA DI,DATA

ADD DI,5

MOV AH,01H

INT 21H

CMP AL,31H

JA L1

JE L2

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

MOV BL,AL

SUB BL,30H

MOV [DI],AL

INC DI

RET

L1:CALL CUO

RET

L2:

MOV BH,AL

SUB BH,30H

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

CMP AL,32H

JA L1

MOV BL,AL

SUB BL,30H

MOV [DI],AL

INC DI

RET

INMONTH ENDP

CUO PROC NEAR ;显示错误LEA DX,OFFSET ERROR

MOV AH,09H

INT 21H

JMP START

RET ;RET

CUO ENDP

INDAY1 PROC NEAR ;输入日1

INC DI

MOV AH,01H

INT 21H

CMP AL,33H

JA L3

JE L4

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

MOV [DI],AL

RET

L3:CALL CUO

RET

L4:

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

CMP AL,31H

JA L3

MOV [DI],AL

RET

INDAY1 ENDP

INDAY2 PROC NEAR ;输入日2

INC DI

MOV AH,01H

INT 21H

CMP AL,33H

JA L5

JE L6

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

MOV [DI],AL

RET

L5:CALL CUO

RET

L6:

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

CMP AL,30H

JA L5

MOV [DI],AL

RET

INDAY2 ENDP

INDAY3 PROC NEAR ;输入日3

INC DI

MOV AH,01H

INT 21H

CMP AL,32H

JA L7

MOV [DI],AL

INC DI

MOV AH,01H

INT 21H

MOV [DI],AL

RET

L7:CALL CUO

RET

INDAY3 ENDP

相关文档
最新文档