(Comp.sys.handhelds) Item: 2552 by cloos at acsu.buffalo.edu Author: [James H. Cloos] Subj: (HP48SX) TF, a toggle flag program Date: Fri Mar 29 1991 Hello, Please find eclosed a usrlang and a rpl version of TF, a program that toggles a flag. The syntax is the same as for SF and CF. (There may actually be a routine in ROM that does this, but I haven't found one yet.) First, the usrlang version in ASCII mode: --------------------------------------------------START_HERE- %%HP: T(3)A(R)F(.); \<< DUP FS?C \<< DROP \>> \<< SF \>> IFTE \>> ---------------------------------------------------END_HERE-- Here is the RPLC version of the rpl version, using a minimal symbol table: --------------------------------------------------START_HERE- /* tf.rplc - by James H. Cloos, Jr. */ /* USE AT YOUR OWN RISK */ /* Note that RPLC format is free form wrt whitespace, just like C. */ // Also note that comments are as per C++. :: ==18ECEh #1 :: ==3188h ==1C4BFh ==61AD8h ==3244h ==1C28Dh ; ; ---------------------------------------------------END_HERE-- (The logic is basically the same; FS?C is used in preference to FC?C as FC?C at this level is basically a :: fs?c not ;.) The list file from star, cut to the essential section (ie, p2) is: STAR 1.04.4 Thu Mar 28 20:37:59 1991 tf.star - 2 1 70010 2 70010 ;; RPLC version A.1.3 3 70010 4 70010 d9d20 data.a type_col 5 70015 ece81 data.a x'18ece ;; Switch1 6 7001a 9ff30 data.a x'3ff9 ;; #1 7 7001f d9d20 data.a type_col 8 70024 88130 data.a x'3188 ;; dup 9 70029 fb4c1 data.a x'1c4bf ;; fs?c_1real 10 7002e 8da16 data.a x'61ad8 ;; *see below* 11 70033 44230 data.a x'3244 ;; drop 12 70038 d82c1 data.a x'1c28d ;; sf_1real 13 7003d b2130 data.a semi 14 70042 b2130 data.a semi 15 70047 (The names Switch1 thru sf_real added by hand.) Derek calls 61ad8: "if pop TOS = True, then do/skip else skip/do" As written, if a too_few_args or _bad_arg_type error is generated, you'll get the message "XLIB lll ccc Error:." I left this this way as it will eventually be part of a lib I'll be posting. When included in a lib, errors will show up as "TF Error:" instead. (BTW, a quick calculation suggests that the XLIB number in the above error message would be "XLIB 1620 36" for the name 'TF' (it is a consequence of how lib's and dir's are stored internally; see my previous posting on the subject).)