General Message Printing Subroutine

Formatting a series of nice messages or screens-full of messages is hard enough to do in Applesoft...but in assembly language it can really be a difficult job.  And it seems to take so much memory to do the equivalent of VTAB, HTAB, HOME, and PRINT.  I was recently motivated to do something about this for a large, verbose program.  I designed a general subroutine for printing text, which can print all 128 chracters of ASCII, plus do some fancy footwork on the way.

Embedded control codes in the text to be printed perform such handy functions as HTAB, VTAB, HOME, NORMAL, INVERSE, Clear to End of LIne, Clear to End of Page, Two-Second Delay, and Repeat.  All characters to be printed directly are entered with the high-order bit set to one; bytes with the high order bit zero are control codes.  Comments in lines 1250-1350 of the listing show what the codes are.

To simplify the calling sequence, a table of message addresses is built along with the messages themselves.  To print a specific message, merely load the message index number into the A-register (LDA #0 for the first message, LDA #1 for the second, etc.), and JSR MESSAGE.PRINTER.  Some sample messages are given in the listing, starting at line 2240.

There are a lot of unused control codes, which you can use to augment the subroutine.  I am planning to add a code to switch to a HI-RES TEXT driver, for writing text on either of the two Hi-Res screens.  You can probably think of a lot of useful ones yourself.  The point is that this type of subroutine can simplify programming of an interactive program, and save memory too.
