Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!elroy.jpl.nasa.gov!jarthur!bgribble From: bgribble@jarthur.Claremont.EDU (Bill Gribble) Newsgroups: comp.sys.handhelds Subject: Re: HP48: Code Objects in User Language Programs Message-ID: <10144@jarthur.Claremont.EDU> Date: 15 Dec 90 20:44:45 GMT References: Organization: Harvey Mudd College, Claremont, CA 91711 Lines: 40 In article kskalb@faui1f.informatik.uni-erlangen.de (Klaus Kalb) writes: >Can a code object be included into a user language program ? >If yes, how ? [...] >But then I wanted to include the code directly into the user language >program and edited it using the interactive stack. >This didn't work as expected. The code object changed to something >that gave the value 'Code' (as unresolved name) when executed. If you're familiar enough with machine language, it wouldn't be too hard to write a 'linker' that would process a user-language program by looking for globals in the user-program object that were equivalent to code objects and then including them. You could write it so that a global starting with, say, the '.' character was to be replaced with its object, so that the program sequence \<< IF '.test' THEN '.yes' ELSE '.no' END \>> when given to the linker as an argument would have the global '.test' replaced by the code object 'test' and so on. Doesn't seem like the code would be that hard, actually. The only tricky part would be checking each 5-nibble RPL code for an object type and skipping the proper number of nibbles to get to the next RPL code. As an alternative, you could use ->ASC and ASC-> to disassemble the user program into an editable string, insert the ->ASC'ed code object, fix the checksum using the KCRC {syseval || program}, I forget, and then ASC-> it to get a program again. Hope this helps! >-KK ***************************************************************************** ** Bill Gribble Harvey Mudd College, Claremont, CA ** ** bgribble@jarthur.claremont.edu Never heard of it? You're stupid. ** *****************************************************************************