Legacy Plugin Collection

asciimap

Defines a custom character mapping table.

Syntax

.asciimap character, replacement
.asciimap start, end, replacement

Remarks

(Taken from the Brass 1 documentation).

Defines an ASCII mapping table. In English, this is a special table that can be used to translate strings from the ASCII you're dealing with on your PC to any special variations on the theme on the device you are assembling to. For example, the TI-83 Plus calculator has a θ symbol where the '[' is normally. Using an ASCII mapping table, you could automatically make any strings defined using the .db directive handle this oddity. Another possibility would be a font where A-Z is actually 0-25 rather than the usual 65-90.

The first two arguments define the range of characters you are translating, inclusive. You can miss out the second one if you are only redefining a single character. The final argument is a special rule telling Brass how to perform the translation. It is a standard expression, where the special code {*} specifies the current character being translated.

Warning

Any custom string encoders are disabled during the execution of this directive. That is, if the current custom string encoder maps 'A' to 0, 'A' will be interpreted as 65 instead as that is the value that it maps to under the default compiler encoding.

Examples

Force all strings UPPERCASE.

.asciimap 'a', 'z', {*}+('A'-'a')

Reset to standard mapping.

.asciimap $00, $FF, {*}

Turn spaces into underscores.

.asciimap ' ', '_'

Make each letter in the range A⇒Z one bigger (A→B, B→C &c).

.asciimap 'A', 'Z', {*}+1

Clear the most significant bit (limit to 7-bit ASCII).

.asciimap 128, 255, {*}&%01111111