How do I create a Subroutine using System RPL?
|
09-30-2022, 03:55 PM
Post: #11
|
|||
|
|||
RE: How do I create a Subroutine using System RPL?
(09-30-2022 02:24 PM)wmundstock Wrote: My understanding is that right after the CK&DISPATCH1 we add the types we want to check. If its real real it should be #00011 so this mean we can only test up to 5 arguments for their type? The standard dispatch mechanism supports checking up to 5 arguments. As you've noted, there is the "CKN..." structure, but that is most useful when you've got a number in stack level 1 that is indicating a count of things to operate on (the example of DROPN is a good one to describe that situation). If you need to check more than 5 arguments, you have to do it a different way. The SysRPL DEPTH code word can be useful (after a preliminary check for the first 5 using standard commands). It's possible to "stack" the dispatch calls (CK&DISPATCH1), but you shouldn't try to stack CK5NOLASTWD with the other "counting" checks (CK<1..5>NOLASTWD). This all becomes rather messy, and I would actually recommend that you reconsider whether passing that many arguments on the stack is the best approach. If you really need that many arguments, it's probably better to pass them in list form to the program. That allows you to use the standard count/dispatch mechanism, but then requires that you do a manual check of the number of elements in the list and their types. That's not so difficult, really, and I would suggest that the code would look more organized if you went that route instead. (09-30-2022 02:24 PM)wmundstock Wrote: I tried using the directory macro as you suggested. Does that only work if in one single file? I tried creating 2 files and assignign a section like below, but it did not work. You answered your own question here. The objects you're creating need to appear to the compiler as if they are all in 1 file due to the way DirMacro works. This can be done one of two ways:
file: object1.s Code: ASSEMBLE file: object2.s Code: ASSEMBLE file: object3.s Code: ASSEMBLE To compile these into a directory object that has all three, you would then need to have a "master directory" source file that has something like the following: Code: RPL Note that the INCLUDE for the DirMacro only exists in the "top level" file. There should only be 1 INCLUDE for that macro in the hierarchy. Hope this helps! |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)