• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Functions for working with the idealized calendar of Planet Xhilr


Commit MetaInfo

Revisãocadfda1113be8e550b5feee4253a90589c6ff7f4 (tree)
Hora2017-06-13 18:16:48
AutorJoel Matthew Rees <joel.rees@gmai...>
CommiterJoel Matthew Rees

Mensagem de Log

Fixing errors, a little code cleanup

Mudança Sumário

Diff

--- a/econmonths.fs
+++ b/econmonths.fs
@@ -343,12 +343,12 @@ CELLBITS CELLWIDTH /MOD CONSTANT BYTEBITS CONSTANT LEFTOVERBITS
343343 ( Just best to do in assembler, along with UD* and UQD/MOD . )
344344
345345 ( Do it in assembler instead! Hundreds of times as slow!!!! )
346-: DIV2/ ( u1 --- u2 : Halve the top cell. REALLY SLOW! )
346+: DIV-2/ ( u1 --- u2 : Halve the top cell. REALLY SLOW! )
347347 S>D 2 UM/MOD SWAP DROP ;
348348
349349 ( Do it in assembler instead! Hundreds of times as slow!!!! )
350-: DIVD2/ ( ud1 --- ud2 : Halve the top double cell. REALLY SLOW! )
351- 2 UM/MOD ROT DROP ;
350+: DIV-D2/ ( ud1 --- ud2 : Halve the top double cell. REALLY SLOW! )
351+ 2 JM/MOD ROT DROP ;
352352
353353 ( Scaling, to keep the steps time-bounded, )
354354 ( is going to leave me at the binary long division )
@@ -755,7 +755,7 @@ CELLWIDTH NEGATE ALLOT ( Back up to store values. )
755755
756756
757757 ( Modern Forths will leave the initialization 0 behind. )
758-0 CONSTANT WKDAYOFFSET ( Weekday corresponding to day zero of year zero. )
758+6 CONSTANT WKDAYOFFSET ( Weekday corresponding to day zero of year zero. )
759759 0 VARIABLE 1STDAYOFWEEK ( Weekday corresponding to first day of week. )
760760 0 1STDAYOFWEEK !
761761
@@ -783,9 +783,6 @@ RD2LCYCLE 16 * CONSTANT NUCYCLE ( numerator: 7760 )
783783 : SMPERIOD10976 [ SMPERIODINT DECYCLE UM* SMPERIODFRAC10976 0 D+ SWAP ] LITERAL LITERAL ;
784784 ( 28 9645 / 10976 == 316973 / 10976 )
785785
786-0 CONSTANT SMOFFINT ( Slow moon offset at year 0 day 0, integer part. )
787-0 CONSTANT SMOFFFRAC10976 ( Fractional part. )
788-
789786 ( Modern Forths will leave the initialization 0 behind. )
790787 0 VARIABLE SMSTATEINT ( Slow moon state integer part. )
791788 0 SMSTATEINT ! 0 , ( Initialize cleared, make double variable. )
@@ -796,6 +793,27 @@ RD2LCYCLE 16 * CONSTANT NUCYCLE ( numerator: 7760 )
796793 : SM16THPERIOD10976 [ SMPERIOD10976 8. D+ 16 JM/MOD ROT DROP SWAP ] LITERAL LITERAL ;
797794 : SM32NDPERIOD10976 [ SMPERIOD10976 16. D+ 32 JM/MOD ROT DROP SWAP ] LITERAL LITERAL ;
798795
796+( start + mt = 1/2, start + gt = 3/4 => t * { g - m } = 1/4 => t = 1 / 4 * { g - m } )
797+( g = 1 rot/day, m = 10976 / 316973 rev/day => t = 1 / { 4 * [ 316973 - 10976 ] / 316973 } )
798+( s + gt = 3/4 => s = 3/4 - t; s = 3/4 - 1 / { 4 * [ 316973 - 10976 ] / 316973 } )
799+( s + mt = 1/2 => s = 1/2 - mt; s = 1/2 - 10976 / [ 4 * { 316973 - 10976 } ] )
800+( s = [ 2 * 316973 - 3 * 10976 ] / [ 4 * { 316973 - 10976 } ] )
801+( s = 601018 / 1223988 )
802+: SMTARGET
803+ [ 2. SMPERIOD10976 UMD* 2DROP 3 DECYCLE UM* D-
804+ SMPERIOD10976 UMD* ( Scale it py period and keep high double word. )
805+ 4. SMPERIOD10976 DECYCLE 0 D- UMD* 2DROP
806+ SLOW-UMD/MOD 2SWAP 2DROP SWAP
807+ ] LITERAL LITERAL ;
808+( Used SMTARGET like this with SMOFFFRAC10976 set to 0.: )
809+( 34 3 STYCYCLES 5 DMADJUST SMSTATEFRAC10976 D@ SMTARGET D- D. 76151 )
810+0 CONSTANT SMOFFINT ( Slow moon offset at year 0 day 0, integer part. )
811+: SMOFFFRAC10976 ( Fractional part. ) [ 76151. SWAP ] LITERAL LITERAL ;
812+
813+( Below was guessing wrong: )
814+( [ SM32NDPERIOD10976 28 UDS* DROP )
815+( SM32NDPERIOD10976 DIV-D2/ D+ 4 JM/MOD ROT DROP SWAP ] )
816+
799817 ( Could pre-divide the period into 16ths but this is an output function, )
800818 ( can be a little slow. )
801819 : SMSHOWPHASE ( --- ) ( --- ) ( Show the Slowmoon phase with no spacing. )
@@ -912,7 +930,7 @@ RD2LCYCLE 16 * CONSTANT NUCYCLE ( numerator: 7760 )
912930 ( Intended to be called from STYCYCLES. Other use will leave things out of sync. )
913931 : SLOMSTCYCLES ( ddays --- )
914932 DECYCLE S>D UMD* SMPERIOD10976 SLOW-UMD/MOD
915- 2SWAP SMOFFFRAC10976 S>D D+
933+ 2SWAP SMOFFFRAC10976 D+
916934 2DUP SMPERIOD10976 D< 0= IF
917935 SMPERIOD10976 D- 2SWAP 1. D+ 2SWAP
918936 THEN