测试屏幕:DMT10600C070_07WT,使用汇编OS 程序;测试是可以的!
ORG 1000H
GOTO MAIN
MAIN:
CALL YEAR ;闰年还是平年
CALL DAY ;每个月对应的天数
GOTO MAIN
YEAR: ;判断闰年还是平年 闰年2月有29天,平年28
LDBR R20,0,40
LDWR R0,1000H
MOVXR R26,1,1
LDWR R36,400 ;整数年除以400,余数为0代表闰年
DIV R20,R30,0
IJNE R37,0,YEAR_1
LDWR R0,4000H ;闰年标识
LDWR R70,1
MOVXR R70,0,1
RET
YEAR_1:
LDBR R20,0,40
LDWR R0,1000H
MOVXR R26,1,1
LDWR R36,4 ;非整数年除以4,余数为0代表闰年
DIV R20,R30,0
IJNE R37,0,YEAR_2
LDWR R0,4000H ;闰年标识
LDWR R70,1
MOVXR R70,0,1
RET
YEAR_2:
LDWR R0,4000H ;平年标识
LDWR R70,0
MOVXR R70,0,1
RET
DAY:
LDBR R20,0,40
LDWR R0,1002H
MOVXR R20,1,1
IJNE R21,1,DAY_2
;1月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_2:
IJNE R21,2,DAY_3
;1月 天限是31天
LDWR R0,4000H
MOVXR R22,1,1
IJNE R23,0,DAY_2_1
;平年28天
LDWR R0,2002H
LDWR R80,28
MOVXR R80,0,1
RET
DAY_2_1:
;闰年29天
LDWR R0,2002H
LDWR R80,29
MOVXR R80,0,1
RET
DAY_3:
IJNE R21,3,DAY_4
;3月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_4:
IJNE R21,4,DAY_5
;4月 天限是30天
LDWR R0,2002H
LDWR R80,30
MOVXR R80,0,1
RET
DAY_5:
IJNE R21,5,DAY_6
;5月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_6:
IJNE R21,6,DAY_7
;6月 天限是30天
LDWR R0,2002H
LDWR R80,30
MOVXR R80,0,1
RET
DAY_7:
IJNE R21,7,DAY_8
;7月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_8:
IJNE R21,8,DAY_9
;8月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_9:
IJNE R21,9,DAY_10
;9月 天限是30天
LDWR R0,2002H
LDWR R80,30
MOVXR R80,0,1
RET
DAY_10:
IJNE R21,10,DAY_11
;10月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_11:
IJNE R21,11,DAY_12
;11月 天限是30天
LDWR R0,2002H
LDWR R80,30
MOVXR R80,0,1
RET
DAY_12:
IJNE R21,12,DAY_ret
;12月 天限是31天
LDWR R0,2002H
LDWR R80,31
MOVXR R80,0,1
RET
DAY_ret:
RET |