Newsgroups: comp.sys.handhelds Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!news.cs.indiana.edu!rsg1.er.usgs.gov!rsg1.er.usgs.gov!stevev From: stevev@greylady.uoregon.edu (Steve VanDevender) Subject: HP-48 visual clock program Message-ID: Sender: news@rsg1.er.usgs.gov Organization: University of Oregon Chemistry Stores Distribution: comp Date: Fri, 19 Apr 1991 02:42:16 GMT This is a little something I've been hacking on for the last week or so. I call it "SXwatch". It displays the current time in a somewhat antiquated style which our modern digital watch-wearing civilization doesn't use so much any more. It has the convenient feature of staying idle most of the time by using a repeating alarm to update the watch hands and laying around in 0 WAIT the rest of the time. Start the display by evaluating SXWATCH and stop by pressing any non-shift key. I discovered an interesting behavior of control alarms while writing this program. It appears that a control alarm aborts execution of the currently running program when it goes off, instead of acting as an interrupt. Incidentally, I also discovered that a repeating alarm returns its alarm index for AFTER it has been rescheduled, which I thought was convenient. WARNING: Although I took as much care as possible to make this program well-behaved, it is possible that it may accidentally purge an alarm other than its own if you press ON at the wrong time. Pressing ON while the alarm action is running may cause the program to abort and not clean up after itself (it saves the contents of the PICT and flags on entry, and restores them on exit after killing the repeating alarm). Pressing any key other than ON to halt the program should be safe, although I suspect that if the alarm action is running it may not acknowledge such keypresses. And now, the program. Remember to join all the lines of the GROB at the end of the directory before downloading into your calculator. BYTES returns #8074h, 1122.5 bytes for the directory object alone. %%HP: T(3)A(R)F(.); DIR SXWATCH \<< PICT RCL RCLF PICT PURGE DEG -40 CF PICT { # 22h # 0h } face REPL { # 0h # 0h } PVIEW TIME DUP hands at { \<< IFERR DROP2 hands TIME DUP hands 0 WAIT THEN END rest \>> 491520 } + STOALARM DROP IFERR 0 WAIT THEN END rest \>> hands \<< { # 41h # 1Fh } DUP2 30 ROT FP 2 TRNC 600 * a\->p TLINE 15 ROT HMS\-> 30 * a\->p TLINE \>> a\->p \<< DUP2 SIN * 65 + R\->B ROT ROT COS * 31 SWAP - R\->B 2 \->LIST \>> at \<< DATE .01 TIME HMS+ 2 TRNC IF DUP 24 \>= THEN DROP 1 DATE+ 0 END 2 \->LIST \>> rest \<< at FINDALARM DELALARM DROP2 STOF TEXT PICT STO \>> face GROB 63 63 000000CFF100000000000C3C1E1000000000830800E000000000602142030000 00081400001C0000000C8003708810000002100240042000008100027000C000 0044330210C01100002022077080020000112200008044000800220000800800 0840770000C10900040000000000001002100000000004200300000000000060 0500000000000050803200000000838080250000000002804225000000008321 4025000000008001407200000000830121000000000000422000000000000002 2000000000000002A00000000000008210000000000000041000000000000004 90000000000000841C10000000000C143410000C100000167C10000C10000C17 3010000C100000161C10000000000C1490000000000000841000000000000004 1000000000000004A000000000000082200000EAF3000002200000F2C7000002 210000718700004240E000777700820140A000755700820142E0007577008321 80A000F09700028080E000F9C7000280050000EBE30000500300000000000060 021000000000042004000000000000100840C10000C109000800010000400800 0011800000C1440000204008100102000044400400C111000081000C1000C000 0002100410042000000C800C1088100000081400001C00000000602142030000 0000830800E0000000000C3C1E100000000000CFF1000000 END -- Steve VanDevender stevev@greylady.uoregon.edu "Bipedalism--an unrecognized disease affecting over 99% of the population. Symptoms include lack of traffic sense, slow rate of travel, and the classic, easily recognized behavior known as walking."