Commit: b4f8052892cdd51bcaad9cfe98e37842190945e0 Author: Vi Grey Date: 2022-08-25 04:59 UTC Summary: Fix Jewish Calendar for years before 3 AM CHANGELOG.md | 8 ++++++++ README.md | 35 +++++++++++++++++++++++++---------- SHA256SUMS.txt | 14 +++++++------- bin/calendar_dot_exe.nes | Bin 24592 -> 24592 bytes src/jewish.asm | 46 +++++++++++++++++++++++++++++++++++++++++++--- src/prg.asm | 2 +- src/ram.asm | 5 ----- src/start.asm | 2 +- 8 files changed, 85 insertions(+), 27 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f5d54d..8dcba91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,14 @@ # Change Log All notable changes to this project will be documented in this file. +## 0.0.5 - 2022-06-24 +### Changed +- Default year in start screen to 2023 + +### Fixed +- Jewish calendar system rules for years -999999 AM through 2 AM +- Error that caused Monday after leap year rule in Jewish calendar to be incorrect + ## 0.0.4 - 2022-06-23 ### Added - Jewish calendar system diff --git a/README.md b/README.md index 93b57bd..3ed40a6 100644 --- a/README.md +++ b/README.md @@ -125,18 +125,23 @@ Chalakim = 1 / 1080 of an hour * All other years are not leap years * Leap years are 13 months long * All other years are 12 months long -* Find Tishrei 1 of current year by finding the Molad Tishrei of the current year. Molad Tishrei of 2 AM was Friday 14 hours 0 chalakim +* Find Tishrei 1 of current year by finding the Molad Tishrei of the current year. The Molad Tishrei of 2 AM was Friday 14 hours 0 chalakim * If era is AM - * For every month since Molad Tishrei of 2 AM, add 29 days 12 hours 793 chalakim + * For every month since the Molad Tishrei of 2 AM, add 29 days 12 hours 793 chalakim * If era is -AM - * For every month before Molad Tishrei of 2 AM, subtract 29 days 12 hours 793 chalakim - * Set Tishrei 1 to Molad Tishrei - * If Molad Tishrei is on or after 18 hours 0 chalakim, postpone Tishrei 1 by 1 day - * If Tishrei 1 is now on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day - * If Molad Tishrei is on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day - * If the current year is not a leap year and Molad Tishrei occurs on a Tuesday on or after 9 hours 204 chalakim, postpone Tishrei by 1 day - * If Tishrei 1 is now on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day - * If the current year is a year after a leap year and Molad Tishrei occurs on a Monday on or after 15 hours 889 chalakim, postpone Tishrei by 1 day + * For every month before the Molad Tishrei of 2 AM, subtract 29 days 12 hours 793 chalakim + * Set Tishrei 1 to the Molad Tishrei + * If era is AM and year is greater than or equal to 3 + * If the Molad Tishrei is on or after 18 hours 0 chalakim, postpone Tishrei 1 by 1 day + * If Tishrei 1 is now on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day + * If the Molad Tishrei is on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day + * If the current year is not a leap year and the Molad Tishrei occurs on a Tuesday on or after 9 hours 204 chalakim, postpone Tishrei by 1 day + * If Tishrei 1 is now on a Sunday, Wednesday, or Friday, postpone Tishrei 1 by 1 day + * If the current year is a year after a leap year and the Molad Tishrei occurs on a Monday on or after 15 hours 889 chalakim, postpone Tishrei by 1 day + * If era is AM and year is less than 2 + * If the Molad Tishrei is on or after 18 hours 0 chalakim, postpone Tishrei 1 by 1 day + * If era is -AM + * If the Molad Tishrei is on or after 18 hours 0 chalakim, postpone Tishrei 1 by 1 day * Find Tishrei 1 of the year after the current year (same steps as above, but for the year after the current year) * If current year is a Leap Year * If next year's Tishrei 1 is the same weekday as this year's Tishrei 1, both Cheshvan and Kislev with have 30 days @@ -147,6 +152,16 @@ Chalakim = 1 / 1080 of an hour * If next year's Tishrei 1 is 3 weekdays before this year's Tishrei 1, Cheshvan will have 29 days and Kislev with have 30 days * All other cases result in both Cheshvan and Kislev having 29 days +#### **WARNING - BRIEF THEOLOGICAL CONTENT FOR CONTEXT** + +The rule about Tishrei 1 being postponed if it would have landed on a Sunday, Wednesday, or Friday is to prevent Yom Kippur from landing on a Friday or Sunday and to prevent Hoshana Rabbah from landing on a Saturday (Shabbat). If Yom Kippur landed on a Friday, then fasting would be followed by a day where meals cannot be prepared. If Yom Kippur landed on a Sunday, then a meal could not be prepared to break the fast on Yom Kippur the day before Yom Kippur. Hoshana Rabbah has a tradition involving beating willow twigs, which would be considered work and could not be done on Shabbat. + +Year 2 AM ignores the Sunday and Friday part of that rule. Year 2's the Molad Tishrei is Friday 14 Hours 0 Chalakim, which is set at the creation time of Adam. Being on a Friday would push Tishrei 1, even though Tishrei 1 on year 2 AM is specified as the day Adam was made. This would normally cause an issue, but the only reason Tishrei 1 is postponed is when the Molad Tishrei is Friday or Sunday is because Yom Kippur involves a fast due to attone for the sins of the previous year. Because Adam and Eve were not around in year 1, there would be no reason to observe Yom Kippur in year 2. Because Yom Kippur wouldn't have been observed that year, there wouldn't be a reason to postpone Tishrei 1 by 1 day, which allows Tishrei 1 of 2 AM to be a Friday and match with the creation of Adam. + +Year 1 AM and all -AM years ignore the Sunday and Friday part of the rule for the same reason as year 2 AM, due to Yom Kippur not being observed those years. Year 1 AM and all -AM years also ignore the Wednesday part of the rule because Hoshana Rabbah is a holiday that involves judgement for sins, which wouldn't have been committed yet. + +#### **WARNING (FINISHED) - BRIEF THEOLOGICAL CONTENT FOR CONTEXT** + ### Parker A Calendar Rules: * If era is AD diff --git a/SHA256SUMS.txt b/SHA256SUMS.txt index a6b75f1..22f66a9 100644 --- a/SHA256SUMS.txt +++ b/SHA256SUMS.txt @@ -1,9 +1,9 @@ 1dee9843850467e11e6498d5cdb038db3c9566c00afc7afa2ce82f67f145b75a .gitignore -4830f2903e6a620a3b3f59b70be1f72555b05f8507c73b8d081e0ecea1524b20 CHANGELOG.md +3e68f7b6b75eca3b7f0db3bd39130a7d39d4a71d56fb5adc0fc2bd21b1673b9e CHANGELOG.md 75f1b35ea4909116b76be7e657db5dbba521653ce6399fca02e2bae3879c479b LICENSE 047b195f25381e5db79e1015c7cb3633c122d215d166f85fb91e882694358aa0 Makefile -27172523cefd7bb2b401551c1002031973a66142d0ef3c47874082cf8bb744de README.md -96ed71b7f0024683ff3619f6e3983dc8249bdf8b882cc701229925568ba9de0b bin/calendar_dot_exe.nes +a2b79564d41ac3e0bfdb7a8ba3199ea703e73481d4742acb629e9e48d8028dab README.md +94db0d1455ac347551492583fa929e894b53dfc96451eaf15b682d12781fbe98 bin/calendar_dot_exe.nes 1e024cbc90486bb8bf0fdc258110ddb88344080c456551357fc86cd28ed53696 src/alphanum.asm e6fae483791b3eec96ec1bfa75916a9bf4179e525a10c5455036668fd31dcc16 src/calendar_dot_exe.asm 3daef5d60334da623839ea92cbc68c051a7f7bda7de569635e40d5f46f249780 src/calendars.asm @@ -15,7 +15,7 @@ f01e0a01ff1d3dba0eed8fb7019726ebef36490a733d84c1fcfab52d8600fbc7 src/defs.asm 8a2a8611e2d8f292331822d88bd8762060a599c9bc8607f4bc329121ed58c5c1 src/frames.asm 4f60fa82d38d963476fc93d66de82f9892261d64b084af4889447e9c76f5faec src/graphics.asm be8a1d5421b479eac2d5a256e0d1ea2a2fdee4a320e65cb0311f0df46d277cf3 src/gregorian.asm -82d44b97f1513dc2e617e9d9d0c9c7c2d2c0d1450e73cf12cac7748f09ef389d src/jewish.asm +775005969a2033dcdd1833a6df142a95a7541b72c01ef04c74dae1e3eaffde72 src/jewish.asm 6515ea8ad2d5759fb629610a7b02266fb3598868f23bd339e18321412769b93a src/julian.asm da6a76822f22e0fef23a5f0a45c13a6be9510da8474035688d251db348b8afde src/leap-year.asm f29d90c19806e9e6a942db7c09b27dcbb2213b599b11bd01a6a87e58ad43959d src/macrobius.asm @@ -23,9 +23,9 @@ f29d90c19806e9e6a942db7c09b27dcbb2213b599b11bd01a6a87e58ad43959d src/macrobius. dae0ed60bea19c6f58e6105e1a212c8656fc21aab31c0ae0ace32d6fd3415bc0 src/months.asm 192531053db66d49d637573c59c58759620048a8551a8bdfff456b1602895bcc src/parker.asm 2da05cfa9841b88b0a3731df315d5e8cbe7ae158bedc921ac495c9f7d206642a src/parkera.asm -7c9e2e56f561f4ceac038d90cc3add9b4237e300167459415d2c8a9ad8735a7b src/prg.asm -c3d458d6dfd82b765bdbf6d1a58e0793369b170f60eb958d51b66409e33b5696 src/ram.asm -28183dd8f86ab98450e001d30f50d632ee4f3985e0d371b61c2dd736a03737ed src/start.asm +5c7b0e519bca4c85b450b4f9cb44502e6a57be22c7a3a33eb68b8e025b1aa3d8 src/prg.asm +d485f77129d0affef09f34321d841428b77e8ac296b949dc9b8ac0d17bc9a75b src/ram.asm +a59dba2a87cdf73690010920aef7fda484fee317485f3db91b6303485eed1552 src/start.asm 388794b398b954961b30de77e390d36431ad1b056f7484bff881b94466f45be6 src/year.asm fc56c6164d414129d0341bb6c4092e39e536118f982f12102f3e46010212ddd1 src/graphics/calendar.nam e84832e79458c59ddf17ff23ae3003f8fca4e4417c3b84e2aef09e33b260a9f5 src/graphics/palettes.pal diff --git a/bin/calendar_dot_exe.nes b/bin/calendar_dot_exe.nes index 049d9bc..b25c58c 100644 Binary files a/bin/calendar_dot_exe.nes and b/bin/calendar_dot_exe.nes differ diff --git a/src/jewish.asm b/src/jewish.asm index 7316140..7c97122 100644 --- a/src/jewish.asm +++ b/src/jewish.asm @@ -784,6 +784,27 @@ GetTishriPostpone: sbc #$07 sta tmp GetTishriPostponeHour18Done: + lda era + cmp #ERA_AM + bne GetTishriPostponeBefore2AM + lda year + bne GetTishriPostponeCheckDay035 + lda (year + 1) + bne GetTishriPostponeCheckDay035 + lda (year + 2) + bne GetTishriPostponeCheckDay035 + lda (year + 3) + bne GetTishriPostponeCheckDay035 + lda (year + 4) + bne GetTishriPostponeCheckDay035 + lda (year + 5) + cmp #$03 + bcs GetTishriPostponeCheckDay035 +GetTishriPostponeBefore2AM: + ; tishriePostpone = $09 + ; jewishYearType = $0A + rts +GetTishriPostponeCheckDay035: lda tmp beq GetTishriPostponeDay035 cmp #$03 @@ -821,7 +842,7 @@ GetTishriPostponeMondayRule: cmp #$01 bne GetTishriPostponeMondayRuleDone lda moladHours - cmp #$15 + cmp #15 bcc GetTishriPostponeMondayRuleDone bne GetTishriPostponeMondayRuleApply lda moladChalakim @@ -857,6 +878,25 @@ GetJewishYearType: sbc #$07 sta tmp GetJewishYearTypeHour18Done: + lda era + cmp #ERA_AM + bne GetJewishYearTypeBefore2AM + lda year + bne GetJewishYearTypeCheckDay035 + lda (year + 1) + bne GetJewishYearTypeCheckDay035 + lda (year + 2) + bne GetJewishYearTypeCheckDay035 + lda (year + 3) + bne GetJewishYearTypeCheckDay035 + lda (year + 4) + bne GetJewishYearTypeCheckDay035 + lda (year + 5) + cmp #$04 + bcs GetJewishYearTypeCheckDay035 +GetJewishYearTypeBefore2AM: + jmp GetJewishYearTypeMondayRuleDone +GetJewishYearTypeCheckDay035: lda tmp beq GetJewishYearTypeDay035 cmp #$03 @@ -886,7 +926,7 @@ GetJewishYearTypeTuesdayRule: GetJewishYearTypeTuesdayRuleApply: lda #$02 sta jewishYearType - rts + jmp GetJewishYearTypeMondayRuleDone GetJewishYearTypeTuesdayRuleDone: GetJewishYearTypeMondayRule: lda leapYear @@ -895,7 +935,7 @@ GetJewishYearTypeMondayRule: cmp #$01 bne GetJewishYearTypeMondayRuleDone lda moladHoursTmp - cmp #$15 + cmp #15 bcc GetJewishYearTypeMondayRuleDone bne GetJewishYearTypeMondayRuleApply lda moladChalakimTmp diff --git a/src/prg.asm b/src/prg.asm index b054ece..d61c2be 100644 --- a/src/prg.asm +++ b/src/prg.asm @@ -69,7 +69,7 @@ InitializeCPURAMLoop: sta (year + 3) lda #$02 sta (year + 4) - lda #$02 + lda #$03 sta (year + 5) lda #ERA_AD sta era diff --git a/src/ram.asm b/src/ram.asm index 8642d2d..22c380a 100644 --- a/src/ram.asm +++ b/src/ram.asm @@ -35,17 +35,12 @@ moladHoursTmp dsb 1 moladChalakimTmp dsb 2 - - - tishriePostpone dsb 1 jewishYearType dsb 1 leapYear dsb 1 afterLeapYear dsb 1 beforeLeapYear dsb 1 - - moladYears dsb 1 screen dsb 1 diff --git a/src/start.asm b/src/start.asm index dfaa34b..7964eea 100644 --- a/src/start.asm +++ b/src/start.asm @@ -33,7 +33,7 @@ StartMenuTitle: .byte "CALENDAR[DOT[EXE" StartMenuVersion: - .byte " v0.0.4" + .byte " v0.0.5" StartMenuTitleBoxTop: .byte $C0, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C1, $C3, $00, $00