|
|||||||||||
print MACRO mess PUSH AX PUSH DX MOV AH,9 LEA DX,mess INT 21H POP DX POP AX ENDM DATA SEGMENT days DB 31,28,31,30,31,30,31,31,30,31,30,31 YunOrNo DB ? inputyear DB 'Plear input a year number: $' inputmonth DB 'Plear input a month number: $' inputday DB 'Plear input a day number: $' errormess DB 'Input failed !!!',10,13,'$' pass DB 'Input completely!!!!',10,13,'$' DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA start: MOV AX,DATA MOV DS,AX print inputyear call read MOV AX,BX MOV DX,0 MOV CX,4 DIV CX CMP DX,0 JNZ goon1 add YunOrNo,1 goon1: MOV AX,BX MOV DX,0 MOV CX,100 DIV CX CMP DL,0 JNZ goon2 sub YunOrNo,1 goon2: MOV AX,BX MOV DX,0 MOV CX,400 DIV CX CMP DL,0 JNZ goon3 sub YunOrNo,1 goon3: MOV DL,YunOrNo SUB days[1],DL print inputmonth call read CMP BX,1 JB error CMP BX,12 JA error MOV DI,BX ;save month DEC DI print inputday call read CMP BX,1 JB error CMP BX,32 JA error CMP BL,[DI] JA error print pass JMP exit error: print errormess exit: MOV AH,4CH INT 21H read proc NEAR PUSH AX PUSH CX PUSH DX MOV BX,0 MOV CX,10 againn2: MOV AH,1 INT 21H CMP AL,13 JZ overn2 CMP AL,' ' JZ overn2 CMP AL,'0' JB errorn2 CMP AL,'9' JA errorn2 SUB AL,'0' MOV AH,0 PUSH AX MOV AX,BX MUL CX CMP DX,0 JA errorn2 MOV BX,AX POP AX ADD BX,AX JC errorn2 JMP againn2 errorn2: MOV AH,4CH INT 21H overn2: MOV AH,2 MOV DL,10 INT 21H MOV DL,13 INT 21H POP DX POP CX POP AX RET read endp CODE ENDS END start |