Direct subbing doesn't work (all manners and combinations of things I've exhausted).
As far as use case, I can think of a million, but let me try to come up with a functional one. Let's just say I have a program that draws various boxes. Each box is its own width, height, has its own contents. Effectively, it's a multi-dimensional array of data to form the box.
I could do this easy with tables...something like:
Code:
Box_lengths:
.db #10, #20, #30
Box_widths:
.db #15, #30, #45
Box_contents:
.db #0, #1, #2
All good. I could draw this box with just a y offset to get the length, width, and contents for the Yth box and create a draw routine. Easy.
But now I have a box that might have variable data inside of it. So for contents, it might look more like this:
Code:
Box_0_contents:
.db #0, #1, #2
Box_1_contents:
.db #10, #11, #12, #13, #14
What I'd love to be able to do is something where I could, say, have a macro:
Code:
.MACRO SetUpBox arg0
; arg0 = box id.
Then I'd end up coding:
Code:
SetUpBox Box_0
...which could give me easy access to Box_0_contents as the label to point to to get that particular boxes contents, because in the macro itself, I could combine the argument (Box_0) with what table for that box I'm looking for (_contents), and read away.
The way that I would do it now is have some pointer table...something like:
Code:
BoxContents:
.dw Box_0_contents
.dw Box_1_contents
;; etc
...and then use the same offset for the box I'm looking for, have it point to the table, get the relevant data via indirect indexed addressing...whatever. I guess this system would avoid the need for this table and that sort of fetch. The routine could look up "Box_" + the identity of the box + "_" + the parameters and labels it needs to work with just by invoking a macro. But I can't quite figure how to do it with this assembler.
This is just an off the cuff example, but does it make sense as for as intent?