Tatara

Appendix A
Directive reference

This appendix lists every directive that TATARA accepts. Section A.1 groups them by what they are for; section A.2 gives each one’s form and a short description, in alphabetical order; section A.3 says what happens to a label written on a directive line; and section A.4 lists the other names that some directives have. Each entry names the section of the manual that describes the directive in full, with examples.

In the forms, words in italics stand for something you write, and parts in square brackets can be left out. Directives can be written in upper or lower case.

A.1 The directives by purpose

A.1.1 Data

Directive

What it does

Section
DB

stores bytes and strings

11.1
DW

stores words, low byte first

11.3
DC

stores a string with bit 7 of its last character set

11.4
DS

reserves space, without storing anything

10.4

A.1.2 Names

Directive

What it does

Section
EQU

gives a name a value, once

12.3
DEFL

gives a name a value that can be changed later

12.4
PUBLIC

offers names to other modules

12.5
EXTRN

uses names that another module defines

12.5

A.1.3 Segments and the location counter

Directive

What it does

Section
CSEG

selects the code segment, or a named one

10.2, 10.5
DSEG

selects the data segment, or a named one

10.2, 10.5
ASEG

selects the absolute segment

10.2
GROUP

starts a group in a transient data segment

10.6
ORG

sets the location counter

10.3

A.1.4 Files and the end of the source

Directive

What it does

Section
INCLUDE

reads another file at this point

13.1
END

ends the source, and can name the start address

12.6

A.1.5 Conditional assembly

Directive

What it does

Section
IF

assembles its lines if a value is not zero

15.1
IFE

assembles its lines if a value is zero

15.1
IFDEF

assembles its lines if a name is defined

15.3
IFNDEF

assembles its lines if a name is not defined

15.3
IF1

assembles its lines on the first pass only

15.4
IF2

assembles its lines on the second pass only

15.4
IFB

assembles its lines if a text is blank

15.5
IFNB

assembles its lines if a text is not blank

15.5
IFIDN

assembles its lines if two texts are the same

15.5
IFDIF

assembles its lines if two texts differ

15.5
ELSE

starts the lines to assemble when the condition is false

15.1
ENDIF

ends a conditional

15.1

A.1.6 Macros and repeat blocks

Directive

What it does

Section
MACRO

starts the definition of a macro

16.1
ENDM

ends a macro or a repeat block

16.1
LOCAL

gives names a new spelling in each expansion

16.5
EXITM

ends an expansion early

16.6
REPT

repeats a block a number of times

17.1
IRP

repeats a block once for each item of a list

17.2
IRPC

repeats a block once for each character of a text

17.3

A.1.7 The listing

Directive

What it does

Section
TITLE

sets the title of the page headings

18.2
SUBTTL

sets the subtitle of the page headings

18.2
PAGE

starts a new page, and can set the page length

18.2
.XLIST

turns the listing off

18.3
.LIST

turns the listing back on

18.3
.XALL

lists the lines of an expansion that produce bytes

18.4
.LALL

lists every line of an expansion

18.4
.SALL

lists no line of an expansion

18.4
.LFCOND

lists the lines a conditional leaves out

18.5
.SFCOND

leaves those lines out of the listing

18.5
.TFCOND

changes from one of those two to the other

18.5

A.2 The directives in alphabetical order

The directives whose names begin with a dot, which all control the listing, follow the others in a group of their own (section A.2.1). The other names of a directive are listed in their place, and point to the directive they stand for.

ASEG


aseg
Selects the absolute segment, whose addresses are exactly the ones written: TANREN does not move it. Each segment keeps its own location counter, so a later ASEG continues where the last one stopped. Section 10.2.

COND

The same as IF.

CSEG


cseg [name]
Selects the code segment, or, with a name, the named code segment of that name. A source starts in the code segment. Every CSEG with the same name adds to the same segment, and TANREN joins the segments of the same name from every module. Sections 10.2 and 10.5.

DB


db item[,item…]
Stores each item: an expression as one byte, its low byte, which must be absolute; a string as one byte for each character. A string of one or two characters followed by an operator is a character constant in an expression instead. Sections 11.1 and 11.2.

DC


dc string
Stores one string, as DB does, with bit 7 of its last character set. The string must not be empty. Section 11.4.

DEFB

The same as DB.

DEFL


name defl expression
Gives a name a value, which a later DEFL of the same name can change. The name is written without a colon, and cannot be a label or an EQU name too. TATARA has no SET: in Z80 code, set is the instruction. Section 12.4.

DEFM

The same as DB.

DEFS

The same as DS.

DEFW

The same as DW.

DS


ds count
Moves the location counter on by count bytes, so reserving space, and stores nothing. The count must be absolute and known on the first pass. There is no second operand. Section 10.4.

DSEG


dseg [name[,transient]]
Selects the data segment, or, with a name, the named data segment of that name. With transient after the name, the segment is a transient data segment, whose variables are divided into groups with GROUP. Sections 10.2, 10.5 and 10.6.

DW


dw expression[,expression…]
Stores each expression as a word, low byte first. The value can be an address that TANREN finishes, such as a label or an external name. A string of one or two characters is a character constant; a longer one is an error. Section 11.3.

ELSE


else
Starts the lines of a conditional that are assembled when its condition is false. It belongs to the innermost conditional that is still open, and is optional. Section 15.1.

END


end [address]
Ends the source: TATARA reads nothing after it, not even the rest of a file that included this one. The address, if there is one, is the start address of the program, which TANREN shows as entry. A source without END ends where its file ends. Sections 12.6 and 13.7.

ENDIF


endif
Ends the innermost conditional that is still open. Section 15.1.

ENDM


endm
Ends the body of a macro, or the block of REPT, IRP or IRPC. Each ENDM belongs to the innermost one that is open. Sections 16.1 and 17.1.

ENTRY

The same as PUBLIC.

EQU


name equ expression
Gives a name a value, which cannot be changed. The name is written without a colon: with one, TATARA takes it for a label and stops. Section 12.3.

EXITM


exitm
Ends the expansion of a macro, or the rounds of a repeat block, at once. It is used inside a conditional, and closes the conditionals it leaves open. Sections 16.6 and 17.4.

EXT

The same as EXTRN.

EXTRN


extrn name[,name…]
Declares names that another module defines. TANREN finishes every value that uses them, so they can go only where two bytes hold the value. A name declared EXTRN cannot be defined in the same module. Section 12.5.

GROUP


group name
Starts a group in a transient data segment. Every group of the segment starts at its beginning, and the segment is as large as its largest group. GROUP is allowed only in a transient data segment, and takes no label. Group names are shared between modules. Section 10.6.

IF


if expression
Assembles the lines up to ELSE or ENDIF if the value is not zero. The expression must use only names already defined. Conditionals can be 16 deep. Sections 15.1, 15.2 and 15.6.

IF1


if1
Assembles its lines on the first pass only. A label or a byte inside it makes the two passes differ, which is an error. Section 15.4.

IF2


if2
Assembles its lines on the second pass only, with the same restriction as IF1. Section 15.4.

IFB


ifb <text>
Assembles its lines if the text between the angle brackets is blank. Section 15.5.

IFDEF


ifdef name
Assembles its lines if the name is defined. A name declared EXTRN counts as defined. The name should be defined above the line, or the answer differs between the passes. Section 15.3.

IFDIF


ifdif <text>,<text>
Assembles its lines if the two texts differ. The comparison is exact, upper and lower case included. Section 15.5.

IFE


ife expression
Assembles its lines if the value is zero. Otherwise as IF. Section 15.1.

IFF

The same as IFE.

IFIDN


ifidn <text>,<text>
Assembles its lines if the two texts are the same, upper and lower case included. Section 15.5.

IFNB


ifnb <text>
Assembles its lines if the text is not blank. Section 15.5.

IFNDEF


ifndef name
Assembles its lines if the name is not defined. Otherwise as IFDEF. Section 15.3.

IFT

The same as IF.

INCLUDE


include filename
Reads the file at this point, as if its lines were written there. The name is used as it is written, without quotation marks, and nothing is added to it. TATARA looks for the file beside the file that includes it, then in the current directory, then in each directory of the TATARA environment variable. Include files and macro expansions can be 16 deep. Sections 13.1 and 13.2.

IRP


irp parameter,<item[,item…]>
Assembles the block up to ENDM once for each item, with the parameter replaced by the item. The items follow the rules of a macro’s arguments, and the angle brackets can be left out. Section 17.2.

IRPC


irpc parameter,text
Assembles the block up to ENDM once for each character of the text. Angle brackets are needed only to keep a space in the text. Section 17.3.

LOCAL


local name[,name…]
In a macro or a repeat block, replaces each name with a new one, ??0000, ??0001 and so on, in each expansion. LOCAL lines must come first in the body. Sections 16.5 and 17.4.

MACRO


name macro [parameter[,parameter…]]
Starts the definition of a macro, whose body runs to the matching ENDM. The name is written without a colon. A macro must be defined before it is used, and can be defined again. Sections 16.1 to 16.7.

ORG


org expression
Sets the location counter of the current segment: an address in the absolute segment, an offset in the others. The value must be known on the first pass, and be absolute or an address in the current segment. Section 10.3.

PAGE


page [n]
Starts a new page of the listing after its own line. With n, from 10 to 255, it also sets the length of a page, page heading included. Section 18.2.

PUBLIC


public name[,name…]
Offers names to other modules. The line can come before the definition or after it, but each name must be defined somewhere in the module. Labels, EQU names and DEFL names can be public. A label written with two colons is public as well. Section 12.5.

REPT


rept count
Assembles the block up to ENDM count times. The count must be absolute and already known. A count of 0 assembles nothing. Section 17.1.

SUBTTL


subttl text
Sets the subtitle, shown under the page heading from the next page on. TATARA keeps its first 28 characters. Section 18.2.

TITLE


title text
Sets the title, shown at the left of the page heading. TATARA keeps its first 28 characters. Section 18.2.

A.2.1 The directives that begin with a dot

.LALL


.lall
Lists every line of a macro expansion or repeat block from here on, including the lines a conditional leaves out. Section 18.4.

.LFCOND


.lfcond
Lists the lines that a conditional leaves out, with no address. This is the default. Section 18.5.

.LIST


.list
Turns the listing back on after .XLIST. Section 18.3.

.SALL


.sall
Lists no line of an expansion from here on. The line that uses the macro is marked +. Section 18.4.

.SFCOND


.sfcond
Leaves the lines that a conditional leaves out out of the listing. The IF, ELSE and ENDIF lines are still listed. Section 18.5.

.TFCOND


.tfcond
Changes from .LFCOND to .SFCOND, or back. Section 18.5.

.XALL


.xall
Lists the lines of an expansion that produce bytes. This is the default. Section 18.4.

.XLIST


.xlist
Turns the listing off. The lines after it are assembled as usual, but not listed. Section 18.3.

A.3 Labels on directive lines

A label can be written on most directive lines, as on any other line (section 6.3). It takes the value of the location counter when TATARA reaches the line, in the segment in force before the line does anything. So a label on ORG has the old value of the location counter, not the new one; a label on a segment directive has the address in the segment that was in force until that line; and a label on INCLUDE has the address before the bytes of the file.

A few directives are different:

The safest place for a label is a line of its own, or a line that produces bytes.

A.4 Other names

Some directives have a second name, which TATARA accepts so that sources written for M80 assemble unchanged (*EJECT and $EJECT only in column 1):

Other name Same as
COND, IFT IF
DEFB, DEFM DB
DEFS DS
DEFW DW
ENTRY PUBLIC
EXT EXTRN
IFF IFE
*EJECT, $EJECT PAGE

The directives of M80 that TATARA does not accept are listed in appendix J.