Page Numbers: Yes X: 530 Y: 10.5" First Page: 1 Not-on-first-page
Margins: Top: 1.3" Bottom: 1"
Heading: Not-on-first-page
Dolphin MicroAssemblerEdward R. Fiala9 October 1981
DOLPHIN
MICROASSEMBLER
9 October 1981
by
Edward Fiala
Xerox Palo Alto Research Center
3333 Coyote Hill Road
Palo Alto, California, 94304
Filed on:[Indigo]<D0Docs>D0Microassembler.Press
Sources on:
[Indigo]<D0Source>D0Microassembler.Dm
This manual describes the Dolphin microassembly language, based upon the 16 May 1979 release of the Dolphin Hardware Manual, and hardware changes up to the release date of this manual.
This manual is the property of Xerox Corporation and is to be used solely for evaluative purposes. No part thereof may be reproduced, stored in a retrieval system, transmitted, disseminated, or disclosed to others in any form or by any means without prior written permission from Xerox.

TABLE OF CONTENTS
l.Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.Assembly Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.Error Messages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.Debugging Microprograms . . . . . . . . . . . . . . . . . . . . . . . . . 8
5.Cross Reference Listings . . . . . . . . . . . . . . . . . . . . . . . . . . 9
6.Comments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
7.Conditional Assembly . . . . . . . . . . . . . . . . . . . . . . . . . . . .10
8.Simplified Parsing Rules . . . . . . . . . . . . . . . . . . . . . . . . . .11
9.Statements Controlling Assembly . . . . . . . . . . . . . . . . . . . .12
10.Forward References . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
11.Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
12.Repeat Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14
13.Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
14.Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15
15.SetTask Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .16
16.Assembling Data for RM . . . . . . . . . . . . . . . . . . . . . . . . . .18
17.Assembling Data Items In the Instruction Memory . . . . . . . .19
18.General Comments on Instruction Statements . . . . . . . . . . .20
19.RM and STK Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . .22
20.Cycler-Masker Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . .23
21.A Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24
22.B Phrases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25
23.ALU Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .26
24.Memory Reference Instructions . . . . . . . . . . . . . . . . . . . . .27
25.RM Interlocking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .28
26.Standalone Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
27.Branching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .30
28.NextData and NextInst . . . . . . . . . . . . . . . . . . . . . . . . . . .32
29.Placement Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . .34
30.Tasking Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . .35
31.Microcode Overlays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
32.Recent Hardware and Assembler Changes . . . . . . . . . . . . . .36

1. Preliminaries
The machine now called the Dolphin was at one time called the D0, so these two names are used somewhat interchangeably within this manual.
The Dolphin microprogramming language is implemented as a set of definitions on top of the machine-independent assembler Micro; Micro is an Alto program, so assemblies are carried out either on an Alto or on a Dolphin emulating an Alto. The assembly language is based upon the machine description in the 16 May 1979 release of D0 Hardware Manual and hardware changes that have occurred up to the release date of this manual.
Files referred to in this manual are as follows:
DocumentationWhen Using the Assembler
[Indigo]<D0Docs>[Indigo]<D0Source>
D0Manual.PressD0Lang.Mc
D0MidasManual.Press[Maxc2]<Alto>
D0Gotchas.PressMicro.Run
[Maxc2]<AltoDocs>
MicroD.Run
Micro.Press
The assembly language is defined by D0Lang.Mc. I have tried to make D0Lang.Mc and this documentation complete, so you should not need to refer to the Micro manual or study D0Lang for further details, except where noted here.
Micro flushes Bravo trailers, so you can use Bravo formatting if you want to. However, the cross reference program, MCross, which is expected to produce primary microprogram documentation, does not handle Bravo trailers. Also, line numbers in Micro error messages may be more difficult to correlate with source statements because of the line breaks inserted by Bravo’s hardcopy command. I advise against Bravo formatting for these reasons.
I recommend use of Gacha8 (i.e., a relatively small fixed-pitch font) for printing program listings, and use of Gacha10.Al for editing source files with Bravo. The smaller font is desirable because some statements will be long, and a smaller font will allow you to get these on one text line. Bravo tab stops should be set at precisely 8 character intervals for identical tabulation in Bravo and MCross.
The two relevant lines in USER.CM for BRAVO are:
FONT:0 GACHA 8 GACHA 10
TABS: Standard tab width = 1795
You will probably want to delete the other Font lines for Bravo in User.Cm.
I also recommend that you read the hardware manual through once or twice before programming; you will be referring regularly to the figures and tables in the hardware manual until you become extremely familiar with the machine.
Note: All arithmetic in this manual and in Dolphin microassembler source files is in octal.
2. Assembly Procedures
A microassembly is accomplished as follows:
Micro/L D0Lang Source1 Source2 ... SourceN
This causes the source files "D0Lang.Mc," "Source1.Mc," ..., "SourceN.Mc" to be assembled. The global switch "/L" causes an expanded assembly listing to be produced on "SourceN.LS"; if "/L" is omitted, no listing is made. The assembler also outputs "SourceN.Dib" (intermediate binary and addresses), "SourceN.Er" (error messages, which are also printed on the display), and "SourceN.St" (the Micro symbol table after assembling SourceN.Mc).
In other words, Micro assembles a sequence of source files with default extension ".Mc" and outputs four files whose extensions are ".Dib", ".Er", ".Ls", and ".St". The default name for these is the name of the last source file to be assembled. Direct output to particular files as follows:
Micro Sys/L/B D0Lang Source1 ... SourceN
causes the four output files to be "Sys.Ls", "Sys.St", "Sys.Dib", and "Sys.Er." These four files are used as follows: The ".Ls" file is the assembly listing which you will usually not want to create--the MicroD listing file mentioned below is generally of greater value. The ".St" file is a dump of the symbol table at the end of assembly; it can be used in subsequent assemblies to recreate the assembly environment, as discussed below. The ".Dib" file (Dolphin intermediate binary) is the file that will be processed by MicroD later. The ".Er" file contains error messages and other assembly information.
A summary of local and global Micro switches is as follows:
Global:/LProduce an expanded listing of the output
/NSuppress .Mb file output
/UConvert text in all source files to upper case
/OOmit .St file
Local:/RRecover from symbol table file
/LPut expanded listing on named file
/BPut binary output on named file with extension .Dib. Default symbol table (.St) and error listing (.Er) to named file.
/EPut error listing on named file
/SPut symbol table on named file
/UConvert text in named file to upper case
Assemblies are slow--it should take about 7 minutes to assemble a 400010-instruction program.
INSERT[file] statements, described later, can be put in source files so you don’t have to type as many source files on the command line. However, this will slow assembly because each INSERT makes a separate call on the directory lookup code (about 1 second), but all names on the command line are looked up at once. A better shortcut is to define command files to carry out your assemblies.
After obtaining an error-free assembly from Micro, you must postprocess the .Dib file with MicroD to transform it appropriately for loading by Midas. This is accomplished as follows:
MicroD Sys
MicroD displays a progress message while churning away, and requires about 60 seconds to process a 400010-instruction file (longer when large listings are produced). The local "/O" switch directs the output to the named file rather than to the last-named input file (default extension .Mb), so:
MicroD NewSys/O Sys
puts the output of MicroD for the input file Sys.Dib onto NewSys.Mb.
In this example, there is only one input file for MicroD (Sys.Dib)--it is also possible to assemble source files independently using the symbol table (.St) file produced by Micro to establish a basis point for further assemblies, thereby reducing assembly time. For example, you can build a GlobalDefs.St file as follows:
Micro/U D0Lang GlobalDefs
Then do all further assemblies as follows:
Micro/O/U GlobalDefs/R Sys/B Source1 ... SourceN
MicroD GlobalDefs Sys
Preassembling D0Lang and GlobalDefs in this way might save 10 seconds of assembly time.
MicroD can relocate code in IM (but not in any other memories). On very large programs, such as the system microcode, it is possible to proceed as follows:
Micro/U D0Lang GlobalDefs
Micro/O/U GlobalDefs/R Source1
Micro/O/U GlobalDefs/R Source2
...
Micro/O/U GlobalDefs/R SourceN
MicroD Sys/O GlobalDefs Source1 Source2 ... SourceN
where Source1 ... SourceN may assemble IM locations but must not assemble any RM locations referenced externally--internally referenced RM locations may be defined in Sourcex, but this has to be done in a way that avoids assignments that conflict with other sources. In other words, forward and external references are permitted only in instruction branch clauses, so everything else must be predefined in GlobalDefs.St or at the beginning of a source file.
One advantage of this method is that Source1 ... SourceN can be independently maintained without having to reassemble the entire system for every change; another advantage is that it avoids symbol table overflow--the current system microcode is near to overflowing at present. However, many changes to GlobalDefs will necessitate reassembling everything, and when everything is reassembled the total assembly time will be about 9 minutes rather than 7 minutes.
Note that you do not need to do anything special in your source files to declare labels which are exported (defined here, used elsewhere) or imported (used here, defined elsewhere). Micro assumes that any undefined branch symbol is meant to be imported (but gives you the list just so you can check), and MicroD assumes that all labels are exported. MicroD also discards all but the last definition of a name (e.g., the symbol "." is defined in every file as the address of the last microinstruction).
MicroD produces up to seven output files, depending upon the local and global flags specified on the command line. The name for these files is determined as discussed earlier, followed by the extensions given below (i.e., Sys.Mb, Sys.Dls, ... , SysOccupied.Mc):
.MbBinary output--data for memories and address symbols for use when debugging with Midas; this file is produced unless the global /P switch appears on the command line.
.DlsListing file always produced--it contains the Executive command line and all strings printed on the display while MicroD is running (i.e., progress information and error messages); this is followed by a table showing the number of free locations on each page of IM, and by a list of data and address symbols in each memory (which can be modified by various global and local switches discussed below).
.RegsRegister allocation listing produced if the global /R switch is specified; it lists in numerical order RM locations and address symbols associated with each.
.CSMapControl store map produced when the global /M switch is specified; when MicroD input consists of a number of modules (i.e., of .Dib files), the .CSMap file will show for each page in the control store (i.e., each page in IMX) the number of words in each module allocated on that page and the number of free locations in the page.
.CSChartA file showing which .Dib file contained the instruction at each real address, sorted by real address; this is produced only when the global /E switch is specified and is intended for hardware debugging with a logic analyzer.
.absDLSA file giving the correlation between real and imaginary IM addresses, sorted by real address; this is produced only when the global /H switch is specified and is intended for hardware debugging with a logic analyzer.
Occupied.McA file which can be assembled to reserve all locations occupied by the current image. It contains IMReserve declarations for every location into which MicroD has placed an instruction. The intent is that this file be used when building overlays to run on top of the current image.
A summary of the local and global MicroD switches is as follows:
Global:/AList only absolutely-placed IM locations
/CConcise listing--list everything except octal contents of IM
/DDebug--print a large amount of debugging information
/EProduce a .CSChart file (of Every location)
/HProduce a .absDLS file (useful for Hardware debugging)
/IIgnore OnPage
/KKludge enable--suppress LoadPage consistency checking
/MProduce a .CSMap file
/NNo listing--IM contents and other memories are not listed
/OProduce the Occupied.Mc output file containing IMReserve statements for all locations filled by MicroD
/PPrint only--supresses all MicroD actions and just lists all .Dib files
/RProduce a .Regs file
/SList symbols for all memories (except Version, RVRel, Disp, IMLock, and IMMask, which are consumed by MicroD). /N prevents /S from listing IM symbols
/TTrace--print a trace of calls on the storage allocator
/XExternal--allow references to unbound symbols in the .Mb file
Local:/AList only absolutely-place IM locations--overrides global setting
/CConcise listing--overrides global setting
/LList everything--overrides global setting
/NNot IM listing level overrides global setting
/OOutput file
/VVersion number
/ZSpecifies scratch file to use instead of Swatee
Global switches are usually specified on the command line as "MicroD/nmo Sys/O ..." but MicroD accepts "MicroD Sys/O ... ~/nmo" as an alternative. This alternate form is useful with command files because it allows varying switches to be specified at the end of the command line. In other words, if one has prepared a command file Foo.Cm containing "MicroD/n Sys/O ... ," the "~" feature allows variant switches via "@Foo ~/nmo" to the Alto Executive.
Only one of the /A, /C, or /N global switches, which control additional material printed in the .Dls file, can be meaningful--when none of these switches is specified a verbose (/L) listing will be produced. The /A, /C, /L, and /N local switches overrule the global switches for a particular file. The ordering of these is as follows: /L is most verbose; /A prints less IM information than /L; /C prints all other memories but not IM; and /N prints neither IM nor other memory information.
MicroD outputs a ".Mb" file, consisting of blocks of data that can be loaded into various Dolphin memories and of addresses associated with particular locations in memories. The memories are as follows:
IM44-bit x 10000-word instruction memory
(also contains 60 bits/word of placement and other information)
RM20-bit x 400-word register bank memory
In addition, three other memories called VERSION, IMLOCK, and IMMASK are produced by Micro and consumed by MicroD, but these are invisible to the programmer.
There are at present very limited provisions for microcode overlays, as discussed in a later section.
3. Error Messages
During assembly, error messages and assembly progress messages are output to both the display and the error file.
Micro error messages are in one of two forms, like the following:
... source statement ...
218...error message
-or-
... source statement ...
TAG+39...error message
The first example indicates an error on the 218th line of the source file. This form is used for errors that precede the first label in the file. The second form is used afterwards, indicating an error on the 39th line after the label "TAG".
Note that the line count measures <cr>’s in the source, so if you are using Bravo formatting in the source files, you may have trouble distinguishing <cr>’s from line breaks inserted by Bravo’s hardcopy command.
The "TITLE" statement in each source outputs a message of the form:
1...title..IM.address.=.341
This message indicates that the assembler has started working on that source file. "IM.address.=.341" indicates that the first IM location assembled in this source file is the 341st in the program. When a number of source files are assembled into a single .Dib file, this message may be helpful in correlating source statements with error messages from the postprocessor, MicroD.
The most common assembly errors result from references to undefined symbols and from setting a single instruction field multiple times (e.g., attempting to use the F1 field twice in one instruction). I do not believe that you will have any trouble figuring out what these messages mean, so no comments are offered here.
After Micro has finished an assembly, it returns to the Executive leaving a message like "Time: 22 seconds; 0 errors, 0 warnings, 20007 words free" in the system window. Only when the error or warning counts are non-zero do you have to look in the .Er file for detailed information about errors.
MicroD errors are discussed in the appendix.
4. Debugging Microprograms
Microprograms may be debugged directly on the hardware using facilities provided by Midas. To debug programs you will need to load Midas and its auxiliary files as discussed in the Dolphin Midas Manual.
Midas facilities consist of actions to boot the Dolphin; load microprograms; set, clear, and examine breakpoints; start, step, or halt the machine, and examine and modify storage. Addresses defined during assembly may be examined on the display. Midas contains a command file facility that allows you to carry out various procedures such as setting up the display and iterating through a sequence of diagnostic microprograms.
5. Cross Reference Listings
The cross-reference program for Dolphin microprograms is a Tenex subsystem called MCross. It is easier to maintain large programs when cross-reference listings are available, so you may wish to store your sources on a Tenex directory and make your listings using MCross.
Obviously, you can only use MCross if you have a timesharing account on Maxc. If not, you will have to do without cross-reference listings until MCross is implemented on Alto (no one is working on that now).
A typical dialog with MCross is given below. The program is more-or-less self-documenting and will give you a list of its commands if you type "?".
@MCROSS
Output File:
LPT:GACHA8.EP
Machine:
0(selects Dolphin syntax)
Action:
U(convert to upper case)
Action:
N(read def’s, no printout)
File:
D0LANG<esc>
Action:
CL(read def’s, produce cross ref)
File:
Source1<esc>
Action:
CL
File:
Source2<esc>
Action:
P(print operation usage statistics)
Action:
G(print global cross reference)
Action:
E
@
6. Comments
Micro ignores all non-printing characters and Bravo trailers. This means that you can freely use spaces, tabs, and carriage returns to format your file for readability without in any way affecting the meaning of the statements.
Comments are handled as follows:
"*" begins a comment terminated by carriage return.
"%" begins a comment terminated by the next "%". This is used for multi-line comments.
";" terminates a statement. Note that if you omit the ";" terminating a statement, and, for example, put a "*" to begin a comment, the same statement will be continued on the next line.
Micro’s COMCHAR feature provides one method of producing multi-statement conditional assemblies (This method is now obsolete, replaced by the conditional assembly features discussed in the next section). COMCHAR is used as follows. Suppose you want to have conditional assemblies based on whether the microcode is being assembled for a Pilot or Alto-compatible configuration. To do this define "=" as the comment character for Pilot (i.e., COMCHAR[=];) and "#" as the comment character for Alto-compatible. Then in the source files:
*= Alto-compatible configuration only
...statements for Alto-compatible configuration...
*= end of Alto-compatible statements
*# Pilot configuration only
...statements for Pilot configuration...
*# end of Pilot statements
In other words, "*" followed by the comment character is approximately equivalent to "%" and is terminated by the carriage return following its next occurrence.
7. Conditional Assembly
D0Lang defines IF, UNLESS, ELSEIF, ELSE, and ENDIF macros for doing multi-statement conditional assemblies; IF’s may be nested up to four levels deep. The syntax for these is as follows:
:IF[Display];
... statements assembled if Display is non-zero...
:ELSEIF[OldDisplay];
... statements assembled if Display is zero and OldDisplay non-zero...
:ELSE;
... statements assembled if both Display and OldDisplay are zero...
:ENDIF;
Alternatively, UNLESS can be used instead of IF, as follows:
:UNLESS[Display];
... statements assembled if Display is zero...
:ENDIF;
Note that each of the conditional names must be preceded by ":"; the implementation of these is discussed in the Micro manual. Any number of ELSEIF’s may be used after an IF, followed by an optional ELSE and a mandatory ENDIF. The arguments to IF and ELSEIF must be integers.
Warning: The :IF, :UNLESS, :ELSEIF, :ELSE, and :ENDIF must be the first characters in a statement. In the following example:
FlshCore:
:IF[MappedStorage];
... statements ...
:ELSE;
... statements ...
:ENDIF;
":IF" is illegal because, due to the "FlshCore" label, ":IF" are not the first characters of a statement.
8. Simplified Parsing Rules
After comments, false conditionals, and non-printing characters are stripped out, the rest of the text forms statements.
Statements are terminated by ";". You can have as many statements as you want on a text line, and you can spread statements over as many text lines as you want. Statements may be indefinitely long.
However, the size of Micro’s statement buffer limits statements to 50010 characters at any one time. If this is exceeded at any time during the assembly of a statement, an error message is output. Since horrendous macro expansions occur during instruction assembly, it is possible that instruction statements may overflow. If this occurs, the size of the statement buffer can be expanded (Tell me.).
The special characters in statements are:
"[" and "]"for enclosing builtin, macro, field, memory, and address argument lists;
"(" and ")"for causing nested evaluation;
"←"as the final character of the token to its left;
":"to put the address to its left into the symbol table with value equal to the current location and current memory, and as the first character of a statement to be evaluated even in the false arm of a conditional;
","separates clauses or arguments;
";"separates statements;
"#"#1, #2, etc., are the formal parameters inside macro definitions;
"01234567"are number components (all arithmetic in octal).
All other printing characters are ordinary symbol constituents, so it is perfectly ok to have symbols containing "+", "-", "&", etc. which would be syntactically significant in other languages. Also, don’t forget that blanks, carriage returns, and tabs are syntactically meaningless (flushed by the prescan), so "T+Q" = "T + Q", each of which is a single symbol.
The debugger Midas requires all address symbols to be upper case; since both Micro and MCross have switches that convert all source file characters to upper case, you can follow your own capitalization conventions but must convert to upper case at assembly time using the /U switch. Experience suggests that consistent capitalization conventions are desirable, although there is not much agreement on exactly what conventions should be used. In this manual I follow capitalization conventions which you may consider as a non-binding proposal. My convention is as follows:
The first letter of each word is capitalized.
When a symbol consists of several words run together, the first letter of each subword is capitalized (e.g., "NextData," "StkP").
When a symbol is formed by running together the first letters from several words, then these are all capitalized (e.g., "MNBR,").
Micro builtins, memory names, and important assembly directives that should stand out in the source, such as TITLE, END, IF, etc. are all capitals.
Midas also limits address symbols to 13 characters in length; if you assemble longer addresses, you will still be able to load and run your program with Midas, but you won’t be able to examine symbols longer than 13 characters.
Also, avoid using any of the characters "=," "#," "+," "-," and "!" in address symbols; these are syntactically significant to Midas and may cause trouble when debugging. Finally, avoid defining symbols that end with the character "@"; the internal symbols in D0Lang.Mc by convention end with "@," so you might have name conflicts with reserved words if you also define symbols ending with "@."
Statements are divided into clauses separated by commas, which are evaluated right-to-left. An indefinite number of clauses may appear in a statement.
Examples of clauses are:
NAME,
NAME[ARG1,ARG2,...,ARGN],
FOO←FOO1←FOO2←P+Q+1,P+Q+1 is referred to as a "source" while FOO←, FOO1←, and FOO2← are "destinations" or "sinks".
P←STEMP,
NAME[N1[N2[ARG]],ARG2]←FOO[X],
Further discussion about clause evaluation is postponed until later.
9. Statements Controlling Assembly
Each source file should begin with a TITLE statement as follows:
:TITLE[Source1];
The TITLE statement:
a.prints a message in the .Er file and on the display which will help you correlate subsequent error messages with source statements which caused them;
b.does a SetTask[0] (discussed later) and resets a number of assembly switches.
At the end of a file you may optionally insert an END statement:
:END[Source1];
The END statement prints a message like the title statement’s and checks for unterminated conditionals, but it does not affect the output of the assembler.
Note that the ":" preceding TITLE and END is optional; inserting the ":" will cause statement evaluation even in the false arm of a conditional, so an appropriate message can be printed to help detect :IF’s unmatched by :ENDIF’s. The "Source1" argument to :END is also optional.
You may at any place in the program include an INSERT statement:
INSERT[SourceX];
This is equivalent to the text of the file SourceX.MC.
The message printed on the .Er file by TITLE is most helpful in correlating subsequent error messages if any INSERT statements occur either before the TITLE statement or at the end of the file (before the END statement). INSERT works ok anywhere, but it might be harder to figure out which statement suffered an error if you deviate from this recommendation.
In the event you request a listing by putting "/L" in the Micro command line, the exact stuff printed is determined by declarations that can be put anywhere in your program.
D0Lang selects verbose listing output. However, you will generally not want to print this listing. The MicroD listing is normally more useful during debugging. If you want to modify the default listing control in D0Lang for any reason, you can do this using the LIST statement, as follows:
LIST[memory,mode];
where the "memory" may be any of the ones given earlier and the mode the OR of the following:
20(TAG) nnnnnn nnnnnn (octal value printout in 16-bit units)
10
alphabetically-ordered list of address symbols
4
numerically-ordered list of address symbols
2
(TAG) FF←3, JCN←4, etc (list of field stores)
1
(TAG) nnnn nnnn nnnn (octal value printout)
Note: The listing output will be incorrect in fields affected by forward references (i.e., references to as yet undefined addresses); such fields will be incorrectly listed as containing their default values.
Micro has a recently added TRACEMODE builtin which you may prefer to use instead of an assembly listing for the purposes of debugging complicated macros. TRACEMODE allows symbol table insertions and macro expansions to be printed in the .Er file. See the Micro manual for details about TRACEMODE.
10. Forward References
Micro and D0Lang have an extremely limited ability to handle forward references. The only legal forward references are to instruction labels from branch clauses. Anything else must be defined before it is referenced.
11. Integers
Micro provides builtin operations for manipulating 20-bit assembly-time integers. These have nothing to do with code generation or storage for any memories. Integers are used to implement assembly switches and to control Repeat statements. The operations are given in the table below and there is some additional discussion in the Micro Manual:
Set[NAME,OCT]Defines NAME as an integer with value OCT. Changes the value of NAME if already defined.
Select[i,C0,...,Cn]i is an integer 0 to n. Evaluates C0 if i = 0, C1 if i = 1, etc.
Add[O1,...,O8]Sum of up to 8 integers O1 ... O8.
Sub[O1, ... ,O8]O1-O2-...-O8
IFE[O1,O2,C1,C2]Evaluates clause C1 if O1 equals O2, else C2.
IFG[O1,O2,C1,C2]Evaluates C1 if O1 greater than O2, else C2.
Not[O1]Ones complement of O1.
Or[O1,O2,...,O8]Inclusive ’OR’ of up to 8 integers.
Xor[O1,O2,...,O8]Exclusive ’OR’ of up to 8 integers.
And[O1,O2,...,O8]’AND’ of up to 8 integers.
LShift[O1,N]O1 lshift N
RShift[O1,N]O1 rshift N
OCT in the Set[NAME,OCT] clause, may be any expression which evaluates to an integer, e.g.:
Set[NAME, Add[Not[X], And[Y,Z,3], W]]
where W, X, Y, and Z are integers.
If you want to do arithmetic on an address, then it must be converted to an integer using the IP operator, e.g.:
IP[FOO]takes the integer part of the address FOO
Add[3,IP[FOO]]
is legal
Add[3,FOO]
is illegal
Some restrictions on doing arithmetic on IM addresses are discussed later.
12. Repeat Statements
The assortment of macros and junk in the D0Lang file successfully conceals Micro’s complicated macro, neutral, memory, field, and address stuff for ordinary use of the assembler.
However, using the Repeat builtin may require you to understand underlying machinery--in a diagnostic you might want to assemble a large block of instructions differing only a little bit from each other, and you want to avoid typing the same instruction over and over.
Instruction statements are assembled relative to a location counter called ".". Originally set to 0 , "." is incremented by one every time an instruction is assembled. To do a Repeat, you must directly reference "." as follows:
Repeat[20, . [(instruction statement)]];
This would assemble the instruction 20 times. If you want to be bumping some field in the instruction each time, you would proceed as follows:
Set[X,0];
Repeat[20, . [(Set[X,Add[X,1]], instruction statement)]];
where the instruction statement would use X someplace.
For a complicated Repeat, you may have to know details in D0Lang. For this you will have to delve into it and figure out how things work.
13. Parameters
Parameters are special assembly-time data objects that you may define as building blocks from which constants, RM, or IM data may be constructed. Three macros define parameters:
MP[NAME,OCT];makes a parameter of NAME with value OCT
SP[NAME,P1,...,P8];makes NAME a parameter equal to the sum of P1,...,P8, which are parameters or integers.
NSP[NAME,P1,...,P8];makes NAME a parameter equal to the ones complement of the sum of P1,...,P8, which are parameters or integers.
The parameter "NAME" is defined by the integer "NAME!" (The "!" is a symbol constituent added so that a constant, small constant, or RM address can have an identical NAME.), so it ok to use the NAME again as an address or constant. However, you cannot use it for more than one of these.
14. Constants
The hardware allows a constant to be generated on B that is the 10-bit FF field of the instruction in either the left or right half of the 20-bit data path with 0 in the other 10-bit byte.
"Literal" constants such as "322C" or "32400C" may be inserted in instructions without previous definition.
Negative constants such as "-400C", "-32400C", etc. are also legal.
Left-half-word and right-half-word constants may be constructed from integers by applying, respectively, the HiA and LoA operators to a 20-bit integer. An optional second argument to HiA should be an integer in the range 0 to 17; if provided, this argument is or’ed with bits 0:3 of the first to produce the task number and high four address bits for APCTask&APC ←. An example using HiA and LoA is as follows:
RTemp ← HiA[DispStartLoc,DispTask];*Bits 0:7 (DispTask in 0:3)
RTemp ← (RTemp) or (LoA[DispStartLoc]);*Bits 10:17
Alternatively, constants may be constructed from parameters or integers using the following macros:
MC[NAME,P1,...,P8];defines NAME as a constant whose value is the sum of P1...P8 (integers or parameters).
NMC[NAME,P1,...,P8];defines NAME as the ones complement of the sum.
Warning: The two macros above also define NAME as a parameter. You must not redefine a parameter with the same name as a constant because the binding of the constant is to the name of its associated parameter (i.e., to "NAME!"), not to its value. In other words, if you redefine a parameter with the same name as a constant, you will redefine the constant also.
Because the definition of a constant also defines a parameter of the same name, it is possible to cascade a number of constant definitions to create various useful values. Here is an example of how several constant definitions can be cascaded:
MC[B0,100000];
MC[B1,40000];
MC[B2,20000];
MC[B01,B0,B1];
MC[B02,B01,B2];
Occasionally, you may wish to create a constant whose value is an arithmetic expression or an expression including an address in RM. Here are several examples of ways to do this:
IP[RAddr]CA constant whose value is an RM address
Add[3,LShift[X,4]]CA constant whose value is a function of the integer X
15. SetTask Statements
The hardware OR’s various bits of the task number into fields of the instruction to determine which RM addresses are referenced. You must tell the assembler what task is going to execute each section of microcode, so that it can perform the proper error checks and set up instruction fields appropriately.
This is done with a clause of the form:
SetTask[n];*n = the task number (0 to 17)
If you want to refer to task numbers symbolically, you can define integers with values equal to the task numbers. For example:
Set[DispTask,3];
Then use SetTask[DispTask] to refer to the task.
SetTask controls not only the assembly of instructions, but also the allocation of RM addresses to 100-word sections of RM, as discussed in the next section.
Note: The TITLE statement at the beginning of a file does a SetTask[0].