TM
TL
tiasm - An alternative assembler for the TI990/U89
AU
Lee Ward
AI
University of New Mexico at Albuquerque
AB
Tiasm is meant as an alternative to the assembler provided on the
Texas Instruments Corporation's TM990/U89 educational board. It runs under
UX
and provides facilities commonly associated with much larger assemblers
while attempting to maintain as much consistency as possible with the assembler
provided on the above mentioned board.
AE
SH
INTRODUCTION
PP
This paper is not a tuorial on the tiasm assembler but is instead meant to
enlighten the user as to the differences between the assembler provided
on the TI990/U89 board running the UNIBUG monitor (henceforth referred
to as "the standard assembler") and tiasm. If you have not already read about
or used the standard assembler it is highly recommended that you read
the
UL TM990
UL users
UL guide,
chapter number 4.
Tiasm is an attempt to extend and modify the standard assembler
rather than replace it. Therefore, comparisons and contrasts will
be drawn rather than a complete guide to the instructions and
possible use of them given.
PP
Very briefly, the facilities tiasm
supplies beyond the standard assembler are:
ID
1)	A macro preproccessor
2)	A more consistent approach to addressing mode syntax.
3)	Many more specific directives including one for strings.
4)	Support of seperate assembly with resolution at link time.
5)	The ability to catch syntax errors before downloading.
DE

SH
SYNTAX AND PARSING
PP
The general format of the symbolic instructions along
with their names are as given in the users guide. Case distinction in labels,
operands and directives is recognized. Only the mnemonic instruction names
UL must
be capitolized. just as in the standard assmebler. White space is considered
to be a space, tab or blank
line. Comments remain as any number of alphanumeric characters up to
and including the newline character that follow a semi-colon.
PP
It is no longer necessary to equate character literals. It is sufficient
to merely surround them with forward ticks (apostrophes).
The radix
of any numeric literals may be deferred from the default radix of 10 to:
ID
base 2	by preceding the number with 0B or 0b
base 8	by preceding the number with 0O or 0o
base 16	by preceding the number with 0X or 0x
base 10	by preceding the number with 0D or 0d
DE
For example the instruction:
ID
	CI	R1,>8000
DE
in the standard assembler becomes:
ID
	CI	R1,0x8000
DE
in tiasm. Arithmetic negation may be used on any literal. The minus
sign signifies this. The plus sign is also recognized but is redundant.
PP
Labels may now be defined without equating them to the location counter.
This may be done by following any previously undefined identifier
with a colon. To reference these labels the preceding at sign ('@') is
no longer be used. It must be omitted entirely or be part of the symbol name.
Valid identifiers are recognized to be unbroken strings of alphanumeric
characters belonging to the following set; [a-z, A-Z, -, _, 0-9]. Identifiers
may not start with '-' or numbers.
PP
The greatest difficulty in porting any source code to be assembled
by tiasm will lie in the fact that the syntactical specifications for
the addressing modes has been extremely modified. There are two sample
programs in the appendices that accomplish the same task. One is
written to conform to the syntax of the standard assembler and the
other is a port of same to tiasm. These provide decent examples of
some of the addressing modes provided. What follows here is a list of
addressing modes and their syntax in both the standard assembler
and tiasm.
TS
allbox;
ccc
nnn.
mode	standard	tiasm
Direct	reg	reg
Indirect	*reg	(reg)
Indirect, auto	*reg+	(reg)+
Symbolic	@symb	symb
Indexed symbolic	@symb(reg)	symb[reg]
Immediate	literal	literal
PC relative	$[+/-num]	$[+/-num]
TE

SH
DIRECTIVES
PP
There are currently four directives supplied in tiasm. The first is
used to specify that a given identifier is defined external to the module
being assembled now. This facility is meant to allow seperate assembly.
The directive takes the form:
br
 .extern	symbol
br
Where "symbol" is any valid identifier name.
PP
The next directive is used to specify that one (or more) word(s) are
to be reserved beginning at tiasm's idea of the current location. It takes
the form:
br
 .word	[number]
br
Without the number one word is reserved.
PP
There is a data directive. What it does is allow the programmer to
have initialized data placed into memory. This data is not write
protected so it may be used as an initialized global variable
if you like. The data directive reserves one word no matter what form
the data takes.  The data directive takes the form:
br
 .data	data
br
The only limitation on the data type is that it may not be a string.
One type that may be placed here is symbol. At link time, when
the modules adresses become absolute, the address of the identifier
will be placed here. This could be useful for example in keeping an indexed
table of functions.
PP
Initialized ASCIZ (ASCII zero terminated) data may be specified by use
of the string directive. It takes the form:
br
 .string	"ASCII string"
br
If the string is too long to fit on one line a backslash ('\\<RETURN>') may
be used to continue to the next line. There are some special operators
that may be placed in the string that have some meaning. An escaped
(preceded by a backslash) quote mark allows a quote to be inserted in the
string. In addition to this escaped character there are many others
that generate ASCII codes. A complete table of these may be found in the
appendices. The whole scheme with string literals is very
B 'C'
like.

SH
THE MACRO PREPROCCESSOR
PP
The macro preprocessor, unfortunately, is a very touchy subject. It was
decided in the design phase to take advantage of the facilities of
UX
for this phase of assembly.
UX
provides two, very fine, macro preprocessors. One is known as
B m4
and the other as
B cpp.
The first is a bit easier to use and provides very elegant features as
well as encouraging good style in writing and using macros. The second,
while not as nice, is the one utilized by the
B C
compiler under
UX
and is quite well known. It has the advantage of being able to tell
the assembler what line an included file the assembler is currently
parsing. This allows the assembler to generate error messages for the
included file as well as the file that included it. The
B m4
preprocessor does not have this capability and will force the line numbers
in any error messages given to be off.
Both allow the inclusion of files, macros and aliases (the EQUATE directive
in the standard assembler is an alias). Which one is in use at a given
site should be specified in the manual pages.
SH
ERROR MESSAGES
PP
Currently the error detection scheme is primitive. Most errors
will generate two messages. The first is an attempt to qualify the
second which is almost always;
br
"Syntax error".
br
These error messages are meant to be self-explanatory.
Occasionally an error message of the form:
br
Internal error: message
br
may be generated. This is meant for the person maintaining the package
and should be duely reported to him/her.
SH
PROBLEMS, SOLUTIONS AND THE WISHLIST
PP
Currently there is no directive that will allow the relocation
counter to become absolute. This
I must
be remedied to allow the interrupt vectors to be set with ease.
The work-around for this is to write a module with nothing but
data and word directives. Initialize the vectors using the data
directive and skip over unused ones with the word directive. Be warned though,
the word directive inserts garbage into the location. Load this
module first at the address corresponding to the first vector location
to overwrite (this doesn't apply if a word directive was first).
The next load module would be the one containing the code and goes
wherever.
PP
The word directive is handled by the assembler proper. This increases
the object modules size in an unnecessary way. It should be modified
so that the loader merely resets the current load address in the
micro effectively skipping over the reserved space.
PP
The error messages should be cleaned up. Currently, only the
most primitive form of management is used in the parser. This
was to take advantages of
B YACC's
ability to recover from errors. It is more important to recover
from lexical errors than print pretty error messages. The remedy
for this is rather involved but definately worth investigation.