[comp.sys.handhelds] HP48SX Analog Clock

squires@delta.eecs.nwu.edu (Matt Squires) (03/13/90)

(is there an HP48SX archive somewhere?  Bob?)

Here is a submission for the Useless HP48SX Demo Program Archive, an
analog clock.  I execute << OFF CLOCK >> when I am done using my 48 for
a while.

MKFACE generates FACE, the background picture.  You only need to run this
once.  It takes about 15 secs to execute (ARCs are slow).

Once you have a FACE, you can run CLOCK every time you want to impress your
friends.

Please send comments, bug fixes to squires@eecs.nwu.edu

Matt Squires



CLOCK bytes: 425.5 checksum: [43E6h]
<<
	RCLF					; Recall flags

	-16 SF					; Polar, degrees, complex
	-17 CF
	-18 CF					
	-19 SF

	ERASE

	'PPAR' PURGE				; Reset PPAR

	PICT { # 34d # 1d } FACE GOR		; Draw "face" centered

	TIME HMS->

	-> t					; Grab the time

	<<
		1.55				; Hour hand length
		t 12 MOD 30 * NEG 90 +		; convert time to degrees
		->V2
		(0,0)
		OVER LINE

		DUP _				; hour hand arrow
		2 \/  INV *
		V-> 45 + ->V2
		SWAP OVER LINE
		DUP
		V-> 90 - ->V2
		SWAP OVER LINE
		DUP _
		2 \/  *
		V-> 45 + ->V2
		LINE

		2.7				; Minute hand length
		t FP 360 * NEG 90 +		; convert to degrees
		->V2
		(0,0)
		LINE

	>>
	
	STOF					; restore flags

	'PPAR' PURGE				; get rid of annoying PPAR

	{ } PVIEW

>>

MKFACE bytes: 306.5 checksum: [47A6h]
<<
	RCLF

	-16 SF
	-17 CF
	-18 CF
	-19 SF

	ERASE

	'PPAR' PURGE				; reset PPAR

	(0,0) 3.1 0 360 ARC			; circle

	0 359 FOR d				; ticks every hour
		2.8 d ->V2
		3.1 d ->V2
		LINE
	30 STEP

	(-.2,-.2) (.2,.2) BOX

	PICT (-3.1,-3.1) (3.1,3.1) SUB

	'FACE' STO

	STOF
>>

prestonb@hpcvra.CV.HP.COM (Preston Brown) (03/16/90)

To make the program work better in a control alarm I made a change in
the clock program: change {} PVIEW to { #0 #0 } PVIEW 7 FREEZE.

You can then store  an alarm with a repeat of one min and a exec
of \<< DROP CLOCK \>>.  Then the clock will update every min.

Preston