TMS-7000 Assembler Program
This program takes ASCII source code files for the Texas Instruments'
TMS-7000 series microprocessors and assembles them into executable object code
files ready to be burned into an EPROM. The Assembler can operate with several
different types of input source files. The length of the source file is
limited only by the amount of memory in your PC. The maximum length of the
assembled object code file is 64K.
This assembler is fast, but achieves this speed by hogging memory.
It allocates 1 64K segment for itself and the Symbol Table, 1 64K segment for
the assembled object code file, and the remainder of memory for the source
file. I assembled a 271K source file into a 16K object file in 16 seconds on
an 8 MHz PC-XT Clone with 640K.
The TMS-7000 Assembler has a number of features for the VCII software
experimenter. I have included a pseudo-op for assembling packed strings for
display using the VCII U6 chip. The "DM" pseudo-op takes all text inside
quotation marks and converts it into the equivalent U6 packed character set.
In addition, the Define Word "DW" and the Define Byte "DB" pseudo-ops can
perform limited math functions to locate addresses based on the values of
This is release 3.4 of the assembler. The 3.4 version of the assembler
is compatible with earlier versions of the assembler.
CHANGES: (1) Version 3.4 of the Assembler fixes a rare bug that can
occur when address tables composed of combinations of
DB and DW values are used. This bug caused all address
counter values to be off by a value of 5 for the remainder
of the assembly. The resulting object code would then fail
checksum tests and/or not execute properly.
(2) The assembler now checks the amount of free RAM available
before loading the source code file. If sufficient RAM is not
available to permit loading of the entire source code file,
an error message is printed and the program terminates. If
you have a number of memory-resident programs (i.e., SideKick)
loaded and active in your PC, removing these programs will free
up additional memory for the assembler. Source code files up
to about 300K are generally no problem in a 640K PC with only
SideKick resident. Larger files or more TSR programs in the
PC may cause a memory shortage for the assembler.
(3) The assembler will now ignore all ASCII tab codes (hex 09)
that some text editors place in the source code. Prior
releases of the assembler had been having weird problems with
those editors that place ASCII tab codes instead of spaces in
the source code file.
Send comments or suggestions to -
1918 Tap Road
Vidalia, GA 30474
NEW FEATURES OF THE ASM7000 TMS-7000 ASSEMBLER
Several new features were added with release 3.3 of the Assembler.
These are explained below.
1) The Assembler will now take either decimal or hexadecimal values
for all number values, including the "DB" psuedo-op. The maximum
decimal value allowed is 65535, positive integers only. The RADIX
psuedo-op is used to set the Assembler for decimal or hexadecimal
EXAMPLE - RADIX 10 ;Set Radix to Decimal
This sequence will cause the Assembler to generate
the byte sequence 22 26 in the Object Code. The
decimal value 38 will be converted to binary.
This new feature will also work with 16-Bit Word values
such as -
Note that a new psuedo-op has been added to govern the
conversion of immediate operands for 16-Bit Word values
used in the MOVD, LDA, STA, BR, and CMPA instructions.
The new psuedo-op, "WORDS" is described below. It
can be used to override the default RADIX value for the
argument of 16-Bit immediate operands. Unless
specifically overridden with the "WORDS" psuedo-op,
these instructions will treat their immediate operands
as hexadecimal values.
2) The Assembler will generate an ASCII text file of the Symbol
Table and write this file to the same disk drive that the Object
Code file was written to. The listing of the Symbol Table will
carry the name of the Object Code file with the exception of the
extension, which will be .SYM. The Symbol Table listing file has
the name of the Symbol in one column and its corresponding
hexadecimal address in the Object Code in the other column. This
file may be sent to a printer using the MS-DOS "PRINT" command
or any similar print spooler. The listing file is pure ASCII.
The primary benefit of the Symbol Table listing is for debugging
assembled object files. The actual hexadecimal addresses of
specific Labels can readily be determined from the listing.
3) The Assembler will now permit additional math functions based on the
values of Symbols/Labels. The math functions are integer-based
addition, subtraction, multiplication, and division. The arguments
may be either decimal or hexadecimal numbers, the conversion being
controlled by the RADIX psuedo-op.
EXAMPLE - Assume the following code sequence:
dBYTE1: EQU 16
. . .
. . .
MOV %dBYTE1 + 6,A
This will cause the value of BYTE1 at assembly time
to be added to 6 and the result stored in A. The
op-code sequence would be, 22 16 (Note that this is
16 hex which is 22 decimal).
Anywhere a Symbol is used, the addition or subtraction signs,
"+" or "-", or the multiplication or division signs, "*" or "/",
may be used as desired.
4) The Assembler will now allow either 1 or 2 character values for
hex bytes or 1 to 4 character values for hex words. Formally,
the Assembler required all byte values to be 2 ASCII characters
and all word values to be 4 ASCII characters.
EXAMPLE - The Version 2.x and 1.x series required this type
of hex byte argument;
and this type of hex word argument;
Version 3.x series will work with either the old 2
character type or a single character type;
Note that a leading zero for a number causes the number to be
evaluated as a hexadecimal number. This is a change from
earlier versions of the assembler.
5) The Assembler will now allow Symbol/Label values for immediate
operands. The assembly time value of the Symbol/Label will be
generated as the immediate operand.
Example -- MOV %dBYTE1,A
This will cause the Assembler to generate the
instruction sequence to load A with the immediate
value of BYTE1 at assembly time.
6) A new psuedo-op has been added to allow the handling of ASCII
strings in the source file. The "DT" psuedo-op causes the direct
writing into the object code of the ASCII values of the arguments
specified by the string. The string MUST be delimited by quotation
Example -- DT "This is a sample string"
This will cause the ASCII values of the delimited
string to be assembled directly into the object
7) The Assembler now compares all "word" values for CALL, BR, LDA, STA,
and MOVD instructions to the ORG given at the beginning of the code.
If the "word" value is less than the origin of the object code, it
is treated as an immediate "literal" value. If it is greater than
or equal to the origin, it is treated as a symbol name. This occurs
only if the value is not explicitly declared as a symbol name by the
"a" or "d" designator in front of the name. If the value is not
marked with the "a" or "d" designator, it is evaluated according to
the WORDS radix psuedo-op discussed below, however the evaluation
will proceed in hexadecimal if the value contains a leading zero.
RADIX -- The Radix pseudo-op establishes the default base for
numbers. It is a required statement in all source files
and must come before any Instruction Mnemonics.
The only valid arguments for Radix are 10 and 16 for decimal
and hexadecimal bases respectively.
Example - RADIX 10 ;sets base to 10
RADIX 16 ;sets base to hex
Note: The hexadecimal designator ">" can be used to
override the treatment of operands according to
the RADIX argument. A leading zero can be used
for the same purpose.
Example - MOV %>32,A
Will cause the value 32 to be
treated as a hex value regardless
of the default set by RADIX.
ORG -- The Origin pseudo-op establishes the beginning address for
the assembled object code. Multiple ORG statements are
Example - ORG >F000 ;sets address to F000
ORG >FFD0 ;sets address to FFD0
The ">" sign denotes a hex number follows.
Without the ">" designator to force a hexadecimal value,
the argument following the ORG psuedo-op is evaluated
according to the RADIX default value.
EQU -- The Equate pseudo-op sets a value for a symbol. Subsequent
references to that symbol cause the value given by EQU to
Example - APORT: EQU >0104
Subsequent references to APORT cause the assembler to return
the value 0104.
SYMBOL -- Valid switches are ON or OFF. The default is OFF. This
pseudo-op causes the Assembler to treat all memory addresses
at or above C000 hex as labels/symbols. If this type action
is desired, the command SYMBOL ON should be used at the
beginning of the source code.
Please note that when SYMBOL ON is used, MOVD instructions
may assemble differently or cause UNDEFINED SYMBOL error
Example -- Consider the following lines of code:
MOVD %D4E5, R35
MOVD %>D4E5, R35
The 1st MOVD instruction will attempt to
locate the symbol "D4E5" and use its address
to load into R34,35.
The 2nd MOVD instruction will force the
Assembler to generate the proper instruction
to load the hex value D4E5 into R34,35, due
to the Hex Immediate operand type flag- ">".
DB -- The Define Byte (DB) pseudo-op converts the value following
the DB statement into a hexadecimal byte. Special cases
allow the 2 arithmetic operators "/" and "MOD" when used
Example - DB >4D ;causes 4D to be stored at
DB 10 ;causes the value to be
;evaluated according to
;the RADIX flag and stored
;as a binary value at the
DB aDPORT/256 ;causes the value
;of DPORT to be
;divided by 256 and
;the high byte saved ;at the current
DB aDPORT MOD 256 ;causes the
;value of DPORT
;to be divided
;by 256 and the
;low byte saved
;at the current
DM -- The Define Message (DM) psuedo-op generates VCII packed
strings from the ASCII string following the statement.
The text string must be delimited by quotation marks.
Example - DM " DIAGNOSTIC DATA "
causes the assembler to generate the following 15 byte
sequence in the object code segment -
BA EB 83 20 01 90 45 55 88 0A E0 C0 58 0B AE
All strings must be an even multiple of 4 characters, such
as 4, 20, 160, etc. Only valid U6 characters will be
assembled. Invalid U6 characters will be treated as spaces.
DS -- The Define Space (DS) psuedo-op causes the Assembler to
reserve space in the Object Code. The empty space is set
to hex >FF. The argument following the DS psuedo-op is
the number of bytes to reserve. It is evaluated according
to the RADIX default.
Example -- DS 4000
Reserve 4000 bytes if RADIX is 10 or
16384 bytes if RADIX is 16.
The effect of DS is to cause the next instruction to be
assembled at an offset from the previous instruction as
specified in the argument for DS.
DT -- The Define Text (DT) psuedo-op causes the values delimited
by quotation marks to be treated as ASCII character bytes
to be assembled directly into the object code.
Example - DT "This is a sample string"
DW -- The Define Word (DW) psuedo-op causes the value following
the DW statement to be converted into a 16-Bit word value
and inserted into the object code at the current address.
Example - DW >CCD7 ;CCD7 is converted to a hex
;word and stored at the current
;object code address
DW dHERE1 ;the hex value of HERE1 is
;stored at the current object
The operand designator ">" can be used to force the Assembler
to generate hexadecimal numbers whenever the SYMBOL ON psuedo
op is used in the source code.
Example - DW FFFF ;if SYMBOL ON is used, the FFFF
;operand is interpreted as a
DW >FFFF ;this form forces generation of
;the hex sequence FF FF in the
NOTE: This same technique can be applied in the
MOVD series of instructions.
Example - MOVD %FFFF, R47 ;FFFF is symbol
MOVD %>FFFF,R47 ;FFFF is immediate
MOVD %0FFFF,R47 ;FFFF is immediate
END -- The END psuedo-op is an optional parameter that tells the
assembler it is at the end of the source file. This is
an optional statement however. The TMS-7000 Assembler is
smart enough to know it is at the end of the source file.
The END psuedo-op has no arguments.
WORDS -- The WORDS psuedo-op is provided to allow selective over-
riding of the RADIX treatment of 16-Bit Word values in
certain instructions. It is provided mainly as a convenience
to allow easy use of disassembled listings which may have
decimal numbers for registers and byte values, but hexadecimal
values for all word values. Valid arguments for WORDS are
10 and 16 to set the 16-Bit Word radix default to either
decimal (10) or hexadecimal (16). Upon start-up, the Assembler
sets the WORDS default to hexadecimal (16).
$ -- This token represents the location counter. It is a reserved
symbol in ASM7000 syntax. It may be used to represent the
current value of the object code address pointer. It basically
For Example - C005 MOVD %$+6,R47
This instruction sequence causes the
value of the location counter (C005)
to be added to 6, and the result used
as the immediate operand for the MOVD
instruction. Therefore this source
code line would result in the following
object code sequence:
C005 ==> 88 C0 0B 47 ;MOVD C00B to R47
NOTES -- The TMS-7000 Assembler assembles the entire instruction set of the
TMS-7000 series CPU's.
Because I wrote the assembler to directly take the output of a
disassembler, I wrote it so that it can sort through the address
field and op-code field and locate the symbols and instructions.
There are a couple of catches, however.
Example -- F0E3 88 62 47 35 MOVD %>6247,R35 ;put 6247 in R35
In this line from a typical disassembler, F0E3 is the
address and "88 62 47 35" is the op-code sequence.
My assembler will skip everything until it detects a
valid instruction sequence, such as the MOVD. This
does leave the assembler vulnerable to some loopholes
from time to time. First, ALL instructions must have
a space between the instruction mnemonic and the operands for the instruction. Second, some lines of source may
have to be modified to delete the address field if it
happens to contain an instruction mnemonic. For example
the line below would generate an assembler error.
FADC 88 62 47 35 MOVD %>6247,R35
The error comes from the F (ADC) part of the address
field because ADC is a valid TMS-7000 instruction.
This line in the source would have to have the FADC
part deleted. There are several other combinations
that will confuse the assembler, all involving the
address field hex numbers matching instructions, such
as FDEC (DEC), CDAC (DAC), etc.
There is one other requirement that is peculiar to this assembler.
It requires that all labels and or symbols be preceeded by either
an "a" or "d". This is necessary so the assembler can pick labels
from the other data on the line from typical disassemblers. The
only time the "a", "d" or "L" designator is not needed is when the
symbol is referenced in the Peripheral File instructions, such as
MOVP, ANDP, BTJZP, etc.
Labels and Symbols may end either with a space or with the ":"
character. The maximum length for labels and symbols is 20 characters.
The assembler has a symbol table large enough for approximately 3500
symbols, which should satisfy all requirements.
USING THE ASSEMBLER --
The assembler is invoked from the DOS prompt by typing ASM7000. The
program will then load and prompt you for the source code filename and
the object code filename. If the object code filename you specify
already exists, a warning message is issued and you are asked whether
or not the existing file is to be overwritten.
When assembly is complete, the program returns to the DOS prompt.
You may issue the source and object code filenames from the command
invocation line by typing them after ASM7000. The source file name
must be come first, followed by the object code filename. If the
object code filename already exists, you will be warned as above. The
filenames must be separated by a single space on the command line.
You may specify a full DOS pathname for locating the files, or ASM7000
follows the DOS rules by looking first in the current directory, and
then follow the path(s) specified in the DOS 3.3 APPEND command to
locate the files.
The assembler does rather extensive error checking during the assembly
process. If an error is detected, the offending line is sent to the
display, and the appropriate error message is printed.