Asmj syntax

Last revised: 23-Nov-2003
Syntax of 80xx-family comments

A comment line either begins with an asterisk in the very first column (followed by anything else); or consists of some number of white-space characters (possibly zero) followed by a semi-colon (followed by anything else). The entire line is discarded.

	spaces ::= " " ...
	commentline ::= '*' <anything>
	             |  <spaces> ';' <anything>


Syntax of 80xx-family numbers

For 80xx processors, numbers can be specified with a suffix that indicates the base. The suffix is a single letter, and is not case sensitive.

  1. Decimal numbers

    A decimal number may have the suffix "D" to emphasize that it is actually decimal. The suffix is unnecessary, since a string of digits without any suffix is taken to be decimal.

    	decimal_digit ::= "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9"
    	decimal_suffix ::= "D"|"d"
    	decimal_number ::= <decimal_digit>... [<decimal_suffix>]
    

  2. Hexadecimal numbers

    A hexadecimal number is indicated by the suffix "H".

    Note that a hexadecimal number beginning with 'A' through 'F' would be mistaken for a symbol name. To force it to be recognized as a number, just add a leading zero.

    This is exactly equivalent to the processor-neutral form in which the prefix "0x" indicates a hexadecimal number. (This does not displace the processor-neutral syntax; either syntax may be used to the same effect.)

    	hex_digit ::= <decimal_digit>|"A"|"B"|"C"|"D"|"E"|"F"
    	hex_suffix ::= "H"|"h"
    	hex_number ::= <decimal_digit> <hex_digit>... <hex_suffix>
    

  3. Octal numbers

    An octal number is indicated by a suffix of either "O" or "Q". ("Q" is allowed because the letter "O" could be too easily misread as zero.)

    	octal_digit ::= "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"
    	octal_suffix ::= "O"|"o"|"Q"|"q"
    	octal_number ::= <octal_digit>... <octal_suffix>
    

  4. Binary numbers

    An binary number is indicated by a suffix of "B".

    	binary_digit ::= "0"|"1"
    	binary_suffix ::= "B"|"b"
    	binary_number ::= <binary_digit>... <binary_suffix>
    


Syntax of 80xx-family pseudo-ops

  1. db

    "Define bytes" allows for leaving initialized byte data in memory. Its argument is a comma-separated list of numeric values, each stored in a single byte. Any value which is too large to fit in a single byte is shortened to its least-significant byte, except for strings in quotes which are treated as if each character was a distinct value in the list.

  2. dw

    "Define words" is like "db", except that each value is stored in a pair of bytes, least-significant byte first. Just as for "db", characters of quoted strings are treated as if they were specified as individual values, which now means that they get two bytes each.

  3. ds

    This pseudo-op lets you "define storage" of a specified length. The contents of the block of memory are unspecified, and your program cannot depend on them to be initialized. The argument is a numeric expression telling how many bytes to reserve.

    Because the value of the expression determines the placement in memory of the following code, and therefore the value of the symbols defined there, the expression cannot contain forward references to those symbols; all symbols used in the expression must have values defined before the 'ds' itself.