%%HP: T(3)A(D)F(.);
@ MOON2 by Dan Gerson;
@ graphics from MOON by Craig Finseth.
DIR
  MPHASE
    \<< RCLF -31 SF DEG ERASE { # 0h # 0h } PVIEW { # 40h # 1Ch }
      # 1Ah 0 360 ARC 26 28 MFRAC SWAP DROP MPLOT MFINI 7 FREEZE STOF
    \>>
  MTIME
    \<< MFRAC \-> PCT X
      \<< X 29.53058868 * DUP 'X' STO IP "d " + X FP 24 * IP + "h " + X FP
        1440 * 60 MOD IP + "m (" + PCT 100 * 0 RND + "%)" +
      \>>
    \>>
  MFRAC
    \<< RCLF 0 0 0 0 0 0 JDAT 2444239 - \-> FLGS M ML MM EV AE A3 day
      \<< RAD day .985647332099 * 360 MOD -3.762863 + 360 MOD D\->R 'M' STO
        'E=.016718*SIN(E)+M' 'E' M ROOT 2 / TAN 1.01686011182 * ATAN R\->D 2 *
        282.596403 + 360 MOD 'E' STO 13.1763966 day * 64.975464 + 360 MOD DUP
        'ML' STO .1114041 day * - 349.383063 - 360 MOD 'MM' STO ML E - 2 * MM
        - D\->R SIN 1.2739 * 'EV' STO M SIN DUP .1858 * 'AE' STO .37 * 'A3' STO
        MM EV + AE - A3 - DUP D\->R SIN 6.2886 * SWAP 2 * D\->R SIN .214 * SWAP
        EV + ML + AE - + DUP E - 2 * D\->R SIN .6583 * + E - DUP D\->R COS NEG
        1 + 2 / 'Illuminated' \->TAG SWAP 360 MOD 360 / 'Age' \->TAG FLGS STOF
      \>>
    \>>
  JDAT
    \<< 1.01198 DATE DDAYS 2444240 + TIME HMS\-> TMZN + 24 / +
    \>>
  MPLOT
    \<< \-> RA MI F
      \<<
        IF F .5 <
        THEN F 360 * COS RA * RA
        ELSE RA NEG F .5 - 360 * COS RA *
        END \-> L R
        \<< 1 0
          FOR x x ACOS SIN DUP MI x RA * + L R MLINE MI x RA * - L R MLINE RA
            INV NEG
          STEP
        \>>
      \>>
    \>>
  MLINE
    \<< \-> SC LI L R
      \<< SC L * 64 + R\->B LI R\->B 2 \->LIST SC R * 64 + R\->B LI R\->B 2
        \->LIST LINE
      \>>
    \>>
  MFINI @ Adds "stars" (just a few random fixed blobs)
    \<< { # Ah # Ah } PIXON
        { # 6Eh # Fh } PIXON
        { # 64h # 32h } PIXON
        { # 1Eh # 29h } PIXON
        { # 1Fh # 29h } PIXON PICT NEG
    \>>
  SLOFLIP
    \<< 0 63
      FOR l # 0h l R\->B 2 \->LIST # 82h l R\->B 2 \->LIST TLINE
      NEXT
    \>>
  E 109.444275789
END
