Skip to content

BASIC Variable Substitution

Chysn edited this page Feb 4, 2022 · 6 revisions

BASIC variables may be inserted into any wAx command, by prefixing the variable name with ` in the command. This feature is subject to the following restrictions:

  • Only single-letter variable names are supported (like V, but not V2 nor VA)
  • Only floating-point numerical variables are supported (like V, but not V% nor V$)
  • Values less than 0 or more than 65535 will result in an ?ILLEGAL QUANTITY error

Values from 0-255 are substituted as one-byte hex values ($00 - $FF). Values from 256-65535 are substituted as two-byte hex values ($0100 - $FFFF).

Here are some examples of variable substitution, in BASIC programs and direct mode:

Setting start-of-assembly
10 T = 7000
20 .A 'T LDA #$00
30 .A *  ETC...
Using as character constant
C = ASC("!")
.A 1800 LDY #'C
Setting a vector interactively
10 INPUT V
20 .A 1800 STA 'V
30 .A *    STY 'V+1
Viewing a dynamic range of text
F = 49344:T = 49536
.I 'F 'T
Setting a wAx symbol value dynamically
A = 48192
.@V 'A
Clone this wiki locally