Table of Contents        Previous topic       Next topic       

ASSEMBLER DIRECTIVES->Other Assembler Directives->DEFM

DEFM  Define Memory

This directive stores a string as data.  There are two formats for the instruction:

DEFM n,<Ascii character string>

where n is a decimal number that indicates the number of characters required in the string. A comma must follow the number and the character string is placed immediately after the comma. (A comma can still be used in the character string).

When n is greater than the number of characters in the character string, then $20's (Ascii space character) are appended to the data generated to make up the total number bytes.

When n is smaller than the number of characters in the character string, then the string is truncated with only the first n characters being used.

DEFM d<string>d

This form of fcc requires the character string to be enclosed in delimiters (symbolised above by 'd').  The delimiter may be any valid character including a digit (but if a digit is used, the first character of the string should not be a comma since the cross-assembler will then assume that the operand is the previous form of fcc).  The same delimiter must be used to end the string as is used at the beginning.


   1                              nam     defmxampl   l
   2                              ttl     define memory
   3 0000 54 72 75 6E   label1    defm    4,Truncated
   4 0004 46 69 6C 6C   label2    defm    12,Filled   
     0008 65 64 20 20
     000C 20 20 20 20
   5 0010 53 74 72 69   label3    defm    "String"    
     0014 6E 67