[comp.sys.handhelds] Jumpings Bandwagons. Calendars. HP48SX

ruhtra@turing.toronto.edu (Arthur Tateishi) (04/24/91)

Well, I've been looking at these recent calendar programs but I
just don't like to wait long to get a calendar. I added to
the wonderfully fast CALENDAR program to give it a terse display
of the month and year on the side. Sorry, it does go a little
slower now. However, typing in month and year were annoying so
I wrote a program to display the current month which later grew
to allow stepping back and forth by month. It's still quite fast.

Installing it
-------------
There are two programs below, MO and CALN. MO(short for monthly)
calls CALN(my version of CALENDAR). Download both into a directory
and run MO. Use the [NXT] key to get the next month and the
[UpArrow] key to go back a month. DDATE+ does all the date
calculations. Neat. (Well, I think so.)
This could easily be made into one program (sticking CALN as a
local variable to MO) but I like having CALN around for offball
stuff like birthdays and stuff.

Have fun and let me know if you like it.

Psst: Putting the Hide/Unhide/Wake programs into a library makes
them really nice to use.
--
Red Alert.
    -- Q, "Deja Q", stardate 43539.1
Arthur Tateishi                 g9ruhtra@zero.cdf.utoronto.edu

File: MO
----------------
%%HP: T(3)A(D)F(.);
@ This program calls the CALN program to display
@ the month.
@ It starts by displaying the current month and 
@ lets you step back and forth with the [UpArrow]
@ and NXT keys.
@
@ Anyways, I like it because it's reasonably fast.
@ April 1991   Arthur Tateishi
@
\<< DATE \-> d
  \<<
    DO d DUP IP
SWAP 100 * FP DUP2
100 / .01 + + 'd'
STO 10000 * CALN
      IFERR 0 WAIT
      THEN
      END IP
      CASE DUP 25
==
        THEN d -1
DATE+ 'd' STO
        END DUP 26
==
        THEN d 31
DATE+ 'd' STO
        END
      END
    UNTIL 0 ==
    END
  \>>
\>>
-----End of File MO ---

File: CALN
----------------
%%HP: T(3)A(D)F(.);
@
@ Written by Eric B. Davis
@ EXTENSIVELY Speed and Space Optimized by:
@	Eddie Wilborne
@	Pete Wilson
@ Slight slowdown and month/year display on right by:
@       Arthur Tateishi
@
@ Enter the month and year on the stack
@ and this program will generate a calendar.
@
@ Checksum: #2037h, Bytes: 480.5
\<< DUP2 100 / FP 100
* \->STR SWAP \->STR
"  " + DUP
  IF 2 2 SUB " " ==
  THEN "0" SWAP +
  END 1 3 SUB SWAP
+ \-> s
  \<< 1000000 / .01 +
\-> mon yrb
    \<< yrb mon + DUP
      IF mon 12 ==
      THEN yrb
1.000001 +
      ELSE yrb mon
1 + +
      END DDAYS 3 *
1.0518 ROT DDAYS 7
MOD NEG 7 + 3 * \->
ndays n
      \<<
"Su Mo Tu We Th Fr Sa "
s 1 1 SUB +
"
                  "
1 22 n - SUB
" 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31             "
0 84
        FOR o n o +
"\Ga" REPL 21
        STEP 1
ndays SUB + + CLLCD
2 \-> i
        \<<
          WHILE DUP
"\Ga" POS DUP 0 \=/
          REPEAT \->
p
            \<< DUP 1
p 1 - SUB " " + s i
i SUB + "
" + SWAP
p 1 + 200 SUB + 1
'i' STO+
            \>>
          END DROP
        \>> 1 DISP 7
FREEZE
      \>>
    \>>
  \>>
\>>