[comp.os.cpm] Dualcase MACRO-80 Assembler Patch

greg@utcsri.UUCP (Gregory Smith) (12/30/86)

There was some demand for this, so here goes.

APPLICABILITY:
	Microsoft MACRO-80 assembler, version 3.44.
	The title of an assembler listing shows:
		MACRO-80 3.44   30-Mar-82

EFFECT:
	(1) upper and lower case in symbols become distinct. External
	symbols are passed to the linker L80 with their case intact.
	L80 and LIB80 don't seem to have any trouble with the lowercase
	letters. Macro names are also dualcase; you may define a macro
	'call' which does not conflict with the mnemonic CALL.

	(2) As a side-effect of (1), predefined symbols such as mnemonics,
	assembler directives, and register names must be in UPPER case.

	(3) The warning message '%No END statement' becomes '%No END'
	[ I had to get a few bytes from somewhere...]

	(4) WEIRDNESS:: The symbols are shoved into buckets based on their
	first letter. After the patch, 'FOOBAR' and 'frobozz' go into the
	same bucket. The problem is that the table lookup code assumes that
	each bucket contains symbols with the same initial letter, so
	'foobar' will conflict with 'Foobar'. I don't know whether this
	can be fixed. The initial letter *is* stored in the symbol table,
	since 'foobar' and 'Foobar' are both propogated intact into the
	object module (provided only one of the two is defined).
	L80 does not suffer from this problem.

PATCH:
-----------------------------------
 OFFSET	    ADDRESS
(in file) (in memory)	WAS   BECOMES
   40B	       50B	20	00
			73	D6
			74	3B
			61	E6
			74	1F
			65	4F
			6D	C9

   A82	       B82	20	00

   BFC	       CFC	D6	C3
			3B	0C
			4F	05
-----------------------------------

People who already have large run-time object libraries with all uppercase
globals will need to reassemble them with the patched assembler in order to
call them from C using lower case symbols. Perhaps a more useful patch would
invert the case; a call to printf() would refer to the global 'PRINTF', and
the function FooBar would appear to the linker as 'fOObAR'. All predefined
assembler words would then have to appear in lowercase. If there is any
demand for such a weirdness, I will get out my byte-bashing utilities
and figure out the patch (If I remember correctly how the above patch
works, the case-inverting patch is quite simple).