Subject: Re: HP48: Code Objects in User Language Programs
Date: 18 Dec 90 02:48:03 GMT
Organization: State University of New York @ Buffalo
Lines: 38
In article <kskalb.661187537@faui1f> kskalb@faui1f.informatik.uni-erlangen.de (K
laus Kalb) writes:
[etc.]
>Can a code object be included into a user language program ?
>If yes, how ?
[etc.]
You will have to use a function such as \->PRG posted previously by
Rick Grevelle. (see below). To do this, write your usrlang program
as usual, execute PRG\-> to put each element of the porgram on the
stack, put your code object on the stack, then use ROLLD & ROLL to
position the CODE where it belongs in the program (interactive stack
helps here). If you left a marker for where the code was to be
inserted, make sure you remove it from the stack, if you didn't, make
sure you increment the #_of_elements count that PRG\-> left on level
1. Now use \->PRG to combine the elements back into a program.
The four programs in the downloadable dir below need to be run thru
ASC\-> to use them. Here is the DIR:
%%HP: T(3)A(R)F(.);
DIR
\->PRG
"D9D2043C8154450B21305CEC"
PRG\->
"D9D202BA812BF81F3040379C1B21305293"
ALG\->
"D9D202BA812BF8194040379C1B2130C3D2"
\->ALG
"D9D2043C81D6450B2130474F"
END
These routines do do argument checking.
-JimC
--
James H. Cloos, Jr. Phone: +1 716 673-1250
cloos@ACSU.Buffalo.EDU Snail: PersonalZipCode: 14048-0772, USA
cloos@ub.UUCP Quote: <>
Date: Tue, 18 Dec 1990 13:37 CST
Subject: Re: HP48: Code Objects in User Language Programs
Lines: 61
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.