DB 0,31,60,91,121,152,182,213,244,18,49,79
mONth_dAtA:
;公历年对应的农历数据,每年三字节,
;格式第一字节BIT7-4 位表示闰月月份,值为0 为无闰月,BIT3-0 对应农历第1-4 月的大小
;第二字节BIT7-0 对应农历第5-12 月大小,第三字节BIT7 表示农历第13 个月大小
;月份对应的位为1 表示本农历月大(30 天),为0 表示小(29 天).
;第三字节BIT6-5 表示春节的公历月份,BIT4-0 表示春节的公历日
DB 04dh,04Ah,0B8h; 2001
DB 00dh,04Ah,04Ch; 2002
DB 00dh,0A5h,041h; 2003
DB 025h,0AAh,0B6h; 2004
DB 005h,06Ah,049h; 2005
DB 07Ah,0Adh,0Bdh; 2006
DB 002h,05dh,052h; 2007
DB 009h,02dh,047h; 2008
DB 05Ch,095h,0BAh; 2009
DB 00Ah,095h,04eh; 2010
DB 00Bh,04Ah,043h; 2011
DB 04Bh,055h,037h; 2012
DB 00Ah,0d5h,04Ah; 2013
DB 095h,05Ah,0Bfh; 2014
DB 004h,0BAh,053h; 2015
DB 00Ah,05Bh,048h; 2016
DB 065h,02Bh,0BCh; 2017
DB 005h,02Bh,050h; 2018
DB 00Ah,093h,045h; 2019
DB 047h,04Ah,0B9h; 2020
DB 006h,0AAh,04Ch; 2021
DB 00Ah,0d5h,041h; 2022
DB 024h,0dAh,0B6h; 2023
DB 004h,0B6h,04Ah; 2024
DB 069h,057h,03dh; 2025
DB 00Ah,04eh,051h; 2026
DB 00dh,026h,046h; 2027
DB 05eh,093h,03Ah; 2028
DB 00dh,053h,04dh; 2029
DB 005h,0AAh,043h; 2030
DB 036h,0B5h,037h; 2031
DB 009h,06dh,04Bh; 2032
DB 0B4h,0Aeh,0Bfh; 2033
DB 004h,0Adh,053h; 2034
DB 00Ah,04dh,048h; 2035
DB 06dh,025h,0BCh; 2036
DB 00dh,025h,04fh; 2037
DB 00dh,052h,044h; 2038
DB 05dh,0AAh,038h; 2039
DB 00Bh,05Ah,04Ch; 2040
DB 005h,06dh,041h; 2041
DB 024h,0Adh,0B6h; 2042
DB 004h,09Bh,04Ah; 2043
DB 07Ah,04Bh,0Beh; 2044
DB 00Ah,04Bh,051h; 2045
DB 00Ah,0A5h,046h; 2046
DB 05Bh,052h,0BAh; 2047
DB 006h,0d2h,04eh; 2048
DB 00Ah,0dAh,042h; 2049
DB 035h,05Bh,037h; 2050
DB 009h,037h,04Bh; 2051
DB 084h,097h,0C1h; 2052
DB 004h,097h,053h; 2053
DB 006h,04Bh,048h; 2054
DB 066h,0A5h,03Ch; 2055
DB 00eh,0A5h,04fh; 2056
DB 006h,0B2h,044h; 2057
DB 04Ah,0B6h,038h; 2058
DB 00Ah,0Aeh,04Ch; 2059
DB 009h,02eh,042h; 2060
DB 03Ch,097h,035h; 2061
DB 00Ch,096h,049h; 2062
DB 07dh,04Ah,0Bdh; 2063
DB 00dh,04Ah,051h; 2064
DB 00dh,0A5h,045h; 2065
DB 055h,0AAh,0BAh; 2066
DB 005h,06Ah,04eh; 2067
DB 00Ah,06dh,043h; 2068
DB 045h,02eh,0B7h; 2069
DB 005h,02dh,04Bh; 2070
DB 08Ah,095h,0Bfh; 2071
DB 00Ah,095h,053h; 2072
DB 00Bh,04Ah,047h; 2073
DB 06Bh,055h,03Bh; 2074
DB 00Ah,0d5h,04fh; 2075
DB 005h,05Ah,045h; 2076
DB 04Ah,05dh,038h; 2077
DB 00Ah,05Bh,04Ch; 2078
DB 005h,02Bh,042h; 2079
DB 03Ah,093h,0B6h; 2080
DB 006h,093h,049h; 2081
DB 077h,029h,0Bdh; 2082
DB 006h,0AAh,051h; 2083
DB 00Ah,0d5h,046h; 2084
DB 054h,0dAh,0BAh; 2085
DB 004h,0B6h,04eh; 2086
DB 00Ah,057h,043h; 2087
DB 045h,027h,038h; 2088
DB 00dh,026h,04Ah; 2089
DB 08eh,093h,03eh; 2090
DB 00dh,052h,052h; 2091
DB 00dh,0AAh,047h; 2092
DB 066h,0B5h,03Bh; 2093
DB 005h,06dh,04fh; 2094
DB 004h,0Aeh,045h; 2095
DB 04Ah,04eh,0B9h; 2096
DB 00Ah,04dh,04Ch; 2097
DB 00dh,015h,041h; 2098
DB 02dh,092h,0B5h; 2099
DB 00dh,053h,049h; 2100
;以下子程序用于从当前公历日期,推算星期,
;入口:time_yeAr,time_month ,time_data ,定义公历年月日,BCD 码,其中月的
;以下子程序用于从当前公历日期,推算星期,
;入口:time_yeAr,time_month ,time_date ,定义公历年月日,BCD 码,其中月的
;年份存入r5,月份存入r6,日期存入r7(bcd码
;www.01mcu.com
time_week1 data 52h
week:
MOV A,time_yeAr
MOV B,#16
DIV AB
MOV temp_Byte1,B
MOV B,#10
MUL AB
ADD A,temp_Byte1
MOV temp_Byte1,A ;temp_Byte1=年
MOV A,time_month
JB ACC.7,getw02
MOV A,#100
ADD A,temp_Byte1
MOV temp_Byte1,A ;20 世纪年+100
MOV A,time_month
CLR ACC.7
getw02: JNB ACC.4,getw04
ADD A,#10
CLR ACC.4
getw04: MOV temp_Byte2,A ;temp_Byte2=月
MOV A,time_data
MOV B,#16
DIV AB
MOV temp_Byte3,B
MOV B,#10
MUL AB
ADD A,temp_Byte3
MOV temp_Byte3,A ;temp_Byte3=日
MOV A,temp_Byte1;
ANL A,#03h
JNZ getw10 ;非闰年转移
MOV A,temp_Byte2
CJNE A,#3,getw06
getw06: JNC getw10 ;月大于2 转移
DEC temp_Byte3 ;份小于等于2,又是闰年,日减1
getw10: MOV A,temp_Byte2;
LCALL get_CorreCt ;取月校正表数据
ADD A,temp_Byte1
MOV B,#7
DIV AB ;B 放年加校正日数之和后除7 的余数不先做这一步
;有可能数据溢出
MOV A,temp_Byte1
ANL A,#0fCh
RR A
RR A ;以上年除4 即闰年数
ADD A,B
ADD A,temp_Byte3
MOV B,#7
DIV AB
mov a,b
cjne a,#0,outout
mov b,#8
outout: ;星期日显示8
MOV time_week1,B
RET
get_COrreCt:
MOVC A,@A+PC
RET
DB 0,3,3,6,1,4,6,2,5,0,3,5
end
get_COrreCt:
MOVC A,@A+PC
RET
DB 0,3,3,6,1,4,6,2,5,0,3,5
end |