More Assembly Listing into Text Files...........Tracy L. Shafer
                                                MacDill AFB, FL

In the October '83 issue of AAL, Robert F. O'Brien presented a way to create a text file containing the assembly listing of a large program.  (See also "Assembly Listing Into a Text File", by Bill Morgan, July '83 AAL.)  Actually, he created several text files; one for each .IN directive in the root file.  You can't put the whole listing into one text file by using one .TF directive because of the way the .IN directive affects the DOS I/O hooks.

Robert's method for obtaining assembly listing text files is good, but I found a different way to create the text files of assembly listings that doesn't involve creating separate SYMBOLS sections, deleting duplicate labels, and putting up with "EXTRA DEFINITIONS ERROR" messages.  It's a fairly simple approach and hinges on the fact that the problem presented by the .IN directive affects the source file containing the .IN, but not the source file to which the .IN refers.  Instead of putting one .TF directive in the root file, put a .TF in each source file pointed to by a .IN directive.

For example:

        ROOT FILE

        1000    .DU
        1010    .IN PART 1
        1020    .IN PART 2
        1030    .ED

        PART 1

        1000    .TF LISTING 1
        1010    (source for part 1)

        PART 2

        1000    .TF LISTING 2
        1010    (source for part 2)

From here on, follow Bill Morgan's original instructions.  What follows is a summary of those instructions.

After deleting all other .TF directives, or turning them into comments by inserting "*" at the beginning of the line, typing ASM will create two binary files named LISTING 1 and LISTING 2.  Each of these contains the assembly listing of PART 1 and PART 2 respectively, in text form.  These binary files will not have starting address and length in the first four bytes.  DO NOT attempt to BLOAD these files.  You could really clobber DOS. To obtain true text files, make the following patch to the S-C Assembler before you assemble the program:

        $1000 versions:  $29DF:0  (original value is 04)
        $D000 versions:  $C083 C083 EAF9:0 N C083

After the patch is made, assemble the program and restore the original value to $29DF ($EAF9).

For really large programs, it could get very tedious adding a .TF directive to each sub-file to obtain a text file listing and then deleting those .TF directives to prevent messing up the object file the next time the program is assembled.  Fortunately, the S-C Macro Assembler's conditional assembly feature makes our work a lot easier.  By placing an equated flag in the root file and surrounding each .TF with .DO and .FIN, we only have to change one line to set up our program for text file output or object file creation.  For example:

        ROOT FILE

        1000 LSTOUT .EQ 0       TO ASSEMBLE OBJECT
        1010 *          1       TO OUTPUT TEXT FILES
        1020        .DO LSTOUT
        1040        .DU
        1050        .ELSE
        1060        .TF OBJECT FILE
        1070        .FIN
        1080        .IN PART 1
        1090        .IN PART 2
        1100        .DO LSTOUT
        1110        .ED
        1120        .FIN

        PART 1

        1000        .DO LSTOUT
        1010        .TF LISTING 1
        1020        .FIN
        1030        (source for part 1)

        PART 2

        1000        .DO LSTOUT
        1010        .TF LISTING 2
        1020        .FIN
        1030        (source for part 2)

Don't forget to patch $29DF ($EAF9 for the language card version) with 0 to output true text files and back to 04 create object files.  The last thing to remember is to use .LIST ON during the assembly. You won't write any text files if the assembler isn't producing a listing.
