Next: , Previous: W-expressions, Up: MIXAL


2.2.5 Local symbols

Besides user defined symbols, MIXAL programmers can use the so called local symbols, which are symbols of the form [1-9][HBF]. A local symbol nB refers to the address of the last previous occurrence of nH as a label, while nF refers to the next nH occurrence. Unlike user defined symbols, nH can appear multiple times in the LABEL part of different MIXAL instructions. The following code shows an instance of local symbols' usage:

     * line 1
     1H    LDA  100
     * line 2: 1B refers to address of line 1, 3F refers to address of line 4
           STA  3F,2(1B//2)
     * line 3: redefinition of 1H
     1H    STZ
     * line 4: 1B refers to address of line 3
     3H    JMP  1B

Note that a B local symbol never refers to a definition in its own line, that is, in the following program:

     		ORIG 1999
     ST		NOP
     3H		EQU 69
     3H		ENTA 3B  local symbol 3B refers to 3H in previous line
     		HLT
     		END ST

the contents of ‘rA’ is set to 69 and not to 2001. An specially tricky case occurs when using local symbols in conjunction with ORIG pseudoinstructions. To wit1,

     		ORIG 1999
     ST		NOP
     3H		CON 10
     		ENT1 *
     		LDA 3B
     ** rI1 is 2001, rA is 10.  So far so good!
     3H		ORIG 3B+1000
     ** at this point 3H equals 2003
     ** and the location counter equals 3000.
     		ENT2 *
     		LDX 3B
     ** rI2 contains 3000, rX contains 2003.
     		HLT
     		END ST

Footnotes

[1] The author wants to thank Philip E. King for pointing these two special cases of local symbol usage to him.