Path: utzoo!mnetor!tmsoft!torsqnt!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hp-pcd!hpcvra.cv.hp.com!rnews!hpcvbbs!akcs.joehorn From: akcs.joehorn@hpcvbbs.UUCP (Joseph K. Horn) Newsgroups: comp.sys.handhelds Subject: Re: HP48: Code Objects in User Language Programs Message-ID: <276de832:1452.1comp.sys.handhelds;1@hpcvbbs.UUCP> Date: 18 Dec 90 10:40:06 GMT References: Lines: 60 Klaus Kalb asks how to include pre-written Code objects inside user-code programs without assembling the entire program. A very handy way is to use Rick Grevelle's PRG-> and ->PRG routines (posted here earlier) with ROLL and ROLLD. ---------------------------Example:-------------------------------- I have a Code object stored in 'JUNK'. I have a program that looks like this: << A B C + JUNK * >> but I want the program to look like this: << A B C + Code * >>. Here's how to do it: 1) << A B C + JUNK * >> (this is the original program) 2) PRG-> (decomposes program into its objects + count (8)) 3) 4 ROLL (this pulls JUNK down from level 4 to level 1) 4) RCL (this replaces JUNK with its Code contents) 5) 4 ROLLD (this puts the Code into level 4, where JUNK was) 6) ->PRG (this recomposes the program into a single object) 7) See << A B C + Code * >> on the stack! Steps 3 and 5 are done easily by using the interactive stack. In fact, this application is the only time I use the interactive stack. If more than one replacement is to be made, steps 3 through 5 can be automated (if you have Donnelly's Tool Library) this way: ->LIST 'JUNK' DUP RCL REPLACE OBJ->. That'll replace every 'JUNK' with its contents throughout the whole program. Global search and replace on program objects! Can't do THAT on most handhelds! Of course, this method can be used to insert "External"s and anything else your heart desires into programs. You don't ever have to assemble the whole thing like we used to do! Now you can write a chunk at a time, verify that each chunk works, and then tack the chunks together with ->PRG. PRG-> by Rick Grevelle, in ASC format. String checksum: # CE4Dh. ASC'd object checksum: # 3925h. -----[ PRG-> begin ]----- %%HP:; "D9D202BA812BF81F3040379C1B21305293" -----[ PRG-> end ]----- ->PRG by Rick Grevelle, in ASC format. String checksum: # 7844h. ASC'd object checksum: # CEC5h. -----[ ->PRG begin ]----- %%HP:; "D9D2043C8154450B21305CEC" -----[ ->PRG end ]----- Usage: Place a program object in level 1. Press PRG->. See the program's objects in levels 2 through n, and find n in level 1. PRG-> converts a program object into a meta-object. Place objects in levels 2 through n, and place n in level 1, and press ->PRG. See the objects combined into a program object in level 1. ->PRG converts a meta-object into a program object. -- Joseph K. Horn -- (714) 858-0920 -- Peripheral Vision, Ltd.