!pr1
Building Label Tables for DISASM...........Bob Sander-Cederlof

RAK-Ware's DISASM has the nice feature of being able to used a list of pre-defined labels when you are disassembling a block of code.  I needed to turn the //c monitor ROM ($F800-$FFFF) into source code, and Apple sent me a list of all their labels in this area.

The format of the label table, or name table, is very simple.  Each entry takes eight bytes:  the first two are the value, high byte first; the remaining six are the label name, in ASCII with high bit set.  If the name is less than six characters long, zeroes are used to fill out the entry.

Very simple to explain, but how do you enter things like that in the S-C Macro Assembler?  The example on the DISASM disk does it this way:

       1000      .HS FDED
       1010      .AS -/COUT/
       1020      .HS 00000000
       1030      .HS FDF0
       1040      .AS -/COUT1/
       1050      .HS 000000
       and so on.

That works, but it is so error prone and time wasting that I gave up before I started.  However, there is an easy way using macros and abbreviations.

Start by defining a macro which will build one entry:

       1000    .MA LBL
       1010    .HS ]1
       1020    .AS -/]2/
       1030    .BS *+7/8*8-*
       1040    .EM

The macro is named LBL, and will be used like this:

       1050    >LBL FDED,COUT
       1060    >LBL FDF0,COUT1

Line 1030 is the tricky one.  This .BS will pad out an entry to an even multiple of 8 bytes.  Now, assuming the origin started at an even multiple of 8, and assuming you are writing the table on a target file, that macro builds the kind of entries DISASM wants.  Instead of just assuming, lets add:

       0900    .OR $4000
       0910    .TF B.NAMETBL

I also mentioned abbreviations above.  I even get tired of typing "tab>LBL ", you know.  Usually when I have a lot of lines to type that have a common element, I use some special character that is easy to type and not present in the lines I plan to type.  Then after all the lines are in, I use the REPLACE command to substitute the longer string for the single-character abbreviation I have used.  Thus, I can type:

       1050 .FDED,COUT
       1060 .FDF0,COUT1
       et cetera

and after many lines type

       REP /./ >LBL /1050,A

I was about up to FA90 when it dawned on me that I could break the symbols into blocks within a page, and include the page value in my abbreviation:

       1050 .ED,COUT
       1060 .F0,COUT1
       REP /./ >LBL FD/1050,A

With all these shortcuts, I was able to enter over 400 label names and definitions in less than an hour.

Let the computer work FOR you!
