Types of Error Messages Error Message Descriptions 5 Appendix B: Transputer Instruction Set Direct Functions Indirect Functions 6 Appendix C: TASM Internals Source Code Organization and Compiling Transputer Toolset TASM Transputer Assembler Introduction Overview TASM is a relocating assembler for INMOS Transputers. It supports standard INMOS mnemonics and allows splitting a program into separate pieces which are combined at linkage time. TASM is designed to be used in two ways: 1.
As a post-pass to the TCX “C” compiler. The compiler generates an assembly language output file and TASM is used to turn it into relocatable format. The advantage of this scheme is the fact that the compiler can allow in-line assembly language without having to also have a redundant assembler built in. 2. As a stand-alone tool for doing assembly language programming on the Transputer. In this role it is often combined with the preprocessor from the “C” compiler (PP), which allows multi-line recursive macros, conditional assembly, include files, etc.
TASM has been designed to be used with PP and can parse information PP provides to generate an assembly listing of source code which may have originated in many different files and been subsequently combined by PP. The architecture of the Transputer requires that some of the code generation be delayed until the linker/locater stage to insure minimum length prefix strings are generated for all instructions. TASM supports this by determining which instructions can be “finished” and which cannot at assembly time.
TASM finishes those which can be and provides information to the linker (TLNK), about the others. TASM uses a multiple pass algorithm to determine which instructions can be “finished” and what the corresponding minimum length instruction prefix strings should be. The algorithm used doesn’t guarantee minimum length prefixes in all cases (generating a minimum length program is a theoretically “hard” problem), but does a pretty fair job in a moderate amount of time. System Requirements TASM requires approximately 256K of program memory space to run.
It should run in any environment which supports other major system development tools (compilers, etc). TASM does use a fair bit of disk space with temporary, output, and listing files. As an estimate, you should have disk space available that is twice the size of the input file for the temporary files, and space equal to the size of the input file for the output file (both types of files will be used at the same time when TASM is generating the output file). If you wish to generate a listing file you should have additional space available equal to twice the input file size.
Note that a fair amount of I/O is done to the temporary files and they should be located on the fastest mass storage device available (see Usage section below for more information on how to specify this). 2 TASM Transputer Assembler Transputer Toolset Usage The general form of the TASM command line is: tasm ;input_filename; [;temp_directory;] [-[options]*]* The basic idea is to specify the required input filename (complete with filename extension if not “. al”), followed by an optional temporary file directory pathname, followed by any options needed. Note that in this case, since no explicit output filename has been specified, the output filename will default to that of the input filename, but with an extension of “. trl” in place of any extension the input filename had. The temporary file pathname is used to tell TASM to use somewhere other than the current directory (or if the “TMP” environment variable exists, the directory it specifies), to hold the temporary files TASM generates.
If possible, the temporary file pathname (whether explicit or via “TMP”), should be set to the fastest mass storage available (ideally a ram-disk). The process of assembling code for the Transputer may involve making the equivalent of many passes over the source text (most of which are done using temporary files). Examples Assume you wish to assemble a program stored on file “foo. tal”; The syntax needed is simply: tasm foo In this case TASM would use the “TMP” directory (or the current directory if “TMP” isn’t defined), to hold its temporary files (“foo. 1” and “foo. 2”).
If you had fast storage available on pathname “/fast” you could use: tasm foo /fast If you wanted to write the relocatable output to some file other than “foo. trl”, say “foobar. huh”, you would use the “-o” option flag followed by the desired output filename: tasm foo /fast -o foobar. huh 3 Transputer Toolset TASM Transputer Assembler Option Information As seen above with the “-o” flag, an option flag may need a following parameter, although many option flags are simple switches which may be grouped together following a common “-” option flag lead-in.
For instance, if you wish to toggle the verbose output mode and you wish to generate an assembly listing, the following command line will do it: tasm foo -lv Where the “l” indicates you want the listing and the “v” sets the output mode to verbose if TASM defaults to quiet and vice versa (actual default depends on the configuration of TASM). The above result could also be obtained by separating the option flags: tasm foo -l -v Please note, although in the above examples the option flags were in lowercase, uppercase is also allowed (some systems support nothing else)!
Option Descriptions The following descriptions detail all the option flags available with TASM, what each does, and what additional parameters are required (if any): ——————————————————————————— Option flag: -c This option is provided to “compress” the TASM output file. Doing this removes all the debug information. The big motivation is that this often cuts the output file size in half! It is particularly useful when building libraries or other chunks of code which aren’t routinely debugged. ——————————————————————————– Option flag: -l As mentioned previously, this option causes TASM to generate an assembly listing. The filename for the listing is the same as the output filename with an extension of “. lst”. For example: tasm foo -l TASM would read the input file from “foo. tal”, use “foo. trl” as the output file AND write the listing to “foo. lst”. The “-l” option is not allowed if the original source text was not assembly language (see the “-t” option below). See later sections of this chapter for a description of the assembly language listing format. TASM Transputer Assembler Transputer Toolset Option flag: -o
The choices are “-q0” (no optimization, all references will be 8 bytes long), “-q1” (optimize to minimize the number of symbols and references which are passed on to the linkage phase), and the default, “-q2” (maximum optimization by deferring ALL boundary cases to link time). The “-q1” option is mainly provided for backward compatibility with pre-87. 8 versions of TASM (where it was the default). The “-q0” option speeds up the execution of TASM in addition to potentially speeding up the execution of TLNK.
During the early stages of program development use of the “-q0” flag on all files which make up a program (including those from libraries), will eliminate the otherwise required prefix optimization performed by TLNK and thus hasten the development cycle. On the down side the “-q0” option nearly doubles the program code size and execution time! ——————————————————————————— Option flag: -t This option flag is used if the input file TASM is assembling was the result of a language translator.
What this actually does is to inhibit TASM from counting input lines in an attempt to keep track of source input line numbers. TASM still accepts and updates its line number information in response to “#line” directives which are presumed to reflect the line numbers in the original source text. Using this option allows the line number information which is contained in the relocatable output file to represent the original source code line numbers instead of the (in this case), intermediate assembly language file line numbers.
Using this option disables the generation of an assembly language source listing. ——————————————————————————— Option flag: -v This option flag toggles TASM between the verbose and quiet output modes. Depending on the configuration of TASM this option will either cause additional information to be written to the user or disable same (the opposite of whatever the default setting is). 5 Transputer Toolset TASM Transputer Assembler TASM Assembly Language Syntax and Semantics
The next several sections describe the syntax and semantics of the assembly language TASM accepts. TASM has some syntax and semantic features in common with “C”. Rather than repeat information which is familiar to many, we will refer you to a “C” reference manual for explanations about some features. The manual we recommend is: “C” A Reference Manual Samuel P. Harbison/Guy L. Steele Jr. Prentice-Hall, Inc. Englewood Cliffs, NJ 07632 Most other “C” texts also provide the level of description needed to understand the features TASM shares with “C”. TASM Assembly Language Introduction
TASM uses the standard INMOS abbreviations for instruction names (see appendix B for a listing of these). TASM is line oriented with one instruction allowed per line. Each line has the following format: [;label_field;] [;opcode_field;] [;operand_field;] Some sample assembly language statements: test j @test ;Doesn’t go anywhere very fast mint ;Minimum integer instruction .db “hello
” ;Define “C”-style string constant label3 ;Single label with no opcode label4: ;Colons in labels are ignored
As you can see, comments are allowed after a trailing “;”, and last until the end of the line. Comments may appear anywhere in a line (including the first column), but anything afterwards is ignored. Labels are optional and must begin in the first column. The opcode field holds the instruction or pseudo-op name, it must not begin in the first column. The operand field contains any required parameters for the instruction or pseudo-op listed prior to it on the line. Fields should be separated with either spaces or tabs. Labels and other TASM symbols are from 1 to 255 characters long.
They are case sensitive. Labels begin with a letter, a “_” or a “? “. They may contain those symbols plus digits. Labels may optionally be terminated with (or contain), one or more colon characters. Colon characters are allowed for compatibility with other assemblers and do not count as part of the label (you should not use a colon in any symbols you use in any operand fields). 6 TASM Transputer Assembler Transputer Toolset The operand field follows the label field and contains either an instruction opcode or a pseudo-opcode.
The pseudo-op’s are begun with a “. “, but are otherwise similar in form to opcodes (see the next section for information about them). The operand field contains different types of things depending on what the preceeding opcode or pseudo-op is. The types are: a€? “C” style constant expressions. These include character constants and the other standard “C” features. You may also include symbols in constant expressions as long as they are defined in a “. set” pseudo-op prior to the constant expression in the file (no forward references allowed).
Please see a “C” reference manual for a description of the constant expression syntax. Some examples: ‘a’ -12 +1 (234+0x12)/022 + ‘