Number of characters directive
Format
.NCHR symbol,<string>
1 – Parameters
symbol
A symbol that is assigned a value equal to the number of
characters in the specified character string.
<string>
A sequence of printable characters. Delimit the character
string with angle brackets (<>) (or a character preceded by a
circumflex (^)) only if the specified character string contains
a legal separator (comma, space, or tab) or a
semicolon (;).
2 – Description
.NCHR determines the number of characters in a specified
character string. It can appear anywhere in an MACRO-64 program
and is useful in calculating the length of macro arguments.
3 – Notes
o You can use the %LENGTH lexical operator instead of the .NCHR
directive.
4 – Examples
Example 1
The macro definition is as follows:
.MACRO CHAR MESS ; Define MACRO
.NCHR CHRCNT,<MESS> ; Assign value to CHRCNT
.WORD CHRCNT ; Store value
.ASCII "MESS" ; Store characters
.ENDM CHAR ; Finish
Example 2
The macro calls and expansions of the macro previously defined
are as follows:
CHAR <HELLO> ; CHRCNT will = 5
.NCHR CHRCNT,<HELLO> ; Assign value to CHRCNT
.WORD CHRCNT ; Store value
.ASCII "HELLO" ; Store characters
CHAR <14, 75.39 4> ; CHRCNT will = 12(dec)
.NCHR CHRCNT,<14, 75.39 4> ; Assign value to CHRCNT
.WORD CHRCNT ; Store value
.ASCII "14, 75.39 4" ; Store characters