!pr1
Improved DOS 3.3 Number Parsing............Bob Sander-Cederlof

Whether Apple knows or not, cares or not, likes it or not, DOS 3.3 is still alive.  And still the system of choice to most of their loyal customers.

The //c ROMs new //e ROMs and patch Applesoft so that lower case keywords and commands can be typed without penalty.  However, since they are promoting ProDOS and do not care about DOS, they did nothing to give it the freedom to accept lower case commands.  I am constantly chafing over the necessity of popping the shift lock key up and down, (down for DOS and up for word processing).  Surely a very small patch would do the trick.

I looked around and found the subroutine DOS uses to pick characters out of the command buffer, at $A193-$A1AD.  Six bytes of new code inserted right before the CMP #$AC at $A1A1 would do it.  By putting a JSR to a patch in place of the STX $AA5D at $A19E, a ten-byte patch subroutine would solve my problem.

But where do I get a ten-byte hole to fit this patch into?  All the holes I know about have already been used now, and I really don't want to eliminate any exisiting features.  The only solution is to find some loosely written code and rewrite it with compactness as the major criterion.

The code to be recoded must be relatively unused.  That is, not likely to be called at internal places by sneaky software.  I found a likely candidate in the number conversion subroutine used in parsing DOS commands.  This subroutine occupies from $A1B9 through $A228.  I ran a cross reference on the outer shell portion of DOS ($9D84-$A883) using Rak-Ware's DISASM program, and verified that there are no entry points into this code except at the beginning.  It is called from only two places, $A0AA and $A127.

Here is a commented disassembly of the subroutine.


<<<code here for Apple's version>>>


Now here is my revised version, which is sixteen bytes shorter.  It is also a little faster, though that is not important.  As far as I can tell, no features are changed.  There is room for my ten-byte lower-case patch and six bytes to spare!

Compare the two versions to see where I found the extra bytes.  Part of the savings was gained by using a better algorithm for reducing an ASCII character to a hex or decimal digit.  Changing the order of the sections of the program saved more bytes, by eliminating JMPs and "branch always" ops.  I kept the same local line numbers in the new version to aid you in locating similar sections.


<<<code for new version>>>


It is always nice to be able to make a self-installing patch, so I dug out the April 83 issue of AAL for Bill Morgan's PATCHER program.  I found the source on a Quarterly Disk, and merged it with the new number parser.  Then I added my lower case patch, and glued it all together.  The listing that follows is the result.  If the program is BRUN it will install the new parser and the lower case filter automatically.
