!pr2
!lm12
!rm75
Giant Macro for Writing Messages..............Robert B. Steiner

Every time I turn around I seem to need a quick and dirty routine to print out a message.  I must have written them a dozen different ways, to fill various requirements.  Sometimes they are only different because of a silly mistake...a difference usually called a bug.  I could keep a handful of them on a subroutine library, but then I might get mixed up as to which one was which.

S-C Macro Assembler to the rescue!  By writing one of largest macros I have ever seen, I can get all the message-printer-variants into one neat little package.  Then by choosing the correct parameters, the kind of printing routine I want is generated on the spot.

I call the macro CRT, and you call it with up to five parameters.  The call line will look like one of these:
!lm17

>CRT L,N,"your message"
>CRT L,I,"your message"
>CRT A,N,address of your message
>CRT A,I,address of your message

!lm12
The first parameter, which may be "L" or "A", indicates whether you will give an actual message in quotation marks, or the address of the message.

The second parameter, which may be "N" or "I", stands for Normal or Inverse video display.

The third parameter is either the message itself in quotes, or the address of the message (a label, of course).

An optional fourth parameter may be "I", "Y", or "R".  "I" will generate code to read an immediate one byte reply, which is returned in the A-register.  "Y" will generate the one byte reply code, followed by additional code to check for a yes/no response.  It will loop until you type "Y" or "N"; then it will echo the letter, print a RETURN, and return with the character in the A-register.

If the fourth parameter is "R",an entire line of reply is expected.  If there is no fifth parameter, the line will be at $200 for your program to analyze.  If a fifth parameter is used, it is the name of a buffer for the reply message.

If I counted correctly, there are twenty different possible ways the macro can be generated!

Here is the macro definition, and some sample call lines.  Try it out; you'll find it fun and educational, whether its useful to you or not.  Then you can apply some of the techniques in your own work.
