Tech Note - S-C Macro Assembler 3.0

The S-C Macro Assembler was a product of S-C Software Corporation, for the Apple II family of computers. The first version, called simply "S-C Assembler ][", was released in 1978. See history here. After a long successful run, S-C Software closed up shop in the summer of 1988.

The Tech Note presented here was for version 3.0 of the S-C Macro Assembler, which was never released. All work on it ceased before the end of 1990.


Contents
Internal Changes
Improvements to Macros
Additions to Assembler Syntax
New Options for Directives
Fixes & New Features in Commands
40/80 Column Screen Control
Changes to CATALOG Command
Compatibility with Clones
I am now (June, 1988) working on the new version of the S-C Macro Assembler, which I am calling version 3.0. This version requires at least a 128K //e, //c, IIgs, or equivalent clone.

Internal Changes:

One goal for version 3.0 is a stable platform for the 65816 assembler and for all present and future cross assemblers.

1. The editor and general assembler reside in main ram starting at $8000, as before. The ASM.PARTICULAR module resides in the $C083 bank of $D000 ram, starting at $D400 (immediately after the ProDOS QUIT code). This provides considerably more room for both the editor and the particular assembler. Linkage is by a small jump vector at $D400 into the particular assembler, and by a small jump vector at $A700 for the subroutines in main RAM needed by the particular assembler.

I am assuming that a "library" of cross assembler modules could be used, with a directive or command loading the particular one desired.

I implemented the Motorola 68HC11 Cross Assembler under the new "PlatForm System".

2. Added a "title" string in the linkage section of the ASM modules, which is printed out under the "S-C MACRO ASSEMBLER VERSION 3.0" message. For example, it may say "FOR THE MOTOROLA 68HC11" or "FOR THE 6502, 65C02, OR 65816".

3. I have modified the table search subroutine to be compatible with the new one I used in the 68HC11 cross assembler. This table is a little easier to search, and the source code for the table is a simple list of macro calls.

4. Thoroughly rearranged the page zero variables, moving those referenced from within SCI and the IO Drivers to the front ($50-59). Reserved $F0-FF for ASM.PARTICULAR, and $EB for the ECHO Speech Synthesizers. This change forced me to create 3.0 versions for S-C XREF, S-C DisAsm, and Laumer Research FSE, because they rely on knowing certain pagezero variables the assembler is using.

5. Re-wrote NML subroutine for smaller, faster code. NML is the subroutine which compacts a numbered line and inserts the line into, replaces a line in, or deletes a line from the current source program.

6. Modified SCI command parsing to eliminate COPY.COMMAND.NAME.TO.TXTBUF.

Improvements to Macros:

1. Inside a macro definition, the character ']' is used to signal a parameter. In the version 2.0, the character following a ']' had to be either '#' or a digit 1-9. If not, you got "bad macro parameter" error.

In the new version, if the character following is '#' or digit 1-9, a $7F code is stuffed into the macro skeleton instead of ']', and then the parm char. If the character following is another ']', the pair is stored as one ']' in the skeleton. Thus "]]1" will become "]1" in the skeleton. Any other character following a ']' lets both the ']' and the character following into the skeleton unmolested.

This opens the way for me to add the "[exp]" and "[exp],Y" addressing modes instead of requiring ">(exp)" and ">(exp),Y".

2. Allow underline to indicate macro call, as well as >. This makes it "look" more compatible with the APW toolkit calls.

Additions to Assembler Syntax:

1. Implemented the [exp] and [exp],Y modes, since this is the syntax used by Orca, APW, and Merlin-816. The older ">(exp)" and ">(exp),Y" still work.

2. Allow underline character within symbols (not as FIRST character, though).

3. Allow a semicolon to end the search for an opcode, so that comments may be placed on label-only lines.

New Options for Directives:

1. Added the XOFF and XON option to the .LIST directive. XOFF turns off the listing of extra lines when the number of bytes generated is too many for one line in the listing. For example, .AS "abcdefg" would take 3 lines of listing normally, but with the option .LIST XOFF it would only take 1 line.

2. .AZ directive, which is same as .AS but appends a 00 byte for a terminator.

3. Added a new item type to the .DA directive. An item starting with $$ is a string. After the $$ you may put either dstringd or -dstringd, which will be assembled by the .AS directive code. Other items may follow, if the character after the dstringd is a comma. [ This feature still has some bugs, caused by the later addition of hex strings to .AS and .AT operands. ]

4. Allow a list of hex strings and delimited ASCII strings in the .AS, .AT, and .AZ directives.

5. Allow a comma to separate bytes in a .HS directive.

6. Fixed bug in .EQ for private labels. As it was, only the low 16 bits of any equated value were assigned to the label, even though the value printed in the listing showed 24- or 32-bits. The high 16-bits remained as set by the current ORGN value. Now the full .EQ value is copied into the label value.

7. Allow '=' as a synonym for .EQ directive.

8. Allow ,TSYS after filename in the .TF directive, to assemble a SYS file. Had to make changes in ASM2/PSTF and SCI/SC.OPEN.CLOSE to implement this. Further changes could allow other file types.

Fixes & New Features in Commands:

1. Now allow "." as third line number in the COPY command.

2. AUTO command now allows a second parameter which will become the new increment value. Formerly the only way to set the increment value was with the INC command. Now you can use:

 AUTO
 AUTO starting.line.number
 AUTO starting.line.number,increment.value

3. Changed NML so that SRCP is adjusted if hole is expanded or contracted above where SRCP points. This fixes the problem in the EDIT command when you change the line number of the line being edited, and then continue editing the next line. It now works even when the changed line number forces the body of text to move down.

4. Changed REPLACE so that when you replace all the text of a line with nothing, thereby deleting the line, it lists the line number of that line only after the replacement. Then the replacement search continues with the next line. It formerly listed the text of the next line and then started searching again with the line after the next line.

5. VERSION command prints the same "title" NEW does, but without clearing screen or text memory.

6. VAL command now displays both hex and decimal values, as "$xxxx=yyyyy".

7. Added "?" and "HELP" as a "help" command. It lists all of the Asm/Edit commands alphabetically, then all of the Shell commands Alphabetically.

8. Added the ability to LIST only lines with major labels (labels starting with a letter). Use the LIST or FIND command with a null "find string" using slash as a delimiter. For example:

 LIS/ 
 FIN/
 LIS//2000,3000

9. Added NOW command to shell, to print current date and time in format dd-mmm-yy hh:mm or as <NO DATE>.

10. Added the DATE and TIME commands, which allow entering a date and time on systems that do not have a clock card. DATE should be followed by three decimal numbers separated by commas, representing day, month, and year in that order. TIME should be followed by numbers for hour and minute. For example:

 DATE 7,21,88
 TIME 18,0
 NOW
 21-JUL-88 18:00

11. BLOAD and BSAVE now allow type SYS files to be loaded or saved without specifying the A-value. They will assume A$2000 if none is given, if you include TSYS. (They still don't have the ability to look for themselves to see that the file is type SYS.)

12. CREATE can now specify the AuxType by means of the A-parameter. For example, CREATE XXX,TSYS,A$2000 works.

13. Added ONLINE command to display a list of all online drives and their corresponding volume names.

14. Allow aborting a text search by typing <RETURN> even if no lines are being found.

15. Added control-F and control-L for keyboard macros "FIND " and "LIST " respectively. As with the other keyboard macros (^E=EDIT, ^P=PREFIX, ^C=CATALOG) these are only effective in column 1.

16. Added escape-period, which is only effective in column 1. If the character under the cursor is not a digit, this emits "LIS.," and waits for further input. If it is a digit, the characters up to a non-digit are parsed as a line number and stored as "dot" (CURLNO). Then the "LIS.," is emitted, and you can either type <RETURN> or add another line number and <RETURN>.

40/80 Column Screen Control:

1. Automatically start up in 80-column mode if in //e driver and ProDOS machine-id byte (BF98) says 80-column card is present.

2. Modified "PR#0" command so that it changes to 40-column mode completely.

Changes to CATALOG Command:

1. Changed heading for CATALOG from SUBTYPE to AUXTYPE, since that is what it is called in all other places. Changed so the AuxType is always displayed regardless of filetype. If type is TXT, it says "R=$xxxx"; if type is BIN, it says "A=$xxxx"; for all other types, it says " $xxxx".

2. Reformatted the bottom info line in the CATALOG, and added another line which shows the sum of the blocks used in the files shown.

3. The first line printed by CATALOG used to be just the directory file name. I have modified it to now usually print the complete pathname. It still only prints a partial pathname in the instance when the current prefix is used to specify only a part of the pathname.

Compatibility with Clones:

Recoded the MEMORY command so that it does not use MON.PRYX, since that entry point is missing in the Franklin and Laser-128 monitors, and prints a colon instead of a dash in the IIgs. Also eliminated calls to MON.ZMODE and MON.ADDINP for the same reason.