From: jrl@images1.waterloo.NCR.COM (john Latala)
Newsgroups: comp.sources.hp48
Subject: v04i004:  bclk - Large digit clock display v1.0, Part01/01
Date: 29 Feb 92 19:18:53 GMT
Followup-To: comp.sys.hp48
Organization: NCR Canada Ltd, Waterloo, Ontario, Canada.

Checksum: 1721112255 (verify with brik -cv)
Submitted-by: john Latala <jrl@images1.waterloo.NCR.COM>
Posting-number: Volume 4, Issue 4
Archive-name: bclk/part01


BEGIN_DOC bclk.doc
This directory contains two programs to display a digital clock on the
HP48s. The 'simple' one, CLK2, just displays the time in HH:MM format,
changing the display every minute. The fancy one, CLK1, uses the same
format HH:MM format as CLK2, but the minutes unit digit slowly rolls up.
Just like the odometer in your car or some clocks still do!

This is basically a '48 port of an old '28 program that I posted many
moons ago.

The program actually cheats by creating a GROB which if quite narrow,
but very tall, to store all the digits. To show the 'static' digits it
just takes chunks out of this GROB to build the screen display. 

The messy part was getting the vertical scrolling correct. Especially
the 'odd' cases: HH:M9, HH:59, H9:59, and 23:59. The 23:59 case was one
I initially forgot when I first wrote the program.  These weird cases
are the reason for the structure if the CSET variable.

The variable has four pieces, "01234567890" used for the units digits of
the hours and minutes, "0123450" used for the tens of minutes, "0120"
used for the tens of hours and "30" used for the units minutes at 23:59

Just run either CLK1 or CLK2. If the DIGITS variable doesn't exist then
it will be created. After that it will just be used. The DIGITS variable
is quite large, 2080 as reported by BYTES.
END_DOC


BEGIN_RDM bclk.rdm

[ I stuck these routines in the directory with the bclk
programs.  This text was left for the explanation of the programs
included. You do not need to download these programs for bclk to
work.  Only download bclk.bin. -chris ]

The routines call CHKARG, that checks the number and type of calling
arguments. They also use a routine called UTIME and reference a variable
called TNames from port 0.

I put the TNames variable into port 0 because it's used by a number of
other routines that I have and I wanted it out of the way (i.e. not in
the home directory). Basically it's just a list of strings giving a
human readable name to each variable type that the HP has:

-------------------- Start of :0:TNames --------------------

%%HP: T(3)A(D)F(.);
{ "Real" "Complex" "String" "RealArray" "ComplexArray" "List" "GlobalName"
  "LocalName" "Program" "Algebraic" "Binary" "GraphicObj" "TaggedObj"
  "UnitObj" "XLibrary" "Directory" "Library" "BackupObj" "BltInFnc" "BltInCmd"
  "Type20" "Type21" "Type22" "Type23" "Type24" "Code" }

--------------------- End of :0:TNames ---------------------

The UTIME routine just takes a time in HH.MMSSTT format on the stack and
unpacks it into HH, MM, SS, TT.

-------------------- Start of UTIME --------------------

%%HP: T(3)A(D)F(.);
"D9D20E16329C2A2803A23013278BF1D6BB1DBBF13ABB13392020000000000000
10EEDA1C423233920200000000000001050FA176BA193632B213023E5"

--------------------- End of UTIME ---------------------

Finally CHKARG takes two arguments: a name and a list. The name is the
name of the calling routine and the argument list is a list showing the
expected types of arguments. If you had a routine TEST that took three
arguments: a directory, a GROB and a list you could code it like:

	<<
	  'TEST' { DIR END GROB 1 1 00 { } } CHKARG
	  ... body of TEST ...
	>>

CHKARG will make sure that there are three arguments on the stack and
that their types are DIR, GROB and LIST. If the types don't match, or
there aren't enough arguments then CHKARG never returns, using DOERR to
display an informative error message.

-------------------- Start of CHKARG.ARC --------------------

%%HP: T(3)A(D)F(.);
"D9D20E16323CE2244CF14B2A2D5CE1AFE22D9D203CE2292CF168BC14563284E2
010859763268BC1279E192CF168BC147A20B213068BC1279E1387E1AFE22D9D2
044CF1ED2A290DA1E0CF1B0BC1ED2A292CF18B9C19C2A290DA1C58C11C432D6E
2070162776C6963747D6E204016277637D6E2040E616D656E16323CE22D6E207
0162776C69637478B9C1D6E204016277637D5CE1AFE22D9D20D6E2040E616D65
6C2A2011000A30274F6470276BA1D6E204016277637B0BC176BA1C2A20D00000
216277676BA13CE22D6E2040162776379C2A2D9AE1AFE22D9D20C2A207000037
76BA1B21305DF2233920100000000000001066BC176BA1C2A205100002020202
020202029C2A2D6E2040E616D6568B9C1C58C176BA1C2A20310000202E456564
60276BA1D6E2070162776C69637478B9C1B0BC176BA1933A1B21305BF22D9D20
9C2A2D6E2070162776C69637478B9C14B2A21C432D6E2030162776D6E2040162
77637D6E204046F6E656E16323C0323CE22D6E204016277637D6E20301627769
C2A290DA190DA1A9CF168BC1D6E2070162776C6963747D6E20301627766C7D16
8BC1D9AE1AFE22D9D20CFA20100384E206045E416D6563704B021C432D6E2080
162776E616D65637E1632D6E2040E616D656C2A2070000A376BA1D6E20301627
76B0BC176BA1C2A2031000A3027516E6470276BA1D6E2080162776E616D65637
D6E2070162776C6963747D6E20301627766C7D168BC19C2A276BA16C7D176BA1
33920100000000000001066BC176BA1C2A20D000074F6470276BA1D6E2080162
776E616D65637D6E204016277637D6E20301627769C2A290DA190DA1ED2A276B
A1A9CF168BC19C2A276BA16C7D176BA1933A1EF532B21305DF229C2A245632D6
E203016277697632B4402DE032D6E2030162776D6E204016277637D5CE1D6E20
4046F6E656908E19B632EF532B21305DF22EF532B21305BF22D9D201C432D6E2
040E616D656D6E2070162776C6963747E1632D6E2040E616D656B0BC1ED2A292
CF18B9C19C2A290DA1C58C1D6E2040E616D656C2A2031000A302E45656460276
BA1D6E2070162776C69637478B9C1B0BC176BA1C2A20D00000216277676BA13C
E22D6E2070162776C69637479C2A2D9AE1AFE22D9D20C2A20700003776BA1B21
305DF22933A1EF532B21305DF22B21305BF22D9D20C2A20D20003484B4142574
A302E4F60216277657D656E64737933A1B21305DF2293632B213001E8"

--------------------- End of CHKARG.ASC ---------------------
END_RDM



BCLK.BIN: BYTES: #4956h 7180.5

-- 
john.Latala@Waterloo.NCR.COM

/EARTH is 90% full, please delete anything superfluous...

