================================
PROTSEDURKA "Calendar"
================================
*
In the journal "ZX-REVYU'97, 7 / 10" would
la article (C), Jessica Justice, in
he gives BASIC-process calendar and suggested "re
throw "it into the code. Since BASIC
I almost do not know, but the calculator will never understand,
I wrote a similar protsedurku in code, which does not use a
calculator, or ROM. Actually, this can not be called
protsedurku vat "graceful", and length (313
bytes excluding BC and DE) velikovata, but the year you can
choose from 1 to 65535. At the entrance: D - month
E - number, BC - a year. At the exit of
A - number of days a week (1 - resurrection
Seigner, 2 - Monday, March - the second
nickname, etc).. If you need to know, NE
us to a leap year, or
No - it is possible to calculate, for
measures as follows:
LD BC, # 0704
LD A, (YEARS +1)
YEAR0 CP # 1B
JR Z, Leap
ADD A, C
DJNZ YEAR0
... Non-leap
In other words, if the content (YEARS +1) = 3,7,11,15,19,23,
27, means a leap year. Please note that this "modern" calendar
(and do not worry;) ...
************************ TOP ***
YEARS LD A, # 17
INC A
CP # 1C
JR NZ, YEAR1
XOR A
YEAR1 LD (YEARS +1), A
DEC BC
LD A, B
OR C
JR NZ, YEARS
LD HL, TABLE
LD C, D
DEC C
ADD HL, BC
LD C, # 0C
LD D, # 11
LD A, (YEARS +1)
OR A
JR Z, YEAR2
CP # 06
JR Z, YEAR2
CP D
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
CP # 0B
JR Z, YEAR2
CP D
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
CP # 0B
JR Z, YEAR2
CP # 16
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
CP # 06
JR Z, YEAR2
CP D
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
CP # 0B
JR Z, YEAR2
CP D
JR Z, YEAR2
ADD HL, BC
SUB # 02
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
CP # 06
JR Z, YEAR2
CP D
JR Z, YEAR2
ADD HL, BC
DEC A
JR Z, YEAR2
CP # 0B
JR Z, YEAR2
CP D
JR Z, YEAR2
ADD HL, BC
SUB # 02
JR Z, YEAR2
ADD HL, BC
SUB # 04
JR Z, YEAR2
ADD HL, BC
SUB # 04
JR Z, YEAR2
ADD HL, BC
SUB # 04
JR Z, YEAR2
ADD HL, BC
YEAR2 LD A, (HL)
ADD A, E
YEAR3 CP # 08
RET C
SUB # 07
JR YEAR3
TABLE DB 5,1,1,4,6,2,4,0,3,5,1,3
DB 6,2,2,5,0,3,5,1,4,6,2,4
DB 0,3,3,6,1,4,6,2,5,0,3,5
DB 1,4,5,1,3,6,1,4,0,2,5,0
DB 3,6,6,2,4,0,2,5,1,3,6,1
DB 4,0,0,3,5,1,3,6,2,4,0,2
DB 6,2,3,6,1,4,6,2,5,0,3,5
DB 1,4,4,0,2,5,0,3,6,1,4,6
DB 2,5,5,1,3,6,1,4,0,2,5,0
DB 4,0,1,4,6,2,4,0,3,5,1,3
DB 2,5,6,2,4,0,2,5,1,3,6,1
DB 0,3,4,0,2,5,0,3,6,1,4,6
DB 5,1,2,5,0,3,5,1,4,6,2,4
DB 3,6,0,3,5,1,3,6,2,4,0,2
************************ END ***