General TIM Information
for WinTim32











3.6 Instruction Format Field Characteristics

Instruction format definitions are specified in terms of fields, where each field includes one or more contiguous bit positions of the instruction word.

Field characteristics include the following:

  1. Type. The three types of fields are as follows:
a. Constant fields

b. Variable fields (identified by type designator, V)

c. Unused (don’t care) fields (identified by type designator, X)
 
 

2. Width. This is the number of bit positions in the field. For variable or don’t care fields, this width must be specified by a decimal number which precedes the field type designator.

3. Position. Fields are listed in sequence from left to right. The most significant bit of the first field occupies the most significant bit position in the word. In field listings, commas (,) are used to separate successive fields. Two commas with no field listing between them indicate that a variable field of the word has been skipped. The notation [n] can be used to avoid entry of a long series of commas when a number of consecutive variable fields are to be skipped. [n] means skip to the nth field of the instruction format. (In this case, constant and don’t care fields as well as variable fields are counted).

4. Variable Field Attributes. These are attributes to be assigned to any constant substituted into the field at assembly time. They include the following:

a. Modifier attributes

b. Page address attribute ($)

c. Overlay attribute (@)
 
 

5. Variable Field Default Value. A variable field default value is a value that is substituted for a variable field by default if no other variable field substitution value is specified. A default value may be a constant, a constant name, a set-parameter name, or an expression and may have modifiers appended to it. Modifiers appended to a default value are processed by the definition-phase program to generate the final default value.

6. Default Base Designator Attribute. When no default value is listed, a default base designator attribute (e.g. H#, D#) can be specified for a field. This default designation governs if a numerical constant without a base designator attribute is substituted into the field. If the variable field substitution value includes a base designator attribute, this overrides the default base designator attribute.
 
 

3.7 Modifiers

Modifiers are special characters which are appended to constants or expressions to modify their evaluation. Modifiers can also be used as variable field attributes which modify the values of constants substituted into the fields at assembly time. Modifier characters are listed as follows:

NOTE: Modifiers are listed in the order in which they are processed. Inversion and negation cannot both be specified.
Character Modification Example
< PC-relative (When a PC-relative expression is evaluated, it is converted into a positive or negative displacement with respect to the program counter which points to the location following the one containing the microinstruction being evaluated. A negative displacement is represented in two’s complement form. For a relocatable symbol, the evaluation is performed by the linker phase.) 00A1< at location 00A4 yields negative displacement FFFC (-4) obtained by subtracting 00A5 (the PC value) from 00A1
* Inversion (one’s complementation) B#101* = B#010
- Negation (two’s complementation) B#101- = B#011
: Truncation (If implicit width of constant is greater than explicit width or is greater than width of variable field into which it is substituted, discard bits, starting at left end of constant, as required to produce residue matching explicit width or variable field width) 3B#1010: = B#010
% Right justification (If implicit width of constant is less than explicit width or is less than width of variable field into which it is being substituted, add leading zeros as required to match explicit width or variable field width) 5B#1010% = B#01010

3.8 Special Instruction Field Attributes

There are two special instruction field attributes: the page address attribute ($) and the overlay attribute (@).

Appending the page address attribute ($) to an instruction field specifies that the field is to be interpreted as an address within the currently addressed page. The width of the field to which the page attribute is appended implies the number of locations on a page.

For example, if the field width is 8 bits, then the page capacity must be 256 locations. When a constant of greater width than a page address field is substituted into that field, two operations are automatically performed. The constant is left truncated to fit the field. The truncated bits are compared with the corresponding bits of the current address to determine whether a page coundary has been crossed. If so, a page address error is generated.

Instruction formats having unused (don’t care) fields can be combined (overlaid) if the variable or constant field bits of each format are overlaid only on don’t care bits of the other format.

In special cases, a valid instruction may be formed by overlaying care bits from one format with care bits of another format. In order to allow this, the overlay attribute must be appended to the field whose care bits are to be used in the overlay.

3.9 Relocation

When a relocatable program module is assembled, an address is assigned to every microinstruction word. However, this address value represents an offset within the module rather than an absolute memory address location. At link time, each instruction word from a relocatable module is relocated at an absolute memory address. Thus, symbolic address labels specified in the instruction/data source statements of an assembly-phase source program for a relocatable module represent relocatable values rather than absolute memory address values. It follows from this that any expression containing a symbolic address label is also a relocatable quantity.

Symbolic address labels provide the means for linking separately assembled modules together. A branch instruction in module n to a symbolic address in module m constitutes a link from module n to module m. In order to allow such a link, the symbolic address label must be declared as an EXTRN symbol in module n and must be declared as a PUBLIC symbol in module m. The declaration of a symbol as EXTRN informs the assembly-phase program that the symbol is defined in another source program and that any expression containing the symbol must be passed to the linker for final evaluation. The use of PUBLIC symbol declarations identifies the symbols that must be passed to the linker for use in other modules.

The linkages which involve symbolic address labels establish program sequencing links. Constant names and set-parameter names can also be declared as PUBLIC symbols. This makes the associated values accessible at link time to other modules in which they are declared as EXTRN symbols. The disadvantage to this type of linkage is that expressions containing the EXTRN symbols cannot be evaluated completely until link time.

3.10 Statements

Depending upon the statement type, a statement may include up to four type of fields. Listed in the order in which they appear, if used, these field types are summarized in Table 3-6.

In general, statements that are not comment statements belong to one of two categories:

1. Pseudo instruction statements: These statements specify operations to be executed by the assembler programs. They do no result directly in the generation of object code. Such statements are used in both the definition-phase source program and the assembly-phase source program.

2. Instruction or data source statements: These statements specify operations to be executed by the target machine or data for use by the target machine. These instructions appear only in the assembly-phase source program. The assembly-phase program converts the into object code.
 
 

When a statement contains a symbol field, that field must be followed by a colon (:).

The statement operator must always be separated from the operand fields by a blank (space) character or a TAB character.

Successive operand fields must be separated by commas.

The comment field of a statement must always begin with a semi-colon (;). As this implies, a separate comment statement starts with a semi-colon.

Statements whose operator field contains a directive symbol are designated in terms of that directive. Thus, for example, a DEF statement is a statement containing the DEF directive symbol in its operator field. The only statements which do not contain a directive symbol in the operator field are MACRO calls (in which the MACRO name is the operator symbol) and formatted instruction statements (in which a format name is the operator symbol).

Certain statements, if too long to fit on a single line, can be completed on one or more continuation lines. A continuation line is identified by a slash (/) character in the first non-blank character position of the line. When a continuation is used, each line must end with a field delimiter or with a commend field word. DEF, SUB, FF, and formatted instruction statements can be completed on continuation lines.

The only format requirements for comment statements are that they begin with a semicolon (;) and that they be completed on a single line.

Table 3-6. Statement Field Types


Field Type Description
Symbol The symbol specified in this field assumes a functional identity as summarized in Table 3-2. Depending upon the statement type, the symbol field may be mandatory, optional, or not used.
Operator This field contains a symbol which has an operator identity. Symbols having operator identity include the directive symbol set, MACRO names (which are the operator symbols in MACRO call statements), and format names (which are the operator symbols in formatted instruction statements). To be processed by the assembler definition-phase or assembly phase program, a statement must contain an operator field. Formatted instruction statements may contain more than one format name; i.e. more than one operator field. Other types of statements are limited to a single operator field.
Operand These fields contain the operands required for the operation specified by the operator field. Depending upon the type of statement, the operand field may be mandatory, optional, or not used.
Comment This field contains information to be printed on program listings. It is not processed by the assembler programs. Any type of statement may have a comment field. A statement that has only a comment field is called a comment statement.

Chapter 4: Source Program Statements

4.1 Introduction

This chapter contains descriptions and formats of all of the types of statements, other than comment statements, that can be used in assembler source programs.

Statement types are divided into the categories listed in Table 4-1.

Each of the primary paragraphs which follows contains the descriptions of the statement types within one of the categories defined in Table 4-1 or of one of the statements within the miscellaneous category. Table 4-2 presents an alphabetical list of statement types with paragraph references for each statement type.

Table 4-1. Statement Categories

Category Description
Definition Statements This category includes the statements required to define instruction word length, instruction formats, and constants.
Print Control Statements This category includes statements which specify the scope and format of information printed out by the definition phase or assembly phase program.
Conditional Assembly Statements These are statements which make processing of associated source statements conditional upon the satisfaction of a specified condition
MACRO Definition and Call Statements These are statements used to define and call MACROs
Assembly Program Counter Control Statements These are statements which change the current value of the assembly program counter; that is, the counter whose value determines the memory address assigned to each machine instruction.
Instruction/Data Source Statements These are the statements which contain the symbolic instruction coding that is converted into machine code by the assembler-phase program.
Relocation Definition Statements This category includes the statement that specifies that a source program contains relocatable address and statements which list symbols involved in linkages between relocatable modules.
Miscellaneous Statements in this category are the INCLUDE, MAP, and END statements.

An INCLUDE statement specified a secondary source file whose statements are to be processed by the assembler program before the next statement in the primary source program is processed.

A MAP statement causes the generation and listing of an entry point map.

An END statement terminates a source program.

Table 4-2. Alphabetical List of Statement Types

Statement Type Category Comment
ALIGN Counter Control Assembly Phase Only
DATA Inst./Data Source Assembly Phase Only
DEF Definition Definition Phase Only
DUP Inst./Data Source  
EJECT Print Control  
ELSE Conditional Assembly  
END Miscellaneous  
ENDIF Conditional Assembly  
ENDM MACRO  
EQU Definition  
EXITM MACRO  
EXTRN Relocation Definition Assembly Phase Only
FF Inst./Data Source Assembly Phase Only
FORM Print Control Assembly Phase Only
FORMAT.INST Inst./Data Source Assembly Phase Only
HEAD Print Control Assembly Phase Only
IF Conditional Assembly  
IFC Conditional Assembly Assembly Phase Only
IFD Conditional Assembly Assembly Phase Only
IFNC Conditional Assembly Assembly Phase Only
IFND Conditional Assembly Assembly Phase Only
INCLUDE Miscellaneous  
LINES Print Control  
LIST Print Control  
LOCAL MACRO  
MACRO MACRO  
MACRO Call MACRO Assembly Phase Only
MAP Miscellaneous Assembly Phase Only
NOLIST Print Control  
ORG Counter Control Assembly Phase Only
PUBLIC Relocation Definition Assembly Phase Only
.REL Relocation Definition Assembly Phase Only
RES Counter Control Assembly Phase Only
SET Definition  
SPACE Print Control  
SUB Definition Definition Phase Only
TAB Print Control  
TITLE Print Control  
TITLE2 Print Control  
WIDTH Print Control  
WORD Definition  

4.2 Definition Statements

4.2.1 WORD Statement

The WORD statement specifies the nubmer of bits in the microword. It must appear in the definition phase source program prior to the first DEF statement.

The format of the WORD statement is:

WORD expression where the evaluation of expression must produce an integer between 1 and 256, decimal (NOTE: WinTim32 does not have this particular restriction; the word size is arbitrary). Example: WORD H#80 This specifies a microword width of 80 hexadecimal (128 decimal bits).

4.2.2 EQU Statement

An EQU statement equates a constant name to an expression.

The format of the EQU statement is:

symbol: EQU expression where symbol specifies the constant name which is equated to the constant obtained by evaluating expression. Example: R15: EQU H#F

This equates the symbol, R15, to the hexadecimal value, F. Wherever R15 appears in the operand field of a statement, the assembler will substitute the value F (hexadecimal) when the field is evaluated.
 
 

4.2.3 SET Statement

A SET statement specifies a value to be assigned to a parameter name until a later SET statement assigns another value to that paramter name.

The format of a SET statement is:

symbol: SET expression where symbol specifies the parameter nameto which the value obtained by evaluating expression is temporarily assigned. Example: DBUF: SET H#0800

This sets the symbol DBUF to the hexadecimal value 0800, until superceded by another SET statement with DBUF in the symbol field.

As long as this statement is not superceded, wherever DBUF appears in the operand field of a statement, the assembler will substitute the value 0800 (hexadecimal) when the field is evaluated.

4.2.4 DEF Statements

A DEF statement associates an instruction format name with an instruction format. The instruction format is defined as a set of fields. The order in which the fields are listed defines their position in the microinstruction word. Fields may be variable, constant, or don’t care.

A variable field is specified as follows:

(length)V{attributes}{default value}{default value modifiers}

or

(length)V{attributes}{default base designator attribute}

where:

length = number of bits (decimal) in field,

V specifies a variable field,

Optional attributes are as defined in paragraphs 3.6 and 3.7,

Optional default value is a numerical constant, an expression, or a don’t care (X),

Optional default value modifiers are from Table 3-5,

Optional default base designator attributes are H#, D#, Q#, B#.

A constant field contains a numerical constant (per paragraph 3.3) whose length is either explicitly or implicitly specified or an expression.

A don’t care field is specified as follows:

length X where: length = number of bits (decimal) in field

X specifies the don’t care field type

In addition to individual field specifications, a DEF statement may contain one or more instruction sub-format names. Each sub-format name specifies the inclusion of the set of fields associated with that sub-format name by a previous SUB statement.

The sum of the field lengths must equal the microword length specified in the WORD statement.

The maximum allowable number of fields in a DEF statement is 64. The maximum length of a variable or constant field is 31 bits. There is no restriction on the length of a don’t care field. (NOTE: WinTim32 has no theoretical limit on the number of fields in a DEF statement).

The format of a DEF statement is as follows:

symbolic name: DEF Field1{,field2,field3,…,fieldn} Example 1: ALU.4 DEF 8VH#FF,16VH#X,1VQ#4 /4X,2VQ#5,1B#1,1X where: ALU.4 = instruction format name

8VH#FF = 8-bit variable field with hexadecimal FF default value

16VH#X = 16-bit variable field with hexadecimal don’t care default value

1VQ#4 = 1-bit variable field with octal 4 default value

4X = 4-bit field with don’t care default value

2VQ#5 = 2-bit variable field with octal 5 default value

1B#1 = 1-bit binary constant field with a value of 1

1X = 1-bit field with don’t care default value

Example 2: ALU.3 DEF 8VH#00,OPR.IN,8X,3V:B#000, /3VB#010,1VB#1,1X where: 8VH#00 = 8-bit variable field with hexadecimal 00 default value

OPR.IN = instruction sub-format name (see SUB statement example below).

8X = 8-bit field with don’t care default value

3V:B#000 = 3-bit field with left-truncate attribute and binary 000 default value

3VB#010 = 3-bit variable field with binary 010 default value.

1VB#1 = 1-bit variable field with binary 1 default value

1X = 1-bit field with don’t care default value

4.2.5 SUB Statements

A SUB statement defines a set of contiguous fields of an instruction format and associates an instruction sub-format name with that definition. It is exactly like a DEF statement except that it does not define all of the fields of the instruction. The set of fields defined by a SUB statement is included in a DEF statement by entering the instruction sub-format name in the DEF statement (See Example 2 above).

Example: DT.OUT SUB 4VH#0,3VQ#0 Where: 4VH#0 = 4-bit variable field with hexadecimal 0 default value

3VQ#0 = 3-bit variable field with octal 0 default value

4.3 PRINT CONTROL STATEMENTS

4.3.1 LIST and NOLIST Statements

A LIST statement turns on a specified set of listing parameters while a NOLIST statement turns off a specified set of listing parameters. The parameters controlled by LIST and NOLIST statements and the default values of these parameters are summarized in Table 4-3. LIST and NOLIST statements can be used at any desired points in the source program to reverse the current status of any of the parameters.

The form of a LIST statement is:

LIST {p1{,p2{,…,pn}}} Where p1, p2,…pn are parameters from Table 4-3. Example: LIST Q,F The statement: LIST With no parameters is equivalent to: LIST S The form of a NOLIST statement is: NOLIST {p1{,p2{,…,pn}}} Where p1, p2…,pn are parameters from Table 4-3.

The statement:

NOLIST With no parameters is equivalent to: NOLIST S
Table 4-3. LIST/NOLIST Parameters
NOTE: Parameters A, B, F, M, Q, R, and W are applicable only to the assembly-phase program. Other parameters are applicable to both definition-phase and assembly-phase programs.
Parameter Description Default State
A List addresses on every line rather than just on lines where object code is listed. Off
B List formatted object code in block following end of source code listing if S is on*. Off
E List source lines with errors at user’s console as well as in output listing. Off for def, On for assem
F List formatted object code to left of source code if S is on. Off
I List instructions not assembled because of conditional assembly decisions. Off
M In MACRO expansions, list all statements (except those not listed because option I is off.) When M is off only MACRO expansion statements which produce code are listed. On
Q List addresses in octal format rather than hexadecimal format. Off
R Create reference file to support later editing of symbolic code from list file using separate TIM_PATCH program. Off
S List text (when this is off no source or object code elements are listed). On
T List symbol table On
W Wrap-around to next line when line exceeds maximum width (if off, lines that exceed maximum width are truncated). Off
X List cross reference table (overrides T) Off

* If F and B are both off, object code is not listed. If F and B are both on, object code is listed both to the left of the source code and in the block following the end of the source code listing.

LIST options T and X control symbol listings which appear at the end of a listing file if selected. The symbol table, selected by LIST option T, is an alphanumeric listing of the symbols appearing in the file along with type and value information.

The cross reference table, selected by LIST option X, contains the same information as the symbol table and, in addition, it provides a cross reference to the source code listing lines on which each symbol appears.

4.3.2 TITLE and TITLE2 Statements

These statements are used to specify a user title to be printed on each page of the program listing below the listing title line. The listing title line, which is not subject to user modification, has the following format:

TIM Listing: srcfile (dat/time) page #

where:

srcfile = source file name A user title of up to 50 characters can be specified by a TITLE statement of the form: TITLE title text where title text is the user title to be printed on each page and can be up to 50 characters long including embedded blanks.

A user title of up to 100 characters long can be specified by:

TITLE title text, title2 text Or by TITLE title text

TITLE2 title2 text

where: title text includes the first 50 characters of the title,

title2 text includes the remaining up to 50 characters of the title.

NOTE: A comma (,) is interpreted as a delimiter in the TITLE statement and thus the title text cannot include a comma.

(WinTim32 note: The size of the title text fields are arbitrary, and may be placed in quotation marks to include any character, including the comma)

If a file does not contain a TITLE statemtn, no user title is printed.

4.3.3 HEAD Statement

A HEAD statement specifies headings for object code. These headings are printed above theobject code on each page of the listing when the LIST F parameter is on. The format of the HEAD statement is:

HEAD "heading text" where heading text includes any desired column headings and embedded blank characters. Example: HEAD "Inst. Code OPR_IN Data Bus" 4.3.4 FORM Statement

The FORM statement defines the object code listing format. This can be any desired sequence of binary, octal, and hexadecimal digits with blanks embedded at desired positions. The only restriction is that the total width in bits of the specified sequence of digits must equal the defined microword width.

The format of each digit in the sequence is indicated by a numeral which specifies the number of bits in the digit. Each blank is indicated by a B.

The format of the FORM statement is:

FORM ffffffff…. where each f is either one of the numerals 1, 2, 3, 4, or 5 specifying a binary, two-bit, octal, hexadecimal, or 5-bit digit or is the letter B, specifying a blank. Example: 11B33B4444B133333 This specifies a 2-bit binary field (11), followed by a blank (B), followed by two octal digits (33), followed by a blank (B), followed by four hexadecimal digits (4444), followed by a blank (B), followed by a binary digit (1), followed by five octal digits (33333). A typical line of object code in this format would appear as follows: 01 72 34A3 177234 4.3.5 LINES Statement

The LINES statement specifies the maximum nubmer of lines to be printed on a page of the program listing The format of the LINES statement is:

LINES n where n is a decimal number greater than 8 and less than the maximum number of lines that can be printed on the form. Example: LINES 60 This specifies that a maximum of 60 lines is to be printed on a page. After the 60th line is printed, the form is advanced to the top of the next page. 4.3.6 SPACE Statement

A SPACE statement specifies the insertion of one or more blank lines ahead of the listing of the next statement. The format of a SPACE statement is:

SPACE expression where expression is evaluated to determine the number of blank lines to be inserted. Example: SPACE 3 This advances the form three lines, producing a space of three blank lines between the listing of the previous statement and the listing of the next statement. NOTE: Blank lines in listings can be created by inserting them in the source file. This is the most convenient method of specifying a small number of blank lines and has the additional advantage of making the file easier to read during editing. 4.3.7 EJECT Statement

An EJECT statement causes the listing form to be advanced to the top of the next page. The format of the EJECT statement is:

EJECT 4.3.8 WIDTH Statement

The WIDTH statement specifies the number of columns per line in the program listing. In the case of a definition-phase program, any line that exceeds this width is truncated. In the case of an assembly-phase program, any line that exceeds this width is either wrapped around to the next line (if the LIST W parameter is on) or is truncated (if the W parameter is off).

The format of the WIDTH statement is:

WIDTH n where n is a decimal number specifying the column width of the listing.

4.3.9 TAB Statement

When a TAB character is found in a MACRO body statement, it is replaced by n SPACE characters. The print format for expanded MACROs whose body statements contain TAB characters is thus affected by the value assigned to n.

The TAB statement specifies the number of SPACE characters, n, to be substituted for each TAB character found in a MACRO body statement. In the absence of a TAB statement, the default value of n is 4. Using the TAB statement, n can be set to any decimal value from 1 to 10.

A TAB statement entered in the definition-phase source program governs the MACRO definitions which follow it in that program but has no effect on assembly-phase source programs using the associated definition file. Thus, to change n from the default value for MACRO definitions contained in an assembly-phase source program, a TAB statement must appear in that program.

In the event that a definition-phase or assembly-phase source program contains more than one TAB statement, then the TAB statement which most closely precedes any MACRO definition governs for that MACRO definition.

The format of the TAB statement is:

TAB n where n is a decimal number between 1 and 10 Example: TAB 6 This specifies that every TAB character found in a body statement of a MACRO definition is to be replaced by 6 SPACE characters. 4.4 Conditional Assembly Statements

4.4.1 General

Conditional assembly statements are used to assemble a group of statements only if some specified condition is satisfied or to assemble one group of statements if a specified condition is satisfied and an alternate group of statements if that condition is not satisfied.

Conditional assembly control statements include the IF-type statement, the ELSE statement, and the ENDIF statement. A conditional assembly sequence always begins with an IF-type statement and ends with an ENDIF statement.

The general format of an IF-type .. ENDIF dequence is:

IF-type statement

statement

.

.

statement

ENDIF

General format of an IF-type…ELSE…ENDIF sequence is: IF-type statement

statement

.

.

statement

ELSE

statement

.

.

statement

ENDIF

Possible IF-type statements include IF, IFC, IFNC, IFD, and IFND statements.

4.4.2 IF Statements

The format of an IF statement is:

IF expression where expression is evaluated to determine whether it is non-zero.

If any non-zero value is obtained, then, by definition, the IF condition is satisfied. If zero is obtained, then the IF condition is not satisfied.

Example: IF B.WIDTH _EQ_ 8 The evaluation of the relational expression, B.WIDTH _EQ_ 8 yields an all ones constant if B.WIDTH = 8. This satisfies the IF condition. Otherwise, it yields 0 and the IF condition is not satisfied. 4.4.3 IFC and IFNC Statements

The format of an IFC statement is:

IFC string1, string2 {,start, end} where: string1 and string2 are two strings of characters,

start and end are optional pointers to character positions in string1 and string2.

The IFC statement specifies a character by character comparison of string1 with string2. If optional start and end numbers are not specified, the comparison starts with the first character of the two strings and ends with the last character. If the optional start number is specified, the comparison starts at the character position pointed to by the start number. If the optional end number is specified, the comparison ends at the character position pointed to by the end number. By definition, an IFC statement is satisfied if each character of string1 that is compared with the corresponding character of string2 is identical to that character.

The format of an IFNC statement is identical to that of an IFC statement except that IFNC replaces IFC. By definition, an IFNC statement is satisfied if at least one of the characters of string1 that is compared with a string2 character differs from the string2 character.

IFC and IFNC statements are useful as MACRO body statements in which at least one of the strings is specified as a formal MACRO parameter. In this usage, the actual string used in the comparison is the formal parameter substitute passed by the MACRO call statement.

NOTE: A special application involves IFC or IFNC statements in which one of the strings is blank (null). This implements conditional assembly based on whether or not the MACRO call passes a format parameter substitute for the formal parameter named in the non-null string field. Example: IFNC TM, In this example, the second string is blank (null). This makes the assembly of the statements which follow it conditional upon the passing of an actual parameter for the TM formal parameter. 4.4.4 IFD and IFND Statements

IFD and IFND statements are used to make assembly conditional upon whether or not a specified symbol has been defined prior to the IFD or IFND statement.

The format of an IFD statement is:

IFD symbol The statement is satisfied if symbol has been defined by a prior statement in the assembly phase program or by a definition file statement.

The format of an IFND statement is:

IFND symbol The statement is satisfied if symbol has not been defined by a prior statement in the assembly phase program or by a definition file statement.

4.5 Macro Definition and Call Statements

4.5.1 MACRO Definitions

A MACRO definition opens with a MACRO statement and closes with an ENDM statement. Optionally, the MACRO statement may be followed by one or more LOCAL statements. Statements between the LOCAL statements and the ENDM statement, or, if no LOCAL statements are required, between the MACRO statement and the ENDM statement, constitute the body of the MACRO.

In general any statements that can appear outside of a MACRO definition in the assembly-phase program can be used as statements in the MACRO body. The one exception to this is that nesting of MACRO definitions is not permitted. However, MACRO calls, including calls to the MACRO being defined, are permitted.

In one important respect the statements used in the body of a MACRO differ from statements used outside of a MACRO. The statements used in the body of the MACRO can contain any of the formal parameters appearing in the MACRO statement. When a MACRO is called, the formal parameters named in the MACRO statement are replaced by actual parameters named in the MACRO call statement or become null if no actual parameters are named in the MACRO call statement.

When a MACRO definition is processed, the body of the MACRO is not assembled but is merely saved for assembly in response to a call to that MACRO. Each time that a MACRO call occurs, the body of the named MACRO is assembled using the actual parameters named in the MACRO call. A formal parameter appearing in a MACRO body statement must be separated from the body text characters by delimiters. The single quotation mark(‘) is used to satisfy this requirement if the formal parameter is not otherwise delimited. For example, if X and Y are formal parameters of a MACRO, then in the body statement:

ALU.1 ALU.IN,X,DTA.BS,OP.SET,$H#’Y,DT.SEL, /OUT.EN,CN the special delimiter is required to separate formal parameter, Y, from the # character that precedes it. The special delimiter is not required before or after X because field delimiter(,) provides the necessary separation at these points. It is not required following Y because this is the final character of the statement. NOTE: The single quotation mark is interpreted as a formal parameter delimiter only if it immediately precedes or immediately follows a formal parameter character. A formal parameter is not necessarily associated with a single statement field. It can be associated with any subset of a complete statement up to and including the full statement. Thus, if W is a formal parameter: W May be a valid body statement.

It follows that the actual parameter substituted for a formal parameter may include delimiters. This requires additional special notation in the MACRO call statement as described in paragraph 4.5.3.

Symbolic address labels can be used in the body of a MACRO. However, each such symbolic address label must be declared in a LOCAL statement in the MACRO definition in order to avoid duplicate label errors being generated in connection with the multiple calls of the MACRO.

Conditional assembly statements can be used in the MACRO body to make the assembly of certain machine instruction source statements contingent upon the passing of a particular actual parameter or upon some other condition. Because the ENDM statement indicates the end of a MACRO definition, another statement must be used to indicate conditional terminations of the MACRO expansion that occur within the MACRO body statement sequence. This other statement is the EXITM statement. When assembled, this statement terminates the MACRO expansion.

A reserved word, NARG, will be set to the number of arguments passed to the MACRO. For an example, see Section 6.7.

Any TAB character found in a MACRO body statement is converted to n space characters, where the default value of n is 4. A TAB statement (paragraph 4.3.9) can set n to any value between 1 and 10.

4.5.2 MACRO Definition Statement Formats

The format of a MACRO statement is:

Symbol: MACRO {f1{,f2,…,fn}} where: symbol is the MACRO name,

f1, f2, …, fn are optional formal parameters.
 
 

Example: INIT.U: MACRO channel, baud, char, parity, stop NOTE: If the same MACRO name is used in more than one MACRO definition, then a MACRO call uses the definition which most closely precedes that call. The format of a LOCAL statement is: LOCAL symbol1{,symbol2,…,symboln} where symbol1, symbol2, …, symboln are symbolic address labels used in the body of the MACRO

The format of the ENDM statement is:

{label:} ENDM where label is an optional symbolic address label which is assigned the assembly program counter address pointing to the location following the last word of the expanded MACRO. This symbolic address label can then be specified in a branch address field within the MACRO to produce a jump out of the MACRO to the location following the last word of the expanded MACRO.

The format of the EXITM statement is:

{label:} EXITM where label is as defined for the ENDM statement.

4.5.3 MACRO Call Statements

The format of a MACRO call is:

{symbol:} MACRO name {s1},{s2},…,{sn} where: symbol is an optional symbolic address label,

s1, s2, …, sn are individually optional actual parameters substituted respectively for the formal parameters f1, f2, …, fn named in the MACRO definition.

Example: BRNCH.EQ AB,R1,,OUT1
In this example, BRNCH.EQ is the MACRO name. Actual parameters AB, R1, and OUT1 are passed to the statements containing the formal parameters for which they are substituted. The two commas between R1 and OUT1 indicate that one formal parameter has been skipped. This formal parameter becomes null for this call.

As noted in paragraph 4.5.1, a formal parameter may be associated with more than one field of a body statement in which it is used, in which case the actual parameter that is substituted for it must contain delimiters. The less-than/greater-than character pair is used to enclose any actual parameter that contains internal delimiters. Thus, in the MACRO call:

Macro1 H#42,<H#21,H#16>,H#00 H#21,H#16 is passed as a single actual parameter.
 

4.6 Assembly Program Counter Control Statements

4.6.1 ORG Statement

An ORG statement sets the assembly program counter to a specified value. The value specified in an ORG statement must be larger than the current value because setting the counter to a lesser value would result in overwriting of previously generated object code. The format of an ORG statement is:

{symbol:} ORG expression where: symbol is an optional symbolic address label

expression is an expression which is evaluated to determine the setting of the assembly program counter

Example: W.LOOP: ORG Q#00077

NOTE: The assembly program counter is automatically set to zero at the start of the assembly phase program execution.
 
 

4.6.2 RES Statement

A RES statement causes a specified number to be added to the current assembly program count so as to reserve a block of memory locations.

The format of a RES statement is:

{symbol:} RES expression where: symbol is an optional symbolic address label that is assigned to the first location of the reserved block of addresses

expression is evaluated to determine the number locations to be reserved

Example: RES 22
4.6.3 ALIGN Statement

An ALIGN statement causes the assembly program counter to be advanced to the next value located on a specified boundary. The boundary is specified in terms of a factor of which the boundary is an integral multiple.

The format of an ALIGN statement is:

{symbol:} ALIGN expression where: symbol is an optional symbolic address label to be assigned to the aligned assembly program counter value.

Expression is evaluated to determine the boundary factor.

Example: ALIGN 4
(If the assembly program counter value is decimal 109 when this statement is processed then it is advanced to decimal 112 since this is the next value that is an integral multiple of the boundary factor, 4.)

4.7 Instruction/Data Source Statements

4.7.1 Formatted Instruction Statements

Formatted instruction statements generate executable microinstructions from instruction formats specified during the definition phase by DEF statements. Formatted instruction statements consist of one or more instruction format names followed by variable field substitution values. A value must be provided for each variable field for which no default value was specified. Optionally, a different value can be substituted for any of the default values.

Multiple instruction formats can be combined (overlaid) to form an executable microinstruction as long as each field is specified as a constant or variable field in only one of those formats; i.e., constant or variable fields can be overlaid on don’t care fields. In addition, by use of the overlay attribute (@), the value associated with this attribute can be overlaid on a part or all of a variable field in another format.

The format of a formatted instruction statement is:

{symbol:} name1 VFS11, VFS12,…,…,

/VFS1n {& name2 VFS21,…}../{& namen VSn1,..}
 
 

where: symbol is an optional symbolic address label,

name1, name2, … namen are instruction format names,

VFS11, VFS12, VFS1n, are variable field substitution values.
 
 

Commas (,) are delimiters separating successive variable field substitution values. Two consecutive commas indicate a variable field for which the default value is being used. Alternatively, [n], indicates that the next variable field substitution value is to be substituted into the nth field of the format.

Ampersands (&) are delimiters preceding the second and succeeding instruction format names. This identifies the start of each instruction format to be overlaid on the preceding instruction formats.

Example 1: ALU.1 ABS,,RB1,,AB,RB1,REGCA

Example 2: ALU.1 SEL,RA3,RB2,,AB,Y,YA,,B#1
 
 

The DEF statement for the instruction format used in the two examples above is: ALU.1 DEF 8VH#00,$VH#0,4VH#0,8VH#00,3VQ#0, /4VH#0,3VQ#0,1VB#0,1VB#0 Note that this statement contains nine variable fields and that a default value is specified for each field. In Example 1 above, substitution values are specified for the first, third, fifth, sixth and seventh variable fields. In Example 2, substitution values are specified for all variable fields except the fourth, sixth, and eighth. Example 3: ALU.2 PASS,,4H#3,REGCA & /ALU.3,ADD,4H#1,4H#2,16X,AB The DEF statements for the two instruction formats used in Example 3 are: ALU.2 DEF 4V@H#0,4VH#0,19X,4VH#0,3VQ#0, /1VB#0,1VB#0 ALU.3 DEF 4VH#0,4V@H#0,4VH#0,4VH#0, /8VH#00,3VQ#0,9X Because the overlay attribute (@) is specified for the second variable field of the ALU.3 format, the value substituted into that field will be overlaid on the second variable field of the ALU.2 format when the two formats are combined. Note that it was not necessary to specify the overlay attribute (@) for the following four variable fields of the ALU.3 format, since the third field in the ALU.2 format is a 19-bit don’t care field.

In the example above, the overlay attribute was provided in the DEF statement for the ALU.2 and ALU.3 formats. If that DEF statement had not included the overlay attribute, the overlay could have been specified by appending the overlay attribute to the LIT field variable substitution value in the formatted instruction source statement, as follows:

ALU.2 PASS,,4H#3,REGCA & ALU.3,

/ADD@,4H#1,4H#2,16X,AB
 
 

4.7.2 FF Statements

FF statements are used to generate executable microinstructions without reference to instruction format or instruction sub-format names. This requires specification of a constant or don’t care value for every field of the instruction. Constant values may be numerical constants, constant names, set-parameter names, or expressions.

Since the FF statement generates an executable microinstruction, the sum of all the field widths must be equal to the microword width specified by the WORD statement in the definition file.

Optionally, a symbolic address label can be assigned in an FF statement.

The form of an FF statement is:

{Symbol:} FF field1{, field2}…{,fieldn} Example: FF ABS,H#3,RB1,H#00,AB,RB1,REGCA,B#0,B#1

4.7.3 DATA Statements

The DATA statement provides the means of setting up a data constant (literal) in a separate microword to be accesses under control of the executable instruction in a preceding microword. The format of a DATA statement is:

{symbol:} DATA expression where: symbol is an optional symbolic address label,

DATA is the statement operator,

expression is an expression whose value is placed in the microword.
 
 

The width of the resultant data constant is equal to the width of the evaluated expression and this value is right-justified in the microword. The segment of the microword to the left of the right-justified constant comprises an unused field which is filled with zeros. Example: DATA H#4A3B* When this expression is evaluated and placed in a 24-bit microword, the resultant binary object code is as follows: 000000001011010111000100 NOTE: The inversion attribute (*) is applied only to the 16 bits of the expression. The eight leading 0s constitute the unused field which is always filled with zeros. 4.7.4 DUP Statements

The DUP statement is used to generate multiple lines of instructions or data. The DUP statement causes the instruction or data word on the line following the DUP statement to be repeated a specified number of times. The format is:

DUP expression where: DUP is the statement operator

expression is an expression whose value determines the number of duplications

Example: DUP D#10 NOOP
This would be used to introduce a delay of 10 microprocessor clock periods. NOTE: A statement with a symbolic address label cannot be duplicated successfully because such duplication produces a duplicate symbolic address label error. 4.8 Relocation Definition Statements

4.8.1 .REL Statement

In a relocatable, assembly-phase source program, the .REL statement must be entered prior to the first statement which affects the assembly program counter. Thus, the .REL statement must be entered before any machine instruction source statement or any ORG statement.

The format of the .REL statement is:

.REL This statement defines the program as a relocatable assembly phase source program. If this statement is omitted, the program is treated as an absolute assembly phase source program and EXTRN or PUBLIC statements result in errors.

4.8.2 EXTRN Statement

An EXTRN statement is used to declare one or more symbols as external symbols. An external symbol is a symbol not defined in the definition file or in the current assembly phase source program but defined in another program file that is subsequently to be linked to this one. Any given symbol can only be listed in one EXTRN statement of a particular file. A symbol that is declared as EXTRN in one or more files must be listed in a PUBLIC statement in the file in which it is defined.

The format of an EXTRN statement is:

EXTRN symbol1{,symbol1{,…,symboln}}

Example: EXTRN WRITE.B,READ.B
 
 

4.8.3 PUBLIC Statement

A PUBLIC statement makes the listed symbols available for declaration as EXTRN symbols in other assembly-phase source program files. To be declared PUBLIC, a symbol must be defined in the current assembly-phase source program file or in the definition file. Instruction format names, instruction sub-format names, and MACRO names cannot be declared PUBLIC. Symbolic address labels, constant names, and set-parameter names can be declared PUBLIC. A symbol can only be declared PUBLIC in one PUBLIC statement in any group of files that are to be linked.

The format of a PUBLIC statement is:

PUBLIC symbol1{,symbol1{,…,symboln}}

Example: PUBLIC WRITE.B,READ.B
 

4.9 Miscellaneous Statements

4.9.1 INCLUDE Statement

An INCLUDE statement names a secondary source file. When the definition or assembly phase program reaches an INCLUDE statement, it processes the statements contained in the file named in the INCLUDE statement. In general, the statements in the secondary source file are processed in exactly the same manner as they would have been had they been listed in the primary file starting at the point where the INCLUDE statement is listed.

There are two exceptions to this:

1. When the program reads the END statement in the secondary source file or reaches the end of that file, it continues with the processing of the primary source file starting with the statement following the INCLUDE statement.

2. The secondary source file is not permitted to contain any INCLUDE statements. (NOTE: WinTim32 does not have this restriction).
 
 

The format of an INCLUDE statement is: INCLUDE filename where filename is the name of the secondary source file to be included.

4.9.2 MAP Statement

The MAP statement is appropriate only in an absolute assembly-phase source program an is ignored if entered in a relocatable assembly-phase source program.

NOTE: For relocatable program modules, an entry point map can be generated by the linker-phase program using the entry point symbols which are passed to it by the assembly-phase program. When a MAP statement is entered in an absolute assembly-phase source program, a separate entry point object file is created. The name, srcfile.map, is automatically assigned to this file, where srcfile is the name of the assembly-phase source program file. A listing of the entry point map is provided at the end of the list file.

The entry point map object file consists of the addresses assigned to all entry point symbolic address labels. A symbolic address label is specified as an entry point by terminating the symbol field of the source statement with a double colon (::). For example, the formatted instruction source statement:

END1:: ALU.1 ABS,,RB1,,AB,RB1,REGCA establishes END1 as an entry point symbol.

Entry point addresses are listed in the entry point map in the same order that they are assigned by the assembly-phase program. The format of the MAP statement is:

MAP address, width where: address is the base address of the entry point map (decimal)

width is the width in bits of the entry point map object words (decimal)

Example: MAP 32,16
The listing of the entry point map generated in response to this statement might begin as follows: 000020 END1 000071

000021 END2 0000A2
 
 

Notice that the starting address is hexadecimal 20 (decimal 32) as specified in the address field. The width field specification applies to the width of the object file. The addresses 71 and A2 would be right-justified in the 16-bit words specified in the width field.

4.9.3 END Statement

When the definition-phase or assembly-phase program encounters an END statement in a source file, it interprets this as the end of the file. If no END statement is encountered, the program will continue processing statements until the end of the source file is encountered. The format of the END statement is:

END 4.9.4 DCARE Statement

The DCARE statement is used in the assembly-phase source program to assign values to don’t care bits. If the assembly-phase program does not contain a DCARE statement, all don’t care bits are set to X. In this case any don’t care bit or any digit containing any don’t care bits will appear as an X in any object code listing and don’t care bits will be marked as such in the object file. Typically, this statement is used to assign either the value of 1 or the value of 0 to all don’t care bits of the module. In order to achieve this result, the DCARE statement must precede the first statement containing don’t care bits.

It is also possible, by use of more than one DCARE statement, to assign different values to don’t care bits in different segments of the program. Any don’t care bits in statements prior to the first DCARE statement will remain set to X. If the program contains more than once DCARE statement, the value assigned to don’t care bits in any statement will be the value specified in the DCARE statement which most closely precedes the statement containing the don’t care bits.

The format of the DCARE statement is:

DCARE {value} where {value} = 0, 1, or X Example: DCARE 0
 
 
 
 
 
 
Disclaimer:  These pages are a direct electronic copy (read: typed) of the original TIM manual, which is about 20 years old and published in hardcover.  The author of this webpage takes no responsibility for any mistakes herein, though they're probably his fault.