!pr1
!lm12
!rm75
Moving the Symbol Table ............................Bill Morgan

Do you use the language card version of the S-C Macro Assembler?  Have you ever tried to create more space for your object code by patching $D01D to move the symbol table up from $1000?  Got a MEM PROTECT ERROR, didn't you?  Here's what went wrong, and how to fix it.

The problem is the private label table for macros.  This table is also protected during assembly, and starts at $FFF and grows downward.  The base of the table is defined by a LDA #$10 instruction at $E564.  When the table is searched during assembly, the check for the end of the table is a CMP #$10 at $E6A0.  Both of these must also be patched to allow the $D01D patch to work.  Here are the commands to correct the assembler:

!lm+5
:$C083 C083 N E564:A5 4B N E6A0:C5 4B N C080
:BSAVE S-C.ASM.MACRO.LC,A$D000,L$231F
!lm-5

This changes the LDA #$10 to a LDA LOMEM+1 and the CMP #$10 to a CMP LOMEM+1.  Now, whenever you want to move the symbol table, just type the following (where XX is the page you want the tables to start with):

!lm+10
:$C083 C083 D01D:XX N C080
:NEW
!lm-10

The NEW command is necessary to reset the page-zero pointers.

If you are using a target file and don't care about object code space, you can move the symbol table down.  This creates more source code and symbol table space.  You can move the table base all the way down to $800, if you are not using private labels.  If you are using them, remember that each private label occurence uses 5 bytes of table space, so be sure to leave enough room under the table base.

Here's a map that shows how things got this way:

!lm+5
 -----------
|   Symbol  |
|   Table   |
 -----------  LOMEM
|           |            ----------
| Assembler |           |   Symbol |
|           |           |   Table  |
 -----------  $1000      ----------  LOMEM
|  Private  |           |  Private |
|  Labels   |           |  Labels  |
 -----------             ----------

   Normal               Language Card
   Version                 Version
!lm-5

The normal version of the assembler has to start at $1000, so the private label table also has to be there.  The language card version didn't get changed to reflect the fact that the private labels could now be moved.
