Using and defining scope in Uxntal.
Uxntal objects are defined statically using a @label token, it allows for the enclosed methods to access local &labels. The example below creates an object with the method get-x, accessible from outside the scope as Object/get-x. By capitalizing the object name, we communicate to the assembler that the label will not be called and should not raise a warning.
@Object &x $1 &y $1 &get-x ( -- x ) ,&x LDR JMP2r
New methods and members can be appended to an existing scope by creating a label with the scope name followed by a slash and the name of the extension. The &labels declared within the extension have the same permissions for accessing local labels as during the object definition. To learn more, see symbols.
@Object/get-y ( -- y ) ,&y LDR JMP2r
When calling local routines the scope's name can be omitted. To see a complete example in that pseudo object-oriented style, see timer.tal.
&get-both ( -- x y ) Object/get-x /get-y JMP2r
incoming uxntal syntax uxntal macros