-
Notifications
You must be signed in to change notification settings - Fork 2
Symbol Table Manager
Optionally, wAx maintains a symbol table for use with its somewhat symbolic assembly (see "Symbols"). The @ tool provides a few ways to manage these symbols.
.@
On a line by itself, @ shows the symbol table. It will show you the following information:
- Defined symbols with the @ sigil
- If followed by a hexadecimal number, the symbol's address
- If followed by a ? and a number, it indicates that the symbol was used as a forward reference and is still undefined. The number indicates the number of times the symbol was used and, thus, how many forward references will be resolved when the symbol's address is defined.
- The last line of the symbol table shows the current Command Pointer address
- If the Command Pointer address is followed by a ? and a number, it indicates the number of forward references that could not be defined because the number of forward references exceeded 12. This means that your code will probably not function properly. If you're entering code in direct mode, you'll be notified of this condition immediately with a ?SYMBOL ERROR. If this condition occurs within a BASIC program, it can be addressed with a second pass (see "Multi-Pass Assembly").
There are two ways to set the value of a symbol:
.A addr @name ; Code form
.@name addr ; Constant form (16-bit)
.@name byte ; Constant form (8-bit)
where addr is a valid 16-bit hexadecimal value, and name is a valid symbol name (0 ~ 9, A ~ Z, @, and &). byte is a valid 8-bit hexadecimal value, which will be converted to a 16-bit value.
The difference between the Code form and Constant form is that defining a value with the Constant form does not resolve forward references, and it does not change the Command Pointer.
.@-
This clears the symbol table by writing $00 to all symbol table memory. This should be done at the start of a BASIC program that uses symbol-related features.
The wAx symbol table is stored between $02a2 and $02ff. This memory is not addressed at all by wAx unless you use the somewhat symbolic features.
wAx stores the symbol table between $02a2 and $02ff. Each symbol takes three bytes, and each forward reference record takes three bytes. One additional byte is used to count the number of unresolved forward references since the last Command Pointer set using the * tool. Based on this storage configuration, the symbol table limits are as follows:
- 18 user-defined symbols
- 1 forward reference symbol (@&)
- 12 unresolved forward reference records
The user-defined symbols stay defined until the symbol table is cleared with @-. The forward reference symbol is cleared by using @& as an operand. The unresolved forward reference records are de-allocated when the the reference is resolved.