***************************************************************************** * DOCUMENTATION FILE FOR HP48SX CALENDAR DRAWING FUNCTIONS * * * * by Kevin Jessup October 19th, 1990 * ***************************************************************************** If you have successfully loaded the binary CALENDAR directory file, a directory named "CALENDAR" should now be in your current working directory. Verify the following... Checksum: # EA4E (hex) or # 59982 (decimal) Byte count: 2449 Note: The checksum will change if the day, month or year global variables have been modified since you downloaded the directory! Introduction ------------ These routines will display a calendar graphic for a specific year and month on the 48SX display. Functions are provided to move the calendar forward or backwards in month or year increments. Day of week and leap year func- tions are also provided. The CALENDAR directory should contain the following objects in the order they appear below. For ease of use, DO NOT re-order the directory. Objects preceeded with an asterisk (*) are described in detail later. All other objects are subroutines used by the main functions and are NOT described. A listing of ALL objects is provided at the end of the documentation. Name Object type Purpose ------- ----------- -------------------------------------------------- * CURR program Draws a calendar for the current month. * <-Y program Draws a calendar for the previous year, same month. * Y-> program Draws a calendar for the next year, same month. * <-M program Draws a calendar for the previous month, same year. * M-> program Draws a calendar for the next month, same year. * PCAL program Prints the last calendar dislayed. * CAL program Given specific month and year, draws the calendar. * DOW program Returns current day of week string to stack. * SDOW program Given a date, returns day of week string to stack. * RDOW program Given a date, returns day of week number to stack. * LPYR program Given a year, determines if it is a leap year. * ALMDATE? program Given a date, determines if any alarms are due. MOY list Months of the year. DIM list Number of days in the months. DOWL list Days of the week. GENC program Main calendar graphic generating function. FILLD program Adds days and alarm flags to the calendar graphic. MONTHBOX program Draws the calendar graphic lines and days of week. CPSDT program Compress date and time. EXPDT program Expand date and time. JFIX program Adjust for date mode. day real number year real number month real number PPAR list Plot parameters. Detailed function descriptions ------------------------------ CURR Draws a calendar for the current month. A graphic display of the month, year and appropriately positioned day numbers is generated. Days that have an alarm associated with them will contain a box to mark the alarm. <-Y Same as CURR but backs up one year. Y-> Same as CURR but moves forward one year. <-M Same as CURR but backs up one month. M-> Same as CURR but moves forward one month. PCAL Prints the current contents of the PICT variable. If some other program has not deleted PICT or modified it, the object printed should be the last calendar you displayed. CAL Given a date on the stack in valid HP48SX date format (MM.DDYYYY or DD.MMYYYY) displays the calendar for the month as in CURR. DOW Returns the current day of week text string to the stack. SDOW Given a date as in CAL, returns the day of week text string to the stack. RDOW Same as SDOW but returns a real number. Sunday = 0, Monday = 1, ... Saturday = 6. LPYR Given a year on level 1, returns 1 if it is a leap year, else 0. ALMDATE? Given a date as in CAL, returns 1 if alarms are due on that date, else 0. Warranties and Support ---------------------- None provided. Programs are supplied AS IS. Shareware --------- Please support the HP48SX "shareware" concept by either contributing a few bucks to the author (address below) or posting your own USEFULL programs on the HP48SX BBS! Kevin Jessup 9118 N. 85th St. Milwaukee, WI 53224 Directory object ASCII listing ------------------------------ %%HP: T(3)A(D)F(.); DIR CURR \<< DATE CAL \>> \<-Y \<< 'year' 1 STO- GENCAL \>> Y\-> \<< 'year' 1 STO+ GENCAL \>> \<-M \<< IF month 1 - DUP 1 < THEN DROP 12 'year' 1 STO- END 'month' STO GENCAL \>> M\-> \<< IF month 1 + DUP 12 > THEN DROP 1 'year' 1 STO+ END 'month' STO GENCAL \>> PCAL \<< PICT RCL PR1 DROP \>> CAL \<< EXPDT JFIX 'year' STO 'month' STO 'day' STO GENCAL \>> DOW \<< DATE SDOW \>> SDOW \<< 0 TSTR 1 3 SUB \>> RDOW \<< SDOW DOWL SWAP POS 1 - \>> LPYR \<< \-> y \<< y 4 MOD NOT y 100 MOD AND y 400 MOD NOT OR \>> \>> ALMDATE? \<< IF DUP FINDALARM DUP THEN RCLALARM 1 GET == ELSE DROP 0 END \>> MOY { "JANUARY" "FEBRUARY" "MARCH" "APRIL" "MAY" "JUNE" "JULY" "AUGUST" "SEPTEMBER" "OCTOBER" "NOVEMBER" "DECEMBER" } DIM { 31 28 31 30 31 30 31 31 30 31 30 31 } DOWL { "SUN" "MON" "TUE" "WED" "THU" "FRI" "SAT" } GENCAL \<< { # 0d # 0d } PVIEW MONTHBOX MOY month GET " " + year \->STR + 1 \->GROB DUP SIZE DROP # 131d SWAP - # 2d / # 2d 2 \->LIST PICT SWAP ROT REPL FILLDAYS 7 FREEZE \>> FILLDAYS \<< 1 month year JFIX CPSDT RDOW 0 1 DIM month GET IF month 2 == year LPYR AND THEN 1 + END FOR d PICT 3 PICK R\->B # 18d * # 6d + 3 PICK R\->B # 8d * # 16d + 2 \->LIST d \->STR d month year JFIX CPSDT IF ALMDATE? THEN 1 CHR + END 1 \->GROB REPL SWAP IF 1 + DUP 6 > THEN DROP 0 SWAP 1 + SWAP END SWAP NEXT DROP2 \>> MONTHBOX \<< # 131d # 62d BLANK PICT STO { # 2d # 0d } { # 128d # 0d } LINE { # 2d # 0d } { # 2d # 61d } LINE { # 128d # 0d } { # 128d # 61d } LINE # 14d 1 7 START # 2d OVER 2 \->LIST OVER # 128d SWAP 2 \->LIST LINE # 8d + NEXT DROP # 20d 1 6 START DUP # 15d 2 \->LIST OVER # 62d 2 \->LIST LINE # 18d + NEXT DROP # 5d 1 7 FOR i DUP # 8d 2 \->LIST DOWL i GET 1 3 SUB 1 \->GROB PICT 3 ROLLD REPL # 18d + NEXT DROP \>> CPSDT \<< 10000 / SWAP IP + 100 / SWAP IP + \>> EXPDT \<< DUP IP SWAP FP 100 * DUP IP SWAP FP 10000 * \>> JFIX \<< IF -42 FC? THEN 3 ROLLD SWAP 3 ROLL END \>> day 19 year 1990 month 10 PPAR { (-6.5,-3.1) (6.5,3.2) X 0 (0,0) FUNCTION Y } END