Document Navigation
Table Of Contents
Previous
Next

V. STANDARD DIRECTIVES OR PSEUDO-OPS

Besides the standard machine language mnemonics, the TSC assembler supports several directives or pseudo-ops. These are instructions for the assembler to perform certain operations, and are not directly assembled into code. There are three types of directives in this assembler, those associated with macros, those associated with conditional assembly, and those which generally can be used anywhere which we shall call "standard directives". This section is devoted to descriptions of these directives which are briefly listed here:

ORG SETDP
END PAG
RMB SPC
FCB NAM or TTL
FDB STTL
FCC ERR
EQU RPT
SET LIB
REG OPT

Descriptions of each directive and its use follow.

ORG

The ORG statement is used to set a new code 'Origin'. This simply means that a new address is set into the location Counter (or program counter) so that subsequent code will be placed at the new location. The form is as follows:

ORG <expression>

No label may be placed on an ORG statement and no code is produced. If no ORG statement appears in the source, an origin of 0000 is assumed.

END

The END pseudo-op is used to signal the assembler that the end of the source input has occurred. This terminates whatever pass is currently being executed. No label is allowed and no code is generated. An expression may be given (as shown below) as the transfer address to be placed in a binary file. It is optional, and if supplied when no binary file is being produced, will be ignored.

END [<expression>]

Note that an end statement is not strictly required, but is the only means of getting a transfer address appended to a binary output file.

RMB

The RMB or Reserve Memory Bytes directive is used to reserve areas of memory for data storage. The number of bytes specified by the expression in the operand are skipped during assembly. No code is produced in those memory location and therefore the contents are undefined at run time. The proper useage is shown here:

[<label>] RMB <expression>

The label is optional, and the expression is a 16 bit quantity.

FCB

The FCB or Form Constant Byte directive is used to set associated memory bytes to some value as determined by the operand. FCB may be used to set any number of bytes as shown below:

[<label>] FCB <expr. 1>,<expr. 2>,....<expr. n>

Where <expr. x> stands for some expression. Each expression given (separated by commas) is evaluated to 8 bits and the resulting quantities are stored in successive memory locations. The label is optional.

FDB

The FDB or Form Double Byte directive is used to setup 16 bit quantities in memory. It is exactly like the FCB directive except that 16 bit quantities are evaluated and stored in memory for each expression given. The form of the statement is:

[<label>] FDB <expr. 1>,<expr. 2>,...,<expr. n>

Again, the label field is optional.

FCC

The FCC or Form Constant Character directive allows the programmer to specify a string of ASCII characters delimited by some non-alphanumeric character such as a single quote. All the characters in the string will be converted to their respective ASCII values and stored in memory, one byte per character. Some valid examples follow:

LABEL1 FCC 'THIS IS AN FCC STRING'
LABEL2 FCC .SO IS THIS.
FCC /LABELS ARE NOT REQUIRED./

There is another method of using FCC which is a deviation from the standard Motorola definition of this directive. This allows you to place certain expressions on the same line as the standard FCC delimited string. The items are separated by commas and are evaluated to 8 bit results. In some respects this is like the FCB directive. The difference is that in the FCC directive, expressions must begin with a letter, number or dollar-sign whereas in the FCB directive any valid expression will work. For example, %10101111 would be a valid expression for an FCB but not for an FCC since the percent-sign would look like a delimiter and the assembler would attempt to produce 8 bytes of data from the 8 ASCII characters which follow (an FCC string). The dollar-sign is an exception to allow hex values such as $0D (carriage return) to be inserted along with strings. Some examples follow:

INTRO FCC 'THIS STRING HAS CR & LF',$D,$A
FCC 'STRING 1',0,'STRING 2'
FCC $04,LABEL,/DELIMITED STRING/

Note that more than one delimited string may be placed on a line as in the second example.

EQU

The EQU or Equate directive is used to equate a symbol to the expression given in the operand. No code is generated by this statement. Once a symbol has been equated to some value, it may not be changed at a later time in the assembly. The form of an equate statement is as follows:

<label> EQU <expression>

The label is strictly required in equate statements.

SET

The SET directive is used to set a symbol to the value of some expression, much as an EQU directive. The difference is that a symbol may be SET several times within the source (to different values) while a symbol may be Equated only once. If a symbol is SET to several values within the source, the current value of the symbol will be the value last SET. The statement form is:

<label> SET <expression>

The label is strictly required and no code is generated.

REG

The REG directive allows the user to setup a list of registers for use by the push and pull instructions. This list is represented by a value and the value is equated to the label supplied. In this respect, the REG directive is similar to the EQU directive. The correct form of the REG directive is:

<label> REG <register list>

As an example, suppose a program has a large number of occurences of the following instructions:

PSHS A,B,Y,U,DP
PULS A,B,Y,U,DP

To make things more convenient and less error prone the REG directive could be used as shown here:

RLIST2 REG A,B,Y,U,DP

Now all the pushes and pulls referred to above could be accomplished with the statements:

PSHS #RLIST2
PULS #RLIST2

Of course, the register list may still be typed out on push and pull instructions or an immediate value (with the desired bit pattern) may be specified.

SETDP

The SETDP or Set Direct Page directive allows the user to set which memory page the assembler will use for the direct page addressing mode. The correct format is as follows:

SETDP [<page value>]

As an example, if "SETDP $D0" is encountered, the assembler will then use direct addressing for any address in the range of $D000 to $D0FF. It is important to note that this directive does not actually affect the contents of the direct page register. The value set is what will be used at assembly time to determine direct addressing, but it is up to the user to be sure the DP register corresponds at run time. If there is no <page value> supplied, direct addressing will be disabled and all addresses will be full 16 bit values. Any number of SETDP instructions may occur in a program. The default value is page 0 (for 6800 compatibility).

PAG

The PAG directive causes a page eject in the output listing and prints a header at the top of the new page. Note that the 'PAG' option must have been previously selected in order for this directive to take effect. It is possible to assign a new number to the new page by specifying such in the operand field. If no page number is specified, the next consecutive number will be used. No label is allowed and no code is produced. The PAG operator itself will not appear in the listing unless some sort of error is encountered. The proper form is:

PAG [<expression>]

Where the expression is optional. The first page of a listing does not have the header printed on it and is considered to be page 0. The intention here is that all options, title, and subtitle may be setup and followed by a PAG directive to start the assembled listing at the top of page 1 without the option, title, or subtitle instructions being in the way.

SPC

The SPC or Space directive causes the specified number of spaces (line feeds) to be inserted into the output listing. The general form is:

SPC [<space count>[,<keep count>]]

The space count can be any number from 0 to 255. If the page option is selected, SPC will not cause spacing past the top of a new page. The <keep count> is optional and is the number of lines which the user wishes to keep together on a page. If there are not enough lines left on the current page, a page eject is performed. If there are <keep count> lines left on the page (after printing <space count> spaces), output will continue on the current page. If the page option is not selected, the <keep count> will be ignored. If no operand is given (ie. just the directive SPC), the assembler will default to one blank line in the output listing.

TTL or NAM

The TTL or NAM directive allows the user to specify a title or name to the program being assembled.. This title is then printed in the header at the top of each output listing page if the page option is selected. If the page option is not selected, this directive is ignored. The proper form is:

TTL <text for the title>
or
NAM <text for the title>

All the text following the TTL or NAM directive (excluding leading spaces) is placed in the title buffer. Up to 32 characters are allowed with any excess being ignored. It is possible to have any number of TTL or NAM directives in a source program. The latest one encountered will always be the one used for printing at the top of the following page(s).

STTL

The STTL or Subtitle directive is used to specify a subtitle to be printed just below the header at the top of an output listing page. It is specified much as the TTL directive:

STTL <text for the subtitle>

The subtitle may be up to 52 characters in length. If the page option is not selected, this directive will be ignored. As with the TTL option, any number of STTL directives may appear in a source program. The subtitle can be disabled or turned off by an STTL command with no text following.

ERR

The ERR directive may be used to insert user-defined error messages in the output listing. The error count is also bumped by one. The proper form is:

ERR <message to be printed>

All text past the ERR directive (excluding leading spaces) is printed as an error message (it will be preceded by three asterisks) in the output listing. Note that the ERR directive line itself is not printed. A common use for the ERR directive is in conjunction with conditional assembly such that some user-defined illegal condition may be reported as an error.

RPT

The RPT or Repeat directive causes the succeeding line of source to be repeated some specified number of times. The syntax is as follows:

RPT <count>

where <count> may be any number from 1 to 127. For example, the following two lines:

RPT 4
ASLB

would produce an assembled output of:

ASLB
ASLB
ASLB
ASLB

Some directives, such as IF or MACRO, may not be repeated with the RPT command. These cases are where it is illogical or impractical to do so. If attempted, the RPT will simply be ignored.

LIB

The LIB or Library directive allows the user to specify an external file for inclusion in the assembled source output. Under normal conditions, the assembler reads all input from the file specified on the calling line. The LIB directive allows the user to temporarily obtain the source lines from some other file. When all the lines in that external file have been read and assembled, the assembler resumes reading of the original source file. The proper syntax is:

LIB <file spec>

where <file spec> is a standard FLEX file specification. The default drive is the assigned working drive and the default extension is .TXT. Any END statements found in the file called by the LIB directive are ignored. The LIB directive line itself does not appear in the output listing. Any number of LIB instructions may appear in a source listing. It is also possible to nest LIB files up to 12 levels. Nesting refers to the process of placing a LIB directive within the source that is called up by another LIB directive. In other words, one LIB file may call another.

OPT

The OPT or Option directive allows the user to choose from several different assembly options which are available to him. These options are generally related to the format of the output listing and object code. The options which may be set with this command are listed below. There are several options not listed here which may be set from the FLEX command line. See the appropriate section earlier in the manual for these options. The proper form of this instruction is:

OPT <option 1>,<option 2>,...,<option n>

Note that any number of options may be given on one line if separated by commas. No label is allowed and no spaces may be imbedded in the option list. The options are all set during pass one only although the instruction is parsed in pass two as well for error reporting purposes. If contradicting options are specified, the last one appearing takes precedence. If a particular option is not specified, the default case for that option takes effect. The default cases are signified below by an asterisk.

The allowable options are:

PAG enable page formatting and numbering
NOP* disable pagination

CON print conditionally skipped code
NOC* suppress conditional code printing

MAC* print macro calling lines
NOM suppress printing of macro calls

EXP print macro expansion lines
NOE* Suppress macro expansion printing

* denotes default option and is not part of option name


Table Of Contents Previous Next
Document Navigation