TASM
TASM
Thomas N. Anderson
Speech Technology Incorporated
837 Front Street South, Issaquah, WA 98027
Compuserve: 73770,3612
Internet: [email protected]
October, 1993
Version 3.0
Page 2
7
7
8
8
8
8
8
8
8
9
9
10
10
11
11
11
11
12
13
13
14
14
14
15
15
17
17
17
17
17
17
18
18
19
19
19
20
20
20
20
21
21
21
Page 3
21
21
22
22
22
22
22
23
23
23
24
24
24
25
WORD
OBJECT FILE FORMATS
Intel Hex Object Format
MOS Technology Hex Object Format
Motorola Hex Object Format
Binary Object Format
LISTING FILE FORMAT
PROM PROGRAMMING
ERROR MESSAGES
BUGS AND LIMITATIONS
26
27
27
27
28
28
30
31
32
36
37
Page 4
INTRODUCTION
TASM is a table driven cross assembler for the MS-DOS environment. Assembly
source code, written in the appropriate dialect (generally very close to the
manufacturers assembly language), can be assembled with TASM, and the
resulting object code transferred to the target microprocessor system via
PROM or other mechanisms.
The current microprocessor families supported by TASM are:
6502
6800/6801/68HC11
6805
TMS32010/TMS320C25
TMS7000
8048
8051
8080/8085
Z80
The user so inclined may build tables for other microprocessors. The
descriptions of the various existing tables and instructions on building new
tables are not in this document but can be found in the TASMTABS.DOC file on
the TASM distribution disk.
TASM characteristics include:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
SHAREWARE
TASM is distributed as shareware.
TASM is not public domain. The TASM
distribution files may be freely copied (excluding the source code files) and
freely used for the purpose of evaluating the suitability of TASM for a given
purpose. Use of TASM beyond a reasonable evaluation period requires
registration. Prolonged use without registration is unethical.
TASM - Table Driven Assembler Version 3.0
Page 5
INVOCATION
TASM can be invoked as follows (optional fields shown in brackets, symbolic
fields in italics):
tasm -pn [-option_flag ...] src_file [obj_file [lst_file [exp_file [sym_file
]]]]
Where option_flag can be one or more of the following:
-table
-ttable
-aamask
-b
-c
-dmacro
-e
-ffillbyte
-gobjtype
-h
-i
-l[al]
-m
-oobytes
-p[lines]
-q
-rkb
-s
-x[xmask]
-y
files are read at run time. TASM determines which table to use based on the
'-table' field shown above. For example, to assemble the code in a file
called source.asm, one would enter:
TASM - Table Driven Assembler Version 3.0
tasm
tasm
tasm
tasm
tasm
tasm
tasm
tasm
tasm
tasm
-48
-65
-51
-85
-80
-05
-68
-70
-3210
-3225
source.asm
source.asm
source.asm
source.asm
source.asm
source.asm
source.asm
source.asm
source.asm
source.asm
Page 6
for
for
for
for
for
for
for
for
for
for
an
a
an
an
a
a
a
a
a
a
8048 assembly
6502 assembly
8051 assembly.
8085 assembly.
Z80 assembly.
6805 assembly.
6800/6801/68HC11 assembly.
TMS7000 assembly.
TMS32010 assembly.
TMS320C25 assembly.
The file name that the tables are read from is formed by taking the digits
specified after the '-' and appending it to 'TASM' then appending the '.TAB'
extension. Thus, the '-48' flag would cause the tables to be read from the
file 'TASM48.TAB'.
It is possible to designate tables by non numeric part numbers if the '-t'
flag is used. For example, if a user built a table called TASMF8.TAB then
TASM could be invoked as follows:
tasm -tf8 source.asm
Each option flag must be preceded by a dash. Options need not precede the
file names, however. The various options are described below:
a - Assembly Control. TASM can provide additional error checking by
specifying the '-a' option at the time of execution. If the '-a' is provided
without a digit following, then all the available error checking is done. If
a digit follows, then it is used as a mask to determine the error checks to
be made. The bits of the mask are defined as follows:
Bit
Option
Default Description
___________________________________________________________________________
0
-a1
OFF
Check for apparent illegal use of indirection
1
-a2
ON
Check for unused data in the arguments
2
-a4
ON
Check for duplicate labels
3
-a8
OFF
Check for non-unary operators at start of expression.
Combinations of the above bits can also be used. For example, '-a5' would
enable the checking for illegal indirection and duplicate labels.
Illegal indirection applies to micros that use parenthesis around an argument
to indicate indirection. Since it is always legal to put an extra pair of
parenthesis around any expression (as far as the expression parser is
concerned), the user may think that he/she is indicating indirection for an
instruction that has no indirection and TASM would not complain. Enabling
this checking will result in an error message (warning) whenever an outer
pair of parenthesis is used and the instruction set definition table does not
explicitly indicate that to be a valid form of addressing.
Unused data in arguments applies to cases where a single byte of data is
needed from an argument, but the argument contains more than one byte of
data. If a full sixteen bit address is used in a 'Load Immediate' type
instruction that needs only a single byte, for example, an error message
would be generated. Here is an example (6502 code):
TASM - Table Driven Assembler Version 3.0
Page 7
0001 1234
.org $1234
test.asm line 0002: Unused data in MS byte of argument.
0002 1234 A9 34
start lda #start
To make the above checks occur whenever you do an assembly, add a line like
this to your AUTOEXEC.BAT file:
SET TASMOPTS=-a
b - Binary Object Format. This option causes the object file to be written
in binary - one byte for each byte of code/data. Note that no address
information is included in the object file in this format. The contiguous
block (-c) output mode is forced when this option is invoked. This flag is
equivalent to '-g3'.
c - Contiguous Block Output. If this option is specified, then all bytes in
the range from the lowest used byte to the highest will be defined in the
object file. Normally, with the default Intel Hex object format enabled, if
the Program Counter (PC) jumps forward because of an .ORG directive, the
bytes skipped over will not have any value assigned them in the object file.
With this option enabled, no output to the object file occurs until the end
of the assembly at which time the whole block is written. This is useful
when using TASM to generate code that will be put into a PROM so that all
locations will have a known value. This option is often used in conjunction
with the -f option to ensure all unused bytes will have a known value.
d - Define a Macro. Macros are defined on the command line generally to
control the assembly of various IFDEF's that are in the source file. This
is a convenient way to generate various versions of object code from a single
source file.
e - Expand Source. Normally TASM shows lines in the listing file just as they
are in the source file. If macros are in use (via the DEFINE directive) it
is sometimes desirable to see the source lines after expansion. Use the '-e'
flag to accomplish this.
f - Fill Memory. This option causes the memory image that TASM
maintains to be initialized to the value specified by the two hex characters
immediately following the 'f'. TASM maintains a memory image that is a full
64K bytes in size (even if the target processor cannot utilize that memory
space). Invocation of this option introduces a delay at start up of up to 2
seconds (time required to initialize all 64K bytes).
g - Object File Format. TASM can generate object code in four different
formats as indicated below:
-g0
-g1
-g2
-g3
for
for
for
for
The '-m' and '-b' flags may also be used, as indicated above.
See the section on OBJECT FILE FORMATS for descriptions of each of the above.
Page 8
h - Hex Object Code Table. This option causes a hex table of the produced
object code to appear in the listing file. Each line of the table shows
sixteen bytes of code.
i - Ignore Case in Labels. TASM is normally case sensitive when dealing with
labels. For those that prefer case insensitivity, the '-i' command line
option can be employed.
l - Label Table. This option causes a label table to appear in the listing
file. Each label is shown with its corresponding value. Macro labels (as
established via the DEFINE directives) do not appear.
Two optional suffixes may follow the '-l' option:
Suffix
Description
_______________________________________________
l
Use long form listing
a
Show all labels (including local labels)
The suffix should immediately follow the '-l'. Here are some examples:
-l
-la
-ll
-lal
to
to
to
to
show
show
show
show
m - MOS Technology Object Format. This option causes the object file to be
written in MOS Technology hex format rather than the default Intel hex
format. See section on OBJECT FILE FORMATS for a description of the format.
o - Set Number of Bytes per Object Record. When generating object code in
either the MOS Technology format or the Intel hex format, a default of 24
(decimal) bytes of object are defined on each record. This can be altered by
invoking the '-o' option immediately followed by two hex digits defining
the number of bytes per record desired. For example, if 32 bytes per record
are desired, one might invoke TASM as:
TASM -48 -o20 source.asm
p - Page Listing File. This option causes the listing file to have top of
page headers and form feeds inserted at appropriate intervals (every sixty
lines of output). To override the default of sixty lines per page, indicate
the desired number of lines per page as a decimal number immediately
following the '-p'. Here is an example:
TASM -48 -p56 source.asm
q - Disable Listing File. This option causes all output to the listing file
to be suppressed, unless a .LIST directive is encountered in the source file
(see LIST/NOLIST directives).
r - Set Read Buffer Size. This option overrides the default read buffer size
of 2 Kbytes. The first hexadecimal digit immediately after the 'r' is taken
as the number of K bytes to allocate for the read buffer (.e.g. '-r8'
TASM - Table Driven Assembler Version 3.0
Page 9
indicates an 8K byte buffer, '-rf' indicates a 15K byte buffer). Note that
that read buffers are taken from the same memory pool as labels and macro
storage, and that additional read buffers are needed if "includes" are used.
Thus, using 8K byte buffers may be suitable for most assemblies, but programs
with large numbers of symbols may not allow such a value. Also, reducing the
buffer size to 1 Kbyte can increase the memory pool available for label
storage, if such is needed.
s - Enable Symbol File Generation.
If this flag is set, a symbol file is
generated at the end of the assembly. The format of the file is one line per
label, each label starts in the first column and is followed by white space
and then four hexadecimal digits representing the value of the label.
The
following illustrates the format:
label1
label2
label3
FFFE
FFFF
1000
The symbol file name can be provided as the fifth file name on the the
command line, or the name will be generated from the source file name with a
'.SYM' extension. The symbol table file can also be generated by invoking
the SYM directive. The AVSYM directive also generates the symbol file but in
a different format (see section on ASSEMBLER DIRECTIVES).
t - Table Name. As an alternative to specifying the instruction set table as
two decimal digits, the table indication may be proceeded by the '-t' option.
This is useful if the desired table name starts with a non-numeric. Thus, a
table for an F8 might be selected as:
TASM -tf8 source.asm
TASM would expect to read the instruction set definition tables from a file
named TASMF8.TAB.
TASM - Table Driven Assembler Version 3.0
Page 10
51
85
3210
3225
70
8051
8080
TMS32010
TMS320C25
TMS7000
TMS320C26
The above table does not attempt to show the many microprocessor family
members that may apply under a given column.
See the TASMTABS.DOC on-line document for details on each specific table.
y - Enable Assembly Timing. If this option is enabled TASM will generate a
statement of elapsed time and assembled lines per second at the end of the
assembly.
TASM - Table Driven Assembler Version 3.0
Page 11
ENVIRONMENT VARIABLES
The TASM environment can be customized by using the enviroment variables
listed below:
TASMTABS. This variable
instruction set definition
must exist in the current
instruction set definition
called 'C:', the following
file:
set TASMTABS=C:\TASM
TASMOPTS. This variable specifies TASM command line options that are to be
invoked every time TASM is executed. For example, if TASM is being used for
8048 assemblies with binary object file output desired, the following
statement would be appropriate in the AUTOEXEC.BAT file:
set TASMOPTS=-48 -b
EXIT CODES
When TASM terminates, it will return to DOS the following exit codes:
Exit Code
Meaning
___________________________________________________________
0
Normal completion, no assembly errors
1
Normal completion, with assembly errors
2
Abnormal completion, insufficient memory
3
Abnormal completion, file access error
4
Abnormal completion, general error
Exit codes 2 and above will also be accompanied by messages to the console
concerning the error.
TASM - Table Driven Assembler Version 3.0
SOURCE FILE FORMAT
Page 12
operand
comment
lda
byte1
Page 13
dec
jne
byte1
label1
sta
;
lda
byte2,X
a multiple statement line follows
byte1\ sta byte1+4\ lda byte2\ sta byte2+4
;
label2
EXPRESSIONS
Expressions are made up of various syntactic elements (tokens) combined
according to a set of syntactical rules. The tokens are summarized as
follows:
1.
2.
3.
4.
5.
Labels
Constants
Location Counter Symbol
Operators
Parenthesis
Labels. Labels are strings of characters that have a numeric value associated
with them, generally representing an address. Labels can contain upper and
lower case letters, digits, underscores, and periods. The first character
must be a letter or the local label prefix (default '_'). The value of a
label is limited to 32 bit precision. Labels can contain up to 32
characters, all of which are significant (none are ignored when looking at a
label's value, as in some assemblers). Case is significant unless the '-i'
command line option is invoked.
Local labels must only be unique within the scope of the current module.
Modules are defined with the MODULE directive. Here is an example:
.MODULE xxx
lda regx
jne _skip
dec
_skip rts
.MODULE yyy
lda regy
jne _skip
dec
_skip rts
In the above example, the _skip label is reused without harm. As a default,
local labels are not shown in the label table listing (resulting from the 'l' command line option). See also sections on MODULE and LOCALLABELCHAR
directives.
Page 14
Numeric Constants. Numeric constants must always begin with a decimal digit
(thus hexadecimal constants that start with a letter must be prefixed by a
'0' unless the '$' prefix is used). The radix is determined by a letter
or
or
or
or
$1234
100
@177400
%01011000
The prefixes are provided for compatibility with some other source code
formats but introduce a problem of ambiguity.
Both '%' and '$' have
alternate uses ('%' for modulo, '$' for location counter symbol).
The
ambiguity is resolved by examining the context. The '%' character is
interpreted as the modulo operator only if it is in a position suitable for a
binary operator. Similarly, if the first character following a '$' is a valid
hexadecimal digit, it is assumed to be a radix specifier and not the location
counter.
Character Constants. Character constants are single characters surrounded by
single quotes. The ASCII value of the character in the quotes is returned.
No escape provision exists to represent non-printable characters within the
quotes, but this is not necessary since these can be just as easily
represented as numeric constants (or using the TEXT directive which does
allow escapes).
String Constants. String constants are one or more characters surrounded by
double quotes. Note that string constants are not allowed in expressions.
They are only allowable following the TITLE, BYTE, DB, and TEXT assembler
directives. The quoted strings may also contain escape sequences to put in
unprintable values. The following escape sequences are supported:
Escape
Sequence
Description
___________________________________________________________
\n
Line Feed
\r
Carriage return
\b
Backspace
\t
Tab
\f
Formfeed
\\
Backslash
\"
Quote
\000
Octal value of character
Page 15
Location Counter Symbol. The current value of the location counter (PC)
can be used in expressions by placing a '$' in the desired place. The
Location Counter Symbol is allowable anywhere a numeric constant is. (Note
that if the '$' is followed by a decimal digit then it is taken to be the
Multiplicative multiplication
division
modulo
logical shift left
logical shift right
~
-
Unary
=
==
!=
<
>
<=
>=
Relational
equal
equal
not equal
less than
greater than
less than or equal
greater than or equal
&
|
^
Binary
binary 'and'
binary 'or'
binary 'exclusive or'
The syntax is much the same as in 'C' with the following notes:
1. No operator precedence is in effect. Evaluation is from left to right
unless grouped by parenthesis (see example below).
2. All evaluations are done with 32 bit signed precision.
3. Both '=' and '==' are allowable equality checkers. This is allowed since
the syntax does not provide assignment capability (as '=' would normally
imply).
The relational operators return a value of 1 if the relation is true and 0 if
it is false. Thirty-two bit signed arithmetic is used.
It is always a good idea to explicitly indicate the desired order of
evaluation with parenthesis, especially to maintain portability since
TASM does not evaluate expressions in the same manner as many other
TASM - Table Driven Assembler Version 3.0
assemblers. To understand how it does arrive
expressions, consider the following example:
1 + 2*3 + 4
Page 16
at
the
values for
= 11
To make sure you get the desired order of evaluation, use parenthesis
liberally.
Note that TASM versions earlier than 2.7.8 employed a somewhat different
method of evaluating expressions (also without precedence) that essentially
resulted in a right to left evaluation.
Here are some examples of valid expressions:
(0f800H + tab)
(label_2 >> 8)
(label_3 << 8) & $f000
$ + 4
010010000100100b + 'a'
(base + ((label_4 >> 5) & (mask << 2))
TASM - Table Driven Assembler Version 3.0
Page 17
ASSEMBLER DIRECTIVES
Most of the assembler directives have a format similar to the machine
instruction format.
However, instead of specifying operations for the
processor to carry out, the directives cause the assembler to perform some
function related to the assembly process. TASM has two types of assembler
directives - those that mimic the 'C' preprocessor functions, and those that
resemble the more traditional assembler directive functions. Each of these
will be discussed.
The 'C' preprocessor style directives are invoked with a '#' as the first
character of the line followed by the appropriate directive (just as in 'C').
Thus, these directives cannot have a label preceding them (on the same line).
Note that in the examples directives are shown in upper case, however, either
upper or lower case is acceptable.
ADDINSTR. This directive can be used to define additional instructions for
TASM to use in this assembly. The format is:
[label] .ADDINSTR inst args opcode nbytes modop class shift binor
The fields are separated by white space just as they would appear in an
instruction definition file. See the TASMTABS.DOC file on the TASM
distribution disk for more detail.
AVSYM. See SYM/AVSYM.
BLOCK. This directive causes the Instruction Pointer to advance the specified
number of bytes without assigning values to the skipped over locations. The
format is:
[label] .BLOCK
expr
2
1
80
Page 18
BYTE. This directive allows a value assignment to the byte pointed to by the
current Instruction Pointer. The format is:
[label] .BYTE
Only the lower eight bits of expr are used. Multiple bytes may be assigned
by separating them with commas or (for printable strings) enclosed in double
quotes. Here are some examples:
label1
.BYTE
.byte
.byte
.byte
.byte
10010110B
'a'
0
100010110b,'a',0
"Hello", 10, 13, "World"
starting_addr
Here is an example:
start: NOP
LDA #1
.CHK start
The checksum is calculated as the simple arithmetic sum of all bytes starting
at the start_add up to but not including the address of the CHK directive.
The least significant byte is all that is used.
Page 19
The simplest form of the DEFINE directive might look like this:
#DEFINE
MLABEL
VAR1_LO
This statement would cause all occurrences of the string 'VAR1_LO' in the
source to be substituted with '(VAR1 & 255)'.
As a more complicated
capability, consider this:
#DEFINE
example,
ADD(xx,yy)
using
the
argument
expansion
ADD(xx,yy)
clc
\ lda xx
\ adc yy
\ sta xx
Page 20
ECHO. The ECHO directive can be used to send output to the console (stderr).
It can accept either a quoted text string (with the standard escape sequences
allowed) or a valid expression. It can accept only one or the other,
however. Multiple instances of the directive may be used to create output
that contains both. Consider the following example:
.ECHO "The size of the table is "
.ECHO (table_end - table_start)
.ECHO " bytes long.\n"
This would result in a single line of output something like this:
The size of the table is 196 bytes long.
EJECT. This directive can be used to force a top-of-form and the
generation of a page header on the list file. It has no effect if the
paging mode is off (see PAGE/NOPAGE). The format is:
.EJECT
ELSE. This directive can optionally be used with IFDEF, IFNDEF and IF to
delineate an alternate block of code to be assembled if the block immediately
following the IFDEF, IFNDEF or IF is not assembled.
Here are some examples of the use of IFDEF, IFNDEF, IF, ELSE, and ENDIF:
#IFDEF
lda
sta
#ENDIF
label1
byte1
byte2
#ifdef
lda
#else
lda
#endif
label1
byte1
byte2
#ifndef label1
lda
byte2
#else
lda
byte1
#endif
#if ($ >= 1000h)
; generate an invalid statement to cause an error
; when we go over the 4K boundary.
!!! PROM bounds exceeded.
#endif
END. This directive should follow all code/data generating statements in
the source file. It forces the last record to be written to the object file.
The format is:
[label]
.END [addr]
The optional addr will appear in the last object record (Motorola S9 record
TASM - Table Driven Assembler Version 3.0
Page 21
type) if the object format is Motorola hex. The addr field is ignored for
all other object formats.
ENDIF. This directive must always follow an IFDEF, IFNDEF, or IF directive
and signifies the end of the conditional block.
EQU. This directive can be used to assign values to labels. The labels can
then be used in expressions in place of the literal constant. The format is:
label
.EQU
expr
Here is an example:
MASK
;
.EQU
0F0H
lda
and
sta
IN_BYTE
MASK
OUT_BYTE
0F0H
MASK
MASK
=0F0H
=$F0
or
White space must exist after the label, but none is required after the '='.
EXPORT. This directive can be used to define labels (symbols) that are to be
written to the export symbol file. The symbols are written as equates (using
the .EQU directive) so that the resulting file can be included in a
subsequent assembly. This feature can help overcome some of the deficiencies
of TASM due to its lack of a relocating linker. The format is:
[label] .EXPORT
label [,label...]
The following example illustrates the use of the EXPORT directive and the
format of the resulting export file:
Source file:
.EXPORT
.EXPORT
read_byte
write_byte, open_file
.EQU
.EQU
.EQU
$1243
$12AF
$1301
FILL. This directive can be used to fill a selected number of object bytes
with a fixed value. Object memory is filled from the current program counter
forward. The format is as follows:
TASM - Table Driven Assembler Version 3.0
[label] .FILL
Page 22
number_of_bytes [,fill_value]
expr
INCLUDE. The INCLUDE directive reads in and assembles the indicated source
file. INCLUDEs can be nested up to six levels. This allows a convenient
means to keep common definitions, declarations, or subroutines in files to be
included as needed. The format is as follows:
#INCLUDE
filename
The filename must be enclosed in double quotes. Here are some examples:
#INCLUDE
#include
#include
"macros.h"
"equates"
"subs.asm"
Page 23
.LIST
.NOLIST
LOCALLABELCHAR. This directive can be used to override the default "_" as the
label prefix indicating a local label. For example, to change the prefix to
"?" do this:
.LOCALLABELCHAR "?"
Be careful to use only characters that are not operators for expression
evaluation. To do so causes ambiguity for the expression evaluator. Some
safe characters are "?", "{", and "}".
LSFIRST/MSFIRST. These directives determine the byte order rule to be
employed for the WORD directive. The default (whether correct or not) for
all TASM versions is the least significant byte first (LSFIRST).
The
following illustrates its effect:
0000 34 12
0002
0002 12 34
0004
0004 34 12
.word $1234
.msfirst
.word $1234
.lsfirst
.word $1234
ORG. This directive provides the means to set the Instruction Pointer (a.k.a.
Program Counter) to the desired value. The format is:
[label] .ORG
expr
The label is optional. The Instruction pointer is assigned the value of the
expression, expr. For example, to generate code starting at address 1000H,
the following could be done:
start
.ORG
1000H
$+8
An alternate form of ORG is '*=' or '$='. Thus the following two examples
are exactly equivalent to the previous example:
*=*+8
$=$+8
PAGE/NOPAGE. These directives can be used to alternately turn the paging
mode on (PAGE) or off (NOPAGE). If paging is in effect, then every sixty
TASM - Table Driven Assembler Version 3.0
Page 24
lines of output will be followed by a Top of Form character and a two line
header containing page number, filename, and the title. The format is:
.PAGE
.NOPAGE
The number of lines per page can be set with the '-p' command line option.
SET. This directive allows the value of an existing label to be changed. The
format is:
label
.SET
expr
The use of the SET directive should be avoided since changing the value of a
label can sometimes cause phase errors between pass 1 and pass 2 of the
assembly.
SYM/AVSYM. These directives can be used to cause a symbol table file to be
generated. The format is:
.SYM
["symbol_filename"]
.AVSYM ["symbol_filename"]
For example:
.SYM
.SYM
.AVSYM
.AVSYM
"symbol.map"
"prog.sym"
The two directives are similar, but result in a different format of the
symbol table file. The format of the SYM file is one line per symbol, each
symbol starts in the first column and is followed by white space and then
four hexadecimal digits representing the value of the symbol. The following
illustrates the format:
label1
label2
label3
FFFE
FFFF
1000
The AVSYM is provided to generate symbol tables compatible with the Avocet
8051 simulator. The format is similar, but each line is prefixed by an 'AS'
and each symbol value is prefixed by a segment indicator:
AS
AS
AS
AS
AS
start
read_byte
write_byte
low_nib_mask
buffer
C:1000
C:1243
C:1280
N:000F
X:0080
The segment prefixes are determined by the most recent segment directive
invoked (see BSEG/CSEG/DSEG/NSEG/XSEG directives).
TEXT. This directive allows an ASCII string to be used to assign values to a
sequence of locations starting at the current Instruction Pointer.
The
TASM - Table Driven Assembler Version 3.0
Page 25
format is:
[label] .TEXT
"string"
The ASCII value of each character in string is taken and assigned to the next
sequential location. Some escape sequences are supported as follows:
Escape
Sequence
Description
___________________________________________________
\n
Line Feed
\r
Carriage return
\b
Backspace
\t
Tab
\f
Formfeed
\\
Backslash
\"
Quote
\000
Octal value of character
Here are some examples:
message1
message2
.TEXT
.text
.text
.text
TITLE. This directive allows the user to define a title string that appears
at the top of each page of the list file (assuming the PAGE mode is on). The
format is:
.TITLE "string"
The string should not exceed 80 characters. Here are some examples:
.TITLE "Controller version 1.1"
.title "This is the title of the assembly"
.title ""
TASM - Table Driven Assembler Version 3.0
Page 26
WORD. This directive allows a value assignment to the next two bytes pointed
.WORD
.word
.Word
.Word
(data_table + 1)
$1234
(('x' - 'a') << 2)
12, 55, 32
Page 27
Intel Hex Object Format. This is the default format. This format is line
oriented and uses only printable ASCII characters except for the carriage
return/line feed at the end of each line. Each line in the file assumes the
following format:
:NNAAAARRHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCTT
Where:
All fields marked 'hex' consist of two or four ASCII hexadecimal digits (0-9,
A-F). A maximum of 24 data bytes will be represented on each line (override
the 24 byte default with the '-o' command line option).
:
NN
AAAA
RR
HH
CC
TT
=
=
=
=
=
=
=
The last line of the file will be a record conforming to the above format
with a byte count of zero:
:00000001FF
The checksum is defined as:
sum = byte_count+address_hi+address_lo+record_type+(sum of all data bytes)
checksum = ((-sum) & ffh)
TASM - Table Driven Assembler Version 3.0
Page 28
MOS Technology Hex Object Format. This format is line oriented and uses only
printable ASCII characters except for the carriage return/line feed at the
end of each line. Each line in the file assumes the following format:
;NNAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCTT
All fields marked 'hex' consist of two or four ASCII hexadecimal digits (0-9,
A-F). A maximum of 24 data bytes will be represented on each line (override
the 24 byte default with the '-o' command line option).
;
NN
AAAA
HH
CCCC
TT
=
=
=
=
=
=
The last line of the file will be a record with a byte count of zero (';00').
The checksum is defined as:
sum = byte_count+address_hi+address_lo+record_type+(sum of all data bytes)
checksum = (sum & ffffh)
Motorola Hex Object Format. This format is line oriented and uses only
printable ASCII characters except for the carriage return/line feed at the
end of each line. Each line in the file assumes the following format:
S1NNAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHCCCCTT
All fields marked 'hex' consist of two or four ASCII hexadecimal digits (0-9,
A-F). A maximum of 24 data bytes will be represented on each line (override
the 24 byte default with the '-o' command line option).
S1
NN
AAAA
HH
CC
TT
=
=
=
=
=
=
The last line of the file will be a record with a byte count of zero
('S903AAAACCTT') where AAAA will be set to the address specified in the END
directive, or 0 if no such address is provided.
The checksum is defined as:
sum = byte_count+address_hi+address_lo+record_type+(sum of all data bytes)
checksum = (~sum & ffh)
Binary Object Format. This file format has only a binary representation of
each data byte with no address, checksum or format description, whatsoever.
It is often a convenient format to use to pass the data to other programs on
your PC (like a PROM programmer package) but because of the non-printability
and lack of address information, it is not often used to transmit the code to
TASM - Table Driven Assembler Version 3.0
Page 29
other systems.
Note that when this object format is selected (-b option), the -c option is
Page 30
an 'INCLUDE'
Page 31
PROM PROGRAMMING
A wide variety of PROM programming equipment is available that can use object
code in one or more of the formats TASM supports. Here are some notes
Page 32
ERROR MESSAGES
TASM error messages take the following general form:
filename line line_number: error_message
For example:
main.asm line 0032: Duplicate label (start)
This format is compatible with the Brief editor (from Borland International).
Brief provides the ability to run assemblies from within the editor. Upon
completion of the assembly, Brief will parse the error messages and jump to
each offending line in the source file allowing the user to make corrective
edits.
An instruction is attempting to
branch to a location not within the
current 2K byte page.
An instruction is attempting to
branch to a location not within the
current 256 byte page.
Duplicate label.
Duplicate
label
checks
optionally enabled by the
option.
are
'-a'
Page 33
Imbalanced conditional.
Page 34
To many
labels
encountered.
have
be
been
No files specified
No such label.
No terminating quote
Page 35
assume this error.
See the -a8
option of ASSEMBLY CONTROL.
Unrecognized directive
defined as a directive.
Unrecognized instruction
Unrecognized argument
Unknown token
Unexpected
encountered
expression.
characters
were
while parsing
an
Page 36
1000
1000
10
16 characters
60000 bytes
256K
Bugs
1. The 8048 version of TASM does not check for use of memory beyond any
reasonable bounds (e.g. an 8048 has a maximum address space of 4 Kbytes but
TASM will let you pretend that you have 64 Kbytes).
2. Expression evaluation has no operator precedence in effect which can
make for unexpected results if not explicitly grouped with parenthesis.
3. First page of listing file will not show a user defined title (defined
via TITLE directive).
Page 37
DESCRIPTION
UNIT PRICE
PRICE
___________________________________________________________________________
TASM Registration (TASM disk, manual, & source) $40.00
_______
90.00
_______
10.00
_______
10.00
_______
Subtotal
_______
_______
_______
_______