This chapter describes the Motorola syntax module, mostly used for the M68k and ColdFire families of CPUs, which is available with the extension @code{mot}. @section Legal This module is written in 2002-2026 by Frank Wille and is covered by the vasm copyright without modifications. @section Additional options for this module This syntax module provides the following additional options: @table @option @item -align Enables natural alignment for data (e.g. @code{dc}, @code{ds}) and offset directives (@code{rs}, @code{so}, @code{fo}). @item -allmp Makes all 35 macro arguments available. Default are 9 arguments (@code{\1} to @code{\9}). More arguments can be accessed through @code{\a} to @code{\z}, which may conflict with escape characters or named arguments, therefore they are not enabled by default. @item -cnop= Sets the two-byte code used for alignment padding with @code{cnop} in code sections. Defaults to @code{0x4e71} on M68k. @item -devpac Devpac-compatibility mode. Only directives known to Devpac are recognized. @itemize @minus @item Enables natural alignment for data and structure offsets (see option @option{-align}). @item Predefines offset symbols @code{__RS}, @code{__SO} and @code{__FO} as @code{0}, which otherwise are undefined until first referenced. @item Disable escape codes handling in strings (see @option{-noesc}). @item Enable dots within identifiers (see @option{-ldots}). @item Up to 35 macro arguments (see @option{-allmp}). @item Do not use @code{NOP} instructions when aligning code (see @option{-cnop=}). @item Allow a label definition on the same line as a section directive. Note, that in contrast to Devpac this label is not ignored but set to the first address in the section! @end itemize @item -ldots Allow dots (@code{.}) within all identifiers. @item -localu Local symbols are prefixed by @code{'_'} instead of @code{'.'}. For Devpac compatibility, which offers a similar option. @item -nolocpfx Disables local symbols to be recognized by their prefix (usually @code{'.'}). This allows global symbols to be defined with it. The @code{'$'} suffix for local symbols still works. @item -phxass PhxAss-compatibility mode. Only directives known to PhxAss are recognized. @itemize @minus @item Enable escape codes handling in strings (see @option{-esc}). @item Macro names are case-insensitive. @item Up to 35 macro arguments (see @option{-allmp}). @item Allow whitespace in operands. @item Enable dots within identifiers (see @option{-ldots}). @item Defines the symbol @code{_PHXASS_} with value 2 (to differentiate from the real PhxAss with value 1). @item When no output file name is given, construct it from the input name. @item Allow a label definition on the same line as a section directive. @end itemize @item -spaces Allow whitespace characters in the operand field. Otherwise a whitespace would start the comment field there. @item -warncomm Warn about all lines, which have comments in the operand field, introduced by a whitespace character. For example in: @code{dc.w 1 + 2}. @end table @section General Syntax Labels must either start at the first column of a line or have to be terminated by a colon (@code{:}). In the first case the mnemonic or assembler directive has to be separated from the label by whitespace (not required in any case, e.g. with the @code{=} directive). A double colon (@code{::}) automatically makes the label externally visible (refer to directive @code{xdef}). Local labels are either prefixed by '@code{.}' or suffixed by '@code{$}'. For the rest, any alphanumeric character including '@code{_}' is allowed. Local labels are valid between two global label definitions. Otherwise dots (@code{.}) are not allowed within a label by default, unless the option @option{-ldots} or @option{-devpac} was specified. Even then, labels ending on @code{.b}, @code{.w} or @code{.l} can't be defined. It is possible to refer to any local symbol in the source by preceding its name with the name of the last previously defined global symbol: @code{global_name\local_name}. This is for PhxAss compatibility only, and is no recommended style. Does not work in a macro, as it conflicts with macro arguments. Make sure that you don't define a label on the same line as a directive for conditional assembly (if, else, endif)! This is not supported and leads to undefined behaviour. Qualifiers are appended to the mnemonic, separated by a dot (if the CPU-module supports qualifiers). The operands are separated from the mnemonic by whitespace. Multiple operands are separated by comma (@code{,}). In any case, mnemonics and directives must not start on the first column! The operand field, which is separated by whitespace from the mnemonic/directive field, must not contain any whitespace characters itself, as long as the option @option{-spaces} was not specified. Comments can be introduced everywhere by the characters @code{;} or @code{*}. The rest of the line will be ignored. Also everything following the operand field, separated by a whitespace, will be regarded as comment (unless @option{-spaces} was given). Be careful with @code{*}, which is either recognized as the "current pc symbol" or as a multiplication operation in any operand expression Example: @example mylabel inst.q op1,op2,op3 ;comment @end example In expressions, numbers starting with @code{$} are hexadecimal (e.g. @code{$fb2c}). @code{%} introduces binary numbers (e.g. @code{%1100101}). Numbers starting with @code{@@} are assumed to be octal numbers, e.g. @code{@@237}. All numbers starting with a digit are decimal, e.g. @code{1239}. @section Operators The following operators are changed from vasm's standard: @table @code @item = Boolean Equality. Additional to standard @code{==}. @item // Modulo. Additional to standard @code{%}. @item ! Bitwise Or. Additional to standard @code{|}. @item ~ Bitwise Exclusive Or. Additional to standard @code{^}. @end table @section Directives The following directives are supported by this syntax module (provided the CPU- and output-module support them): @table @code @item = Equivalent to @code{ equ }. @item =.s Equivalent to @code{ fequ }. PhxAss compatibility. @item =.d Equivalent to @code{ fequ }. PhxAss compatibility. @item =.x Equivalent to @code{ fequ }. PhxAss compatibility. @item =.p Equivalent to @code{ fequ }. PhxAss compatibility. @item align Insert as many zero bytes as required to reach an address where low order bits are zero. For example @code{align 2} would make an alignment to the next 32-bit boundary. @item assert [,] Display an error with the optional when the expression is false. @item blk.b [,] Equivalent to @code{dcb.b ,}. @item blk.d [,] Equivalent to @code{dcb.d ,}. @item blk.l [,] Equivalent to @code{dcb.l ,}. @item blk.q [,] Equivalent to @code{dcb.q ,}. @item blk.s [,] Equivalent to @code{dcb.s ,}. @item blk.w [,] Equivalent to @code{dcb.w ,}. @item blk.x [,] Equivalent to @code{dcb.x ,}. @item bss Equivalent to @code{section bss,bss}. @item bss_c Equivalent to @code{section bss_c,bss,chip}. @item bss_f Equivalent to @code{section bss_f,bss,fast}. @item cargs [#,][.][,[.]]... Defines with the value of . Further symbols on the line, separated by comma, will be assigned the plus the size of the previous symbol. The size defaults to 2. Valid optional size extensions are: @code{.b}, @code{.w}, @code{.l}, where @code{.l} results in a size of 4, the others 2. The argument defaults to the target's address size (4 for M68k) when omitted. @item clrfo Reset stack-frame offset counter to zero. See @code{fo} directive. @item clrso Reset structure offset counter to zero. See @code{so} directive. @item cnop , Insert as many padding bytes as required to reach an address which can be divided by . Then add padding bytes. May fill the alignment- and padding-bytes with no-operation instructions for certain cpus. See option @option{-cnop}. @item code Equivalent to @code{section code,code}. @item code_c Equivalent to @code{section code_c,code,chip}. @item code_f Equivalent to @code{section code_f,code,fast}. @item comm , Create a common symbol with the given size. The alignment is always 32 bits. @item comment Starting with the operand field everything is ignored and seen as a comment. There is only one exception, when the operand contains @code{HEAD=}. Then the following expression is passed to the TOS output module via the symbol '@code{TOSFLAGS}', to define the Atari specific TOS flags. @item cseg Equivalent to @code{section code,code}. @item data Equivalent to @code{section data,data}. @item data_c Equivalent to @code{section data_c,data,chip}. @item data_f Equivalent to @code{section data_f,data,fast}. @item db [,,"",''...] Equivalent to @code{dc.b} for ArgAsm, BAsm, HX68, Macro68, ProAsm, etc. compatibility. Does not exist in PhxAss- or Devpac-compatiblity mode. @item dc.b [,,"",''...] Assign the integer or string constant operands into successive bytes of memory in the current section. Any combination of integer and character string constant operands is permitted. @item dc.d [,...] Assign the values of the operands into successive 64-bit words of memory in the current section, using the IEEE double precision format when specifying them as floating point constants. @item dc.l [,...] Assign the values of the operands into successive 32-bit words of memory in the current section. @item dc.p [,...] Assign the values of the operands into successive 96-bit words of memory in the current section, using the Packed Decimal format when specifying them as floating point constants. @item dc.q [,...] Assign the values of the operands into successive 64-bit words of memory in the current section. @item dc.s [,...] Assign the values of the operands into successive 32-bit words of memory in the current section, using the IEEE single precision format when specifying them as floating point constants. @item dc.w [,...] Assign the values of the operands into successive 16-bit words of memory in the current section. @item dc.x [,...] Assign the values of the operands into successive 96-bit words of memory in the current section, using the IEEE extended precision format when specifying them as floating point constants. @item dcb.b [,] Insert zero or bytes into the current section. @item dcb.d [,] Insert zero or 64-bit words into the current section. may also be a floating point constant which is then written in IEEE double precision format. @item dcb.l [,] Insert zero or 32-bit words into the current section. @item dcb.q [,] Insert zero or 64-bit words into the current section. @item dcb.s [,] Insert zero or 32-bit words into the current section. may also be a floating point constant which is then written in IEEE single precision format. @item dcb.w [,] Insert zero or 16-bit words into the current section. @item dcb.x [,] Insert zero or 96-bit words into the current section. may also be a floating point constant which is then written in IEEE extended precision format. @item dl [,...] Equivalent to @code{dc.l} for ArgAsm, BAsm, HX68, Macro68, ProAsm, etc. compatibility. Does not exist in PhxAss- or Devpac-compatiblity mode. @item dr.b [,...] Calculates - and stores it into successive bytes of memory in the current section. @item dr.w [,...] Calculates - and stores it into successive 16-bit words of memory in the current section. @item dr.l [,...] Calculates - and stores it into successive 32-bit words of memory in the current section. @item ds.b Equivalent to @code{dcb.b ,0}. @item ds.d Equivalent to @code{dcb.d ,0}. @item ds.l Equivalent to @code{dcb.l ,0}. @item ds.q Equivalent to @code{dcb.q ,0}. @item ds.s Equivalent to @code{dcb.s ,0}. @item ds.w Equivalent to @code{dcb.w ,0}. @item ds.x Equivalent to @code{dcb.x ,0}. @item dseg Equivalent to @code{section data,data}. @item dw [,...] Equivalent to @code{dc.w} for ArgAsm, BAsm, HX68, Macro68, ProAsm, etc. compatibility. Does not exist in PhxAss- or Devpac-compatiblity mode. @item dx.b Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.b ,0}. @item dx.d Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.d ,0}. @item dx.l Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.l ,0}. @item dx.q Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.q ,0}. @item dx.s Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.s ,0}. @item dx.w Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.w ,0}. @item dx.x Tries to allocate space in the DataBss portion of a code or data section. Otherwise equivalent to @code{dcb.x ,0}. @item echo <"string"|exp>[,<"string"|exp>]... Prints one or more strings or expressions to stdout, terminated by a newline. Strings are identified by single- or double-quotes. In PhxAss-comapatibility mode only a single string can be printed. @item einline End a block of isolated local labels, started by @code{inline}. @item elif This is a real else-if directive! Not supported by Devpac. It's the same as @code{else} followed by @code{if}, but without the need for a matching @code{endif} directive. Avoids nesting. @item else Assemble the following lines if the previous @code{if} condition was false. @item elseif Same as @code{else}, for compatibility! @item end Assembly will terminate with this line. The subsequent source text is ignored. @item endif Ends a section of conditional assembly. @item endm Ends a macro definition. @item endr Ends a repetition block. @item equ Define a new program symbol with the name and assign to it the value of . Defining twice will cause an error. @item equ.s Equivalent to @code{ fequ }. PhxAss compatibility. @item equ.d Equivalent to @code{ fequ }. PhxAss compatibility. @item equ.x Equivalent to @code{ fequ }. PhxAss compatibility. @item equ.p Equivalent to @code{ fequ }. PhxAss compatibility. @item erem Ends an outcommented block. Assembly will continue. @item even Aligns to an even address. Equivalent to @code{cnop 0,2}. @item fail Show an error message including the string. Do not generate an output file. @item fequ Define a new program symbol with the name and assign to it the floating point value of . Defining twice causes an error. The size extension is for Devpac-compatibility, but will be ignored. @item fequ.s Equivalent to @code{ fequ }. @item fequ.d Equivalent to @code{ fequ }. @item fequ.x Equivalent to @code{ fequ }. @item fequ.p Equivalent to @code{ fequ }. @item