How do I create a Subroutine using System RPL?
|
09-29-2022, 01:41 PM
Post: #7
|
|||
|
|||
RE: How do I create a Subroutine using System RPL?
(09-28-2022 10:10 PM)wmundstock Wrote: I am using Debug4X. Debug4x is still a very capable system, albeit dated and reminiscent of the early days of a Delphi IDE in many ways. Even with all of its warts, I dread the day that I can no longer use it. (09-28-2022 10:10 PM)wmundstock Wrote: How would one do a subroutine in a regular program that is not installed as a library? In that situation, everything needs to be encapsulated into a single object. You would essentially do this the same way you would do it in a UserRPL program: put the subroutine on the stack, then assign it to a local variable at the beginning stages of your code. When you need to call it in your program, you simply recall it to the stack and execute it with EVAL. I'll put together an example and post it to this thread separately. (09-28-2022 10:10 PM)wmundstock Wrote: I have a final question here, how would one learn about the REALREAL thing? I found references of it in the document Programming in System RPL Second Edition, but nothing self explanatory. Is there another documentation that you recommend? The document you mentioned above is the best reference I know of (there may be others in different languages floating around that I don't know about, however). Regarding the dispatch mechanism, I think it suffices to know the syntax, then look for supported BINTs that have the value you need. That same document has a (mostly complete) list of the known supported and not-supported-but-in-a-safe-address-range BINTs that can be used for any purpose (dispatch or otherwise). Not all BINTs are available as objects in ROM, so you will inevitably need to use the "# <hex value>" format at times. Much of the learning process for System RPL programming is simply trial-and-error. Go through some of the examples in that document you mentioned, and give yourself increasingly challenging exercises. Once you start becoming comfortable with the coding basics, you'll start to become more adept at seeing how the pieces work together by looking at other's code. One of the best teachers for that is to install Nosy and an extable on an emulated 50g, which then allows you to see the actual coding techniques used by the developers of the platform. I don't recommend starting out with that, though, as there are definitely some advanced techniques that won't make much sense until you've got a good handle on the underlying principles of runstream control, meta manipulation, and loop constructs. Those techniques are used quite a bit in ROM, so I definitely recommend becoming familiar with the basics before trying to decipher what's built-in. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)