$D.var pageno=1
$D.var Pic=0
$D.var NewChap,YTrap,PicH,TexH
$D.var(40) ChapTitle=''
$D.var(40) PicTitle=''

$D.format OddEven
=$y0.05"
=$Q(pageno&1) $x0.6" $10[$ChapTitle] $x2" $list12[$v(pageno)]$x>7.7"
=$Q(pageno&1) $O(0.6",0.4",7.4",10.5")[]
=$Q(1-pageno&1) $X0.2"$list12[$v(pageno)]$x1"
=$Q(1-pageno&1) $10[Microprogramming Exercise]$x>7.3"
=$Q(1-pageno&1) $O(0.2",0.4",7.2",10.5")[]
=$Q(1-pageno&1)$X0.2" $Y0.20" $G i3e7.1"
=$Q(pageno&1) $X0.6" $Y0.20" $G i3e7.1"
=$pageno=pageno+1
=$C
=$OddEven

$D.format dualcol
=$TexH=10.5"
=$Q(NewChap) $b1 $u(0.02",0.08")$17[$ChapTitle $ $ ] $NewChap=0 $TexH=TexH-1"
=$O(0   ,10.5"-TexH,3.4",TexH)[]
=$Q(Pic) $X0 $Y(10.5"-TexH+YTrap+0.1") $G i4e7.1"s(PicH)w7.1"n(PicH)
=$Q(Pic) $Y(10.5"-TexH+YTrap+PicH-0.1") $10[$PicTitle] $b^0
=$Q(Pic) $O(3.7",10.5"-TexH,3.4",Ytrap)[]
=$Q(Pic) $O(0,10.5"-TexH+Ytrap+PicH+0.2",3.4",TexH-Ytrap-PicH-0.2")[]
=$Q(Pic) $O(3.7",10.5"-TexH+Ytrap+PicH+0.2",3.4",TexH-Ytrap+PicH-0.2")[]
=$Q(1-Pic) $O(3.7",10.5"-TexH,3.4",TexH)[]
=$Pic=0
=$C
=$dualcol

$D pages
=$OddEven
=$dualcol

$D picture(title,height)
=$Ytrap=Y $Pic=1 $PicTitle='$title' $PicH=$height $C
$D chapter(title)
=$NewChap=1 $ChapTitle='$title' $C.OddEven
$D section(title)
=$b2,1" $14$u[$title] $b0.5
$D item='$k183 $x*+0.1"'

$J1 $Times12
$T=0.25",0.5",0.75",1",1.25",1.5",1.75",2",2.5",3",3.5",4",4.5",5",5.3"
$pageno=0

$pages
$chapter'Introduction'
$p0
The purpose of this exercise is to give you an opportunity of doing some more
experiments in the area covered by the lecture course Computer Structures I.
Hardware Laboratory covered the subjects related to the design of
digital circuits. Here we will concentrate on the area starting immediately
below machine language programming.
$p1
The task will be to write a microprogram that will 
run on a specialised graphics hardware (microprogramming level) and will
interpret a simple graphics protocol (machine language level)
$b0.5 $picture('System configuration',4.35")
The microcode
is almost completely horizontal, which gives direct control over the
separate functional blocks of the microprogrammed hardware.
$p1
The exercise is based on a two-processor configuration of the APM,
where a dedicated, microprogrammed graphics
processor performs specialised tasks on behalf of the user processor.
The configuration of the system is shown on the illustration below.
$section'What is to be done'
The minimum system which you
should design, implement and demonstrate is the one in which the user
processor can display and manipulate multiple windows with single-font 
text in them. This involves the specification of the protocol to be
used between the processors and subsequent implementation of subsystems
on both sides: the interpreting microcode and the user support software.
$p1
The following chapter describes an example protocol with applications
and some of its technical details. If you do not feel like designing
your own, choose the necessary subset of constructs from there.
Remember that the main target of the exercise is writing working
microcode and not designing graphics protocols.
$p1
The next chapter contains the description of the hardware to be used.
Programming details of the devices should be consulted with
the AMD Bipolar Microprocessor Logic and Interface Data Book, copies
of which can be found in the Hardware Laboratory on the sixth floor.
$section'Simulation'
As there may be some difficulties with providing more than one physical kit,
most of the microcode development should be done using a simulator, which
can be run on any APM in the Machine Halls, and which should become
available during the first week of the term.
$section'Submission'
$p1 You are encouraged to work in pairs, preferably the same ones as
in the Laboratory. Reports however have to be submitted individually.
$p1
This is to consist of the following:
$b1
$item[Demonstration of the working system in week $ $ $ $ $ $ of the term
]
$b0.5
$item[Listing of well commented source of your microcode
]
$b0.5
$item[Detailed description of how your microcode works and how to run the
demonstration.
]
$b0.5
$item[Description of the protocol which you have implemented and that of the
supporting system.
]
$b5
Remember to permit all the necessary files! $b^5
$U(0.03",0.1")[Deadline: 10:00, Friday, 30 May 1985] $b^0
$chapter'Graphics Interpreter'
$p0
This chapter describes a simple structured interface
between the applications programs, system utilities and user interface
modules on one side and the graphics support component of the system
on the other. The interface fits easily into a 
variety of applications through supporting structured hierarchical dependencies
of objects both between and within the applications. 
It provides flexible workspaces for the
individual applications while presenting a manageable and uniform
front to the graphics support subsystem. 
$p1
The interface is a directed graph, residing in the main system memory
where client processes in the system can manipulate their own allocated
sections on one side and a separate evaluation process caters
for the creation of the resulting images on the other as shown in a
paraphrase of a windowing system below. 
$b0.5 $picture('Windows',2.6")
$p0 The evaluation process
can be viewed as a function taking the graph as an argument and producing
the image as a value with the "propagation time" through the function
dependent on the performance of the graphics subsystem. 
$p1
The top part of the graph is usually under the supervision of the system window
manager, while its exit edges provide linkage to applications subgraphs
running within their allocated subwindows. Such hierarchy may reoccur 
recursively
where an application may have its own subwindow manager maintaining its
menu, workspace and other areas of activity.
$p1
The image is computed through a depth-first scan of the descriptor structure,
where for each of the nodes, its local evaluation environment is saved,
prior to following any of the downwards edges, and subsequently restored 
on return. The ordering of the exit edges defines the eventual overlap of
the graphical objects created by their execution.
Evaluation is terminated after the execution along the last vertical
edge of the node, at which it was invoked, thus allowing nested invokation
of selected substructures.
$p1
The speed of generating new images is strongly
dependent on the complexity of the graph and
on whether the evaluation process has to share the processor with other
processes, or it can have its own customised evaluation engine.
Depending on certain properties of the graph, like being acyclic or even
a tree, various optimisation techniques allow for only parts of the
graph to be scanned, still yielding a valid picture.
$Section'Graph construction'
The graph is constructed out of fixed-format nodes with two exit edges:
a $I[vertical] and a $I[horizontal] one. The vertical
edge is used to represent image hierarchy and the horizontal edge
supports linkage of multiple image components at the same level of
hierarchy.
$p1 Leaf nodes in such a directed binary graph i.e. those with no vertical 
exit edges are generally
responsible for the final drawing operations, and they can invoke 
operations like filling a polygon, drawing a stright line, drawing a
string of characters etc. These are executed with the necessary current
environmental attributes like: colour, font, scaling, clip boundaries etc. 
Some of the drawing
operations can have impact on the environment, like deposition of
character strings moves the working coordinates along the string baseline.
$b0.5 $picture('Format of the node',2.45")
$p0
Non-leaf nodes are generally responsible for the composition of the picture
out of subordinate ones as well as for the necessary modifications of the
environment, like coordinate manipulations, colour and font selection etc.
Some of these operations, like moving or scaling are cummulative
along the vertical paths in the graph; others like font or colour selection
are nested.
There are also some general control nodes, which allow the user
to exercise control over the evaluation process.
$p1
Each binary node consists of 11 consecutive half-words, where
the first two bytes contain the instruction code and the execution flags
of the node. They are followed by a long-word of argument field, and
then two long-words, where on exit, the evaluation process deposits the 
relative
dimensions of the bounding box for the image subordinate to the node.
These dimensions are relative to the environmental working
$I[(workX,workY)] coordinates on the entry to the node. 
$p1
The argument field can contain
a 32-bit pointer, two 16-bit geometrical or indexing
arguments, or
for some single-argument operations only the first half-word is taken into
account.
$p1
The last two long-words contain downwards and rightwards pointers of
the exit edges, with execution flags $I[Down] and $I[Right] indicating their
validity. Flag $I[Pointer] when 1 represents indirection in fetching
of arguments.
$p1
In all following examples, nodes will be denoted with their associated opcodes
and those of the flags, which are set to 1. Values of 1
for the
$I[Down] and $I[Right] flags are indicated by the presence of the 
corresponding exit edges.
$section'Example: VLSI editor'
$p1
This section provides a short presentation of
an editor for structured design of VLSI leaf cells which has been created
around the experimental graphics interface presented in this chapter. 
The editor is a component of a major design system which
comprises a high level composition language, on-line geometric design rule
checking and automatic stretching and compaction of composition cells.
The section outlines some of the capabilities of the editor, with particular 
emphasis on the ease with
which one can produce a leaf cell cicuit design when tools such as the
appropriate representing data structure and its efficient intepreter are 
available.
$b1
$h[Editor design environment]
$p1
There are certain features of a circuit design environment which are fundamental
to the user. It must exhibit: fast interactive response, the ability to 
view the design at arbitrary geometric scales
together with a clean and comprehensive user interface.
The designer should feel intimately coupled to his design environment, with
both control and the ability to perform structured operations such as
viewing, panning and zooming at the touch of a button.
$p1
The editor is menu driven, and uses a mouse as the manipulating device. 
The mouse is used for pointing and editing individual 
objects on the screen, or as an area selector where whole groups of
objects are operated upon. The menu consists of representations of
components the designer can paint with like wires, transistors, contacts etc.
together with a set of high level functions: view, move, clone, input, 
output etc.
which he can use to operate upon and compose design layouts. 
$b0.5 $picture('Editor: Simple VLSI structures',2.5")
$p0
While operating within its own allocated window, the editor is a multiwindow
system in itself, with one menu and potentially more than one workspace
subwindow.
$b1
$h[Simple VLSI building blocks]
$p1
The basic VLSI building blocks are wires, transistors and contacts. 
Using these primitive components it is possible to construct very large scale
circuit designs.
$p1
Wires are conventionally denoted as occupying certain "layers" on the silicon.
For a simple example of NMOS technology,
these layers are  polysilicon, diffusion and metal. 
Simple VLSI constructs, like transistors or contacts
are overlaps of the approriately sized and positioned "technological"
boxes. Using these objects more complex units such as
the "RAM cell" presented in the illustration can be constructed.
$p1
The fabrication process, however, still deals with a "flattened" design, 
and during fabrication objects such as contacts and transistors lose their
hierarchical structure and become merely "etchings" carved out of the
individual layers on the silicon wafer.
$p1
The colours selected are conventional circuit design, and the video planes
correspond directly with mask layers for
separate technological phases of the circuit production process.
$p1
Node $h[Move](X,Y) modifies current environmental working coordinates
by (X,Y), prior to passing them down the vertical edge. Nodes $h[Box](X,Y)
and $h[Line](X,Y) draw a box and a line of size (X,Y) respectively,
starting from
their current working coordinates. Line drawing node has also a 
$h[Move](X,Y)
node effect on the environment, allowing sequences of lines to be drawn,
through vertical composition of such nodes.
Node $h[Colour](newcolour) defines the drawing colour for its subordinate
subgraph and node $h[Planes](enable mask) defines video planes with
permitted write operations.
Node $h[String](stringpointer) draws in current font and colour a 
string of characters starting from the current (workX,workY) to the right.
$p1
The transistor above has been built out of appropriately positioned
($h[Move]) boxes ($h[Box]) of diffusion ($h[Plane](diffusion))
and polysilicon ($h[Plane](polysilicon)).
$b1
$h[Modularity and "Recipies" for cells]
$p1
The editor allows the user to create 
generalised descriptions of component structures
where subsequently they can be 
invoked with individual parameters for each instantiation.
$p1
The building blocks in circuit design are described both in terms of their
component structure and their geometric attributes, like size, shape and
orientation. For a
transistor we may have either an "etpx" (polysilicon in the x-direction)
or an "etpy" (polysilicon in the y-direction). Both these objects
share the same component structure but possess unique positioning parameters. 
We may think of an analogy
of a "recipe" which describes how to construct an object
and a list of "ingredients" which uniquely define each object type. By
partitioning the component description in this fashion it is possible to
perform geometric transformations such as scaling and rotation without
having to generate an entire component data structure each time. One merely
has to provide a new list of ingredients.
$b0.5 $picture('Variations of a transistor "recipe"',2.5")
$p0
Nodes in the structure can obtain any of their two 16-bit arguments
through indexing into the current environmental argument array.
Execution flags $h[indexA] and $h[indexB] indicate whether
the first and the second half-word of the argument (possibly obtained
indirectly for $h[Pointer]=1) are the final arguments or indexes into
such array.
$p1
The array itself is declared by a node
$h[Setarguments](array pointer) where the new array pointer replaces
the one inherited from above for the subordinate subgraph of the declaration
node.
The construct provides the subgraphs which can be used like drawing
procedures in several places in the graph.
$p1
In the example, the fixed-dimensions description of a transistor
from the previous page has been replaced by a "recipe" for a simple transistor,
where explicit dimensions have been replaced by indexes into a fixed-format
array. Various effects like rotation and size variations can be obtained
through appropriate swopping or variation of values in the individual
declarations of argument arrays prior to "calling" the transistor drawing graph.
$b1 $h[Replicated composition]
$p1
Examining a very large scale integrated circuit layout one observes
that it consists of clearly distinguishable cells (memory cell, 
ALU cell, data path cell etc.. ). There is also a certain 
regularity of pattern within each cell itself. This regularity is created
by a repetition of basic cell subsystems, a prime example being the generation 
of a memory cell. Here the designer defines a basic single bit memory 
subsystem (seen here left top in the background)
and subsequently creates a complete memory cell by abutted replication
of the subsystem cell in both X and Y directions (top subwindow).
A programming analogy is the 2-dimensional array and the algorithm
analogous to nested iteration cycles.
Such nested, 2-dimensional composition will usually incorporate circuitry
required at the edges of the array. In the example
the ram interface cell has been designed and deposited on the right after each
iteration in the X direction (bottom subwindow). 
$p1
This ability to iterate in the X and Y direction is a very important tool
for the circuit designer. It facilitates design creation and alleviates the
task of verifying a complete circuit cell, since if the subsystem cell is
geometrically correct and the abutting interface is also correct then the
entire cell is geometrically correct. 
$p1
Prior to descending along the vertical edge (for $h[Down]=1) the evaluation
process checks whether the $h[iteration] index in the current environment
is greater than zero and if not, the downward evaluation is not entered.
There are two nodes that control the value of the $h[iteration] index in
the environment. 
$h[Setiteration](number) provides nested presetting of the index
and $h[Deciteration] decrements it along the vertical edges.
$p1
In order to perform an iterated invokation of a subgraph (here 
of a subgraph drawing a RAM cell) we have to set the iteration index
above the graph and then create an iteration loop with decrementation of
the index in it. In the example, a $h[Move] node is placed immediately
to the right of the cell, allowing the cells to be placed side by side.
It is followed downwards by a $h[Deciteration] node, pointing in turn
down back at the memory cell.
This whole construct is then connected to the interface cell on the right
and embedded in the Y iteration construct above it.
$b0.5 $picture('Iteration',2.5")
$b1
$h[Virtual coordinates and design inspection]
$p1
Having adopted the structured design approach the circuit designer is free
to concentrate on individual leaf cell creation. These leaf cells can
be quite large and complicated and in most cases extend
beyond the domain of the visible design workspace. By providing functions
such as panning and viewing the editor offers a much larger virtual design
workspace and uses the graphics screen only as a viewport into the design. 
$p1
The designer may then, during an editing session, view and edit sections of 
the layout at arbitrary design scales. 
Although each of the design subwindows can show sections of the same design 
in different scales, the whole of the design is represented and manipulated
in its virtual coordinates, here being equal to 1/8 lambda 
(a conventional design dimension unit where its mapping onto real dimensions
reflects the resolution of production technology).
$p1
In the example the background window shows a simple 8x4 memory array
reduced 4x, the next window with 2x reduction allows inspection
of RAM cells abbutment and the top window, with 1.5x enlargement shows
the alignment details on the right edge of the array.
$p1
A $h[Dscale](factorX,factorY) declares the environmental deferred scaling 
factors in X and Y for the subordinate subgraph. The operation is not
cummulative and there should be no more than one such node in each vertical
path in the graph.
The factors provide independent scaling in both axes, and do not take
effect immediately, allowing for unscaled composition of objects in their
virtual coordinates. They are applied only by the final drawing nodes
prior to creating them on the screen. Within these nodes clipping
is performed still in virtual coordinates.
For that reason the only immediate effect of 
declaring a deferred scaling, remapping of the clipping
environment from above into the virtual coodinates below.
$p1
An inspection viewport into a design is created by vertically composed
declarations of its position ($h[Move]), size ($h[Clip]) and viewing
scale ($h[Dscale]). The node $h[Move](-vX,-vY) below expresses in
designs virtual coordinates the positioning of the left bottom corner
of the viewport. All the viewports share the same global design structure.
Such "geometrical" viewing should be distinguished from "structured"
viewing, where the viewport can point at the selected subgraphs within the
design (the oblong window on previous page was in fact drawn by pointing
just below Y iteration loop in the global design of RAM array).
$p1
It is also worth noticing that the presented order of $h[Clip] and
$h[Dscale] nodes fixes the physical size of the viewport, decreasing
the amount of details as scaling factors increase.
Swopping of these two nodes would result in a constant amount of detail
and a growing viewport as the clipping would now be defined in the design's
virtual coordinates.
$b1
$h[Bounding boxes, cursors and pointers]
$p1
One of the major components of the screen in an interactive graphics
system is the representation of a pointing device and cursor operations,
marking the areas occupied by the selected objects.
$p1
In the example the pointer is implemented as a $h[Template](pointer)
drawing node, which takes a bit-map representation of a shape (here a hand)
in the memory and deposits it, with current colour, at the position 
indicated by the current working coordinates.
Normally, it will be placed under 
$h[Colour](pointercolour) and
$h[Move](mouseX,mouseY) nodes. Such constructs are usually placed as
the last horizontal link within the window structure. It may appear on
the very top of the graph, providing general pointing capability
on the screen. Others may be linked within the applications windows,
with appropriately zeroed and clipped mouse coordinates supplied as
arguments.
$p1
A $h[Cursor](cursorpointer) node provides a nested declaration of
a graph to be used for drawing cursors. Cursorpointer points at the
top of the graph, which assumes a predeclared 4-element argument array
with the format of a node bounding box information field.
$p1
The evaluation process upon return to the node from the downwards evaluation
updates the node bounding box information, being the cummulative effect of
executing the node and the subordinate graph.
This information is stored as dimensions relative to the
working coordinates upon entry to the node.
Having updated the bounding box information and
upon seeing execution flag $h[Cursor] set to 1 the evaluation process
calls the current cursor drawing graph with the environment in which the
current argument array had been replaced by the node bounding box
definition field.
$p1
The construct allows to create individual cursors for various applications
with manipulation of flags being the only cost of invoking them.
Text strings can be underlined on their baseline by a small downwards 
$h[Move](0,-1), vertically composed with $h[Colour](cursorcolour)
and two horizontally linked
$h[Line,idxA](0,0) and $h[Line,idxA](2,0) nodes.
To underline a string just below its lowest descendent it is enough
to add a vertically composed $h[Move,idxB](0,1).
Similarly, full background and framing cursors can be defined.
$p1
Bounding box information is also used by the VLSI editor for joining of
cells, where the $h[Move] positioning individual RAM cells
picks up its arguments from the top node of the cell.
Similarly, the positioning of the interface cells at the end of
X iteration loop obtains its Y argument from the node on top of the loop.
$p1
Variation in fonts is achieved through a nested $h[font](fontpointer)
node, which declares a pointer to an array of 256 short integers 
being offsets to templates of individual characters within the font.
$b1
$h[Nested windows and structured addressing of objects]
$p1
All of the examples have been developed within nested windowing environments.
$p1
A window can be defined by specifying its relative position 
($h[Move](Xbase,Ybase)),
its size ($h[Clip](Xsize,Ysize)) and background colour ($h[Colour](background)).
The construct can be nested, where subwindows can be used to host
different areas of activity maintained by the application process within the
window.
$p1
The portrait of a dog in window 1 was brought in as a $h[Template] in yellow.
Window 2 contains two subwindows 2A and 2B, and the greyscale picture
in window 3 has been brought in by a $h[Pixels](pointer) node from
the main system memory. 
$p1
The task of identfying an object addressed by the mouse coordinates
can be split into two basic tasks. The first one is the identification of the
nodes in the graph with bounding boxes covering these coordinates.
It involves a fairly simple top-down scan of the graph, where its vertical
edges are followed only for the nodes containing the pointer address.
Such scanning creates vertical paths in the graph, where more than one
distinct path will be created for the pointer contained in more than one
hierarchically unrelated nodes. 
Example positioning of the pointer creates only one path, which is depicted
by invoking a framing cursor for all the nodes containing it.
Positioning of the pointer
on "W" in window 2B would create 3 such paths.
$p1
The second task is the identification of a node within the paths,
where the active window identity, and the application running
within it perform the final selection.
$b1
$h[Dual buffering]
$p1
The system assumes the use of a dual buffering technique for most
of the applications, where a new image is being created outside the currently
visible area of the framestore, and upon completion is swopped onto the
screen during the nearest vertical flyback. The technique assumes 
framestore memory size to be at least twice the size of the amount
required to support one visible frame.
There are different methods of partitioning such memory: geometrically
in X or Y through framestore offset registers,
or by mapping different sets of planes into the video output.
$p1
In the example two 768x512 pixel buffers are fitted one above the other
in a 1024x1024 framestore.
Top $h[SetXY](baseX,baseY) node of the structure places the absolute
evaluation coordinates (workX,workY) in relative (0,0) coordinates
of one of the frames. A $h[Clip](768,512) node below it protects
the neighbouring, displayed frame and points vertically to the image
definition graph.
Having completed evaluating the main graph, a $h[FlybackY] node
witholds the continuation to the right until the nearest frame
vertical flyback, when the $h[Pan](baseX,baseY) through
framestore offset registers puts the display area over the newly evaluated
frame. $h[SetXY] and $h[Pan] nodes indirect into a 2-element offset
definition, where location X remains at 0 and Y is alternatively swapped
between 0 and 512.
$b1
$Section'Arguments and data structures'
$b2
$item[All pointers are 32-bit integers, interpreted as absolute 
byte addresses in the machine address space.
]
$item[Additive/subtractive arguments are represented as 16-bit 2's 
complement integers.
]
$item[Scaling factors are signed 16-bit numbers with
binary point between bits 7 and 8 of the word.
]
$p1
There are a number of data structures that can appear as arguments in the
nodes.
$b1
pixelmap $t*4[is represented by 2 16-bit words specifying the width and the
height of the map, followed by the map itelf, stored as width-long
sequence of 1 pixel-wide vertical lines; one byte per pixel.
Following the increasing addresses
of the representation pixels will be drawn on the screen from bottom upwards, 
with consecutive vertical lines appearing to the right of their predecessors.
]
$b1
template $t*4[consists of a 4 half-words header followed by
the bitmap of the template.
The half-words 0 and 1 contain template offsets in X and Y from the current 
working coordinates and half-words 2 and 3 specify width and height
of the template. 
Offsets are primarily used for positioning templates of the
characters relatively to the baseline and the in-line horizontal positioning
coordinate. They will be usually 0 for non-character type templates.
The template itself is stored as 
(width/16 + 1)-long sequence of height-long vertical strips. Following the
increasing addresses in the representation, individual strips will be drawn
on the screen from bottom upwards, with most significant bits on the left.
Consecutive strips are placed to the right of their predecessors.
]
$b1
font $t*4[is stored as a list of templates for individual characters.
Such list of templates is preceeded by an
array indexed by the codes of characters and containing pairs of short
integers.
The first integer in each pair
contains offset from the base of array to the template of the corresponding
character and the second contains the formatting width of the character.
Entries of 0 in the first element of the pair indicate characters for which
templates have not been defined in that particular font and their
occurence is used by the protocol as one of termination conditions 
when drawing character strings.
Width of the character represents the distance to the base of the
next character to the right.
]
$b1
arrays $t*4[are always 1-dimensional short-integer arrays, with the
lowest element having index 0.
]
$Section'Evaluation environment'
$p1
Each node is executed within the environment inherited from the previous node,
and it may modify this environment prior to passing it to the next nodes: down, to
the right or up.
$p1
The environment consists of:
$b1 colour $t6 current colour for the subordinate drawing nodes
$b1 planes $t6 a mask of planes with enabled write operation for the 
subordinate drawing nodes
$b1 (workX,workY) $t6 a pair of current working coordinates
$b1 (bblX,bbbY) $t6 left-hand bottom corner of the image bounding box
$b1 (bbrX,bbtY) $t6 right-hand top corner of the image bounding box
$b1 (cblX,cbbY) $t6 left-hand bottom corner of the environmental clipping
box
$b1 (cbrX,cbtY) $t6 right-hand top corner of the environmental clipping box.
$b0
Clip boundaries are the intersection of all the clipping boundaries set by
the clipping nodes above the current position. Deferred scaling node
maps them (division) into the virtual coordinates of the subordinate image.
$b1 (basX,basY) $t6 absolute starting point of the evaluation.
$b1 (refX,refY) $t6 current (0,0) reference point for nodes using absolute
positioning coordinates.
$b1 (dscaleX,dscaleY) $t6 A deferred scaling 
factor provided to support virtual to physical coordinate transformation. 
Deferred factor is applied to the coordinates and arguments in drawing
nodes, thus alowing the construction of the image above them to be expressed
in the virtual design coordinates.
Deferred scaling factor applies immediately only to the inherited
clipping coordinates, where reverse scaling of environmental coordinate 
information allows to implement physical clipping of images expressed in virtual
coordinates. Clipping in virtual coordinates is achieved through
positioning deferred scaling node above the clipping nodes.
$b1 iteration $t6 factor which must be greater then 0 for the interpreter
to follow the vertical exit edge from the node.
$b1 fontbase $t6 pointer indicates the base of the current font to be
used in all the subordinate string drawing operations.
$b1 argument array $t6 points to a one-dimensional array of shortwords
which can be used as arguments in the subordinate graph.
Entering the same subgraph with different array of arguments, is similar
to the passing of arguments to a drawing procedure.
Such subgraph should contain appropriate index flags set
for the nodes to which such arguments are
to be passed and appropriate array indexing information in its argument fields.
$b1 cursor $t6 points to a graph
currently responsible for drawing of cursors. Nodes of such graph
will be usually designed to pick up arguments from the environment
which invoked the graph.
$section'Summary of node format'
$b1
Byte 0 of half-word 0 contains the instruction code.
$b1
Byte 1 contains flags, part of which parameterize the execution of
the instruction or of its subordinate subgraph.
$b0
Flags (Optimise,Wait,Pointer,IndexA,IndexB,Cursor,Down,Right) correspond to
bits [7:0] of the byte.
$b1
Optimise $t3 flag invokes optimised evaluation of the subordinate graph,
where the interpreter will follow only those vertical edges, where
the bounding box of the image is expected to intersect with the current 
clipping box.
Such evaluation, although fairly simple to maintain at the top level nodes
e.g. with multiwindow textual displays becomes more complicated for
more sophisticated structures and may require significant monitoring of
differential changes in the graph.
$b1
Wait $t3 when 1 forces the interpreter to execute a partial completion
sequence and halt immediately after executing the return phase of the node.
$b1
Pointer $t3 flag when 0 indicates that arguments are stored immediately
in the instruction starting with halfwords 2 and 3.
For Pointer=1 halfwords 2 and 3 form a 32-bit argument pointer.
$b1
IndexA $t3 flag when 0 indicates that argument A is directly accessible
immediately or through a pointer, depending on the Pointer flag.
IndexA=1 signals that the value obtained through such access
is the argument index in the current argument array 
(See the description of individual nodes for
the declaration of the current argument array). 
$b1
IndexB $t3 has the same function as IndexA but applies to argument B.
$b1
Cursor $t3 flag set to 1 results in temporary replacement of the
current argument array pointer with a pointer to the bounding box
coordinates of the node, followed by a call to the
current cursor drawing graph.
$b1
Down $t3 flag indicates that half-words 7 and 8 contain a valid pointer
to the first instruction of a chain in the subordinate subgraph.
For Down=0 the interpreter will execute return phase of the instruction
without entering the evaluation of the subordinate graph.
Down=1 will be ignored for the iteration index in the current environment
being 0.
$b1
Right $t3 indicates that half-words 9 and 10 contain a valid pointer
to the next of horizontally linked chain of instructions. 
Upon encountering Right=0
the interpreter will execute the "return" part of the instruction
which invoked the currently terminated chain. Right=0 encountered at
the level at which the evaluation was invoked will terminate the evaluation.
              
The flag can be used for temporary disabling of manipulated parts of the 
picture. When modelling execution of a command stream
the Right=0 marks the last instruction of the stream.
$p1
Half-words 1 and 2 contain information about the arguments for the node,
subject to interpretation under flags Pointer and Index.
$p1
The node contains also the information about the bounding box of the
subordinate picture.
This information, depending on the invoked mode of evaluation can be:
$b1
$item[updated by the evaluation process through the evaluation of the
subgraph
]
$b1
$item[used by the evaluation process during the optimised evaluation
where subordinate images with bounding boxes outside the clipping 
coordinates are not evaluated.
]
$b1
Bounding box coordinates relative to the current working (X,Y) coordinates
of the interpreter are stored in half-words 3-6. Half-words (3,4) and
(5,6) contain (X,Y) coordinates of left-hand bottom and right-hand top
corners of the box.
$section'Nodes of the graphics data structure'
$b1
In the following descriptions arguments
of operation are shown in $i[italics] and represent values
obtained from half-words 1 and 2 through appropriate interpretation of
flags Pointer and Index.
$b2
$h[Non-drawing, environment modification nodes]
$b1
$h[FONT]($i[fontbase])
$b0
The subordinate graph will use the font starting at $i[fontbase].
$b1
$h[COLOUR]($i[colour])
$b0
$i[colour] becomes the colour for all the subordinate drawing operations.
$b1
$h[PLANES]($i[mask])
$b0
Planes indicated by 1's in $i[mask] will be enabled for writing in the
subordinate graph.
$b1
$h[RASTER]($i[rasterpointer])
$b0
In the subordinate graph the raster at $i[rasterpointer] will be used as a 
raster by all the area-filling operations. The initialisation raster is:
(16,1,16_FFFF) resulting in complete fill of the area.
$b1
$h[CURSOR]($i[cursorpointer])
$b0
$i[cursorpointer] points the top node of the cursor drawing structure
for the subordinate nodes.
$b1
$h[ARGUMENT]($i[arraypointer])
$b0
$i[arraypointer] points to the first element (indexed 0) of the argument array
for the subordinate nodes
$b1
$h[CLIP]($i[sizeX,sizeY])
$b0
Clipping in a rectangle of size ($i[sizeX,sizeY]), starting from the
current position. As an environmental attribute subject to retrospective
inverse scaling by the deferred scaling node.
$b1
$h[REFPOINT]($i[refX,refY])
$b0
Current X and Y coordinates modified by $i[refX] and $i[refY] become
a reference (0,0) point for the absolute (X,Y) arguments used by the
subordinate nodes.
$b1
$h[MOVE]($i[modX,modY])
$b0
Current X and Y coordinates are modified by $i[modX] and $i[modY] 
respectively. $i[modX,modY] may have to be prescaled by the current
immediate scaling factors.
$b1
$h[MOVETO]($i[absX,absY])
$b0
Current X and Y coordinates are moved to $i[absX,absY] relative to the
current reference point.
$b1
$h[DSCALE]($i[factorX,factorY])
$b0
Declaration of deferred scaling. Excludes presence of any other scaling
nodes in any of the vertical paths containing this node.
$b1
$h[SETITERATION]($i[iteration])
$b0
Declares iteration index $i[iteration] for the subordinate picture.
During execution flag "Down" is ignored if iteration index in the
environment is 0.
$b1
$h[DECITERATION]
$b0
Decrements iteration index in the environment.
$n
$h[Drawing nodes]
$p1
Drawing nodes are responsible for the final drawing operations.
In most applications they will appear as leaf nodes (flag Down=0) and
the evaluation will subsequently move to the next horizontally linked node or
to the return phase of the node above.
$b1
$h[BOX]($i[Xsize,Ysize])
$b0
Fills with current colour a box of size ($i[Xsize,Ysize]), starting at current 
evaluation coordinates. Evaluation coordinates for X and Y are modified
by $i[Xsize] and $i[Ysize] respectively.
($i[Xsize,Ysize]) are subject to scaling by the cummulated immediate or by
the deferred scaling factors.
$b1
$h[BOXTO]($i[absX,absY])
$b0
Similar to $h[BOX] but the fill area is defined by its corners: one in
current evaluation coordinates and the other ($i[absX,absY]) away from
the current reference point.
$b1
$h[POLYGON]($i[argumentlist])
$b0
Fills with current colour a polygon starting at current evaluation
coordinates and outlined by consecutive relative movements specified in
in $i[argumentlist].
$b1
$h[LINE]($i[Xsize,Ysize])
$b0
Draws a straigh line from the current evaluation coordinates to a point
distant by ($i[Xsize,Ysize]).
$b1
$h[LINETO]($i[absX,absY])
$b0 Similar to $h[LINE] but in absolute coordinates
$b1
$h[TEMPLATE]($i[template])
$b0
A pattern defined by the template is filled with current colour at the
current evaluation coordinates. 
$b1
$h[PIXELMAP]($i[pixelmap])
$b1
$h[STRING]($i[stringpointer])
$b0
Draws in current colour and with current font a string of characters.
Interpretation continues up to a character defined as a terminator by
the selected font.
$b1
$h[VSTRING]($i[stringpointer]), $h[BSTRING]($i[stringpointer])
$b0
Draw strings of characters using fonts from VISUAL200 and Perkin Elmer
terminals.
$b2
$h[Control nodes]
$b1
$h[FLYBACKY]
$b0
Withholds execution of the following instruction till the beginning of the
nearest framestore vertical flyback. Most of the following instructions 
require such synchronization.
$b1
$h[COLOURMAP]($i[colourmappointer])
$b0
Consecutive locations of the framestore colourmap are loaded with the
consecutive store values starting at $i[colourmappointer]. 
8-bit intensities for  red, green and blue
are represented by bits [7:0], [15:8] and [23:16] of 
consecutive 32-bit words.
$b1
$h[SETXY]($i[Xoffset,Yoffset])
$b0
Explicitly sets $h[X] and $h[Y] evaluation coordinates.
Intended for support of dual-buffering scheme with two such nodes
used alternately as entry points to the structure.
$b1
$h[PAN]($i[Xoffset,Yoffset])
$b0
Left-hand bottom corner of the display will is placed at 
(($i[Xoffset]/16)*16,$12(Yoffset)) in the framestore. Can be used with
$h[SETXY] and $h[FLYBACKY] to implement dual-buffering.
$b1
$h[DEPOSITENV]($i[environmentpointer])
$b0
This node deposits at the location indicated by the [environmentpointer]
the contents of its current working environment.
$b1
$h[PICKUPENV]($i[environmentpointer])
$b0
Partial evaluation of the structure starting from a chosen node
may be invoked through setting up the working environment to that of
the current environment of the node from the previous full evaluation.
$i[environmentpointer] will be usually the same as in $h[DEPOSITENV]
node which should preceed the chosen entry node in the structure.
Such optimised evaluation can be invoked when activities are
concentrated within the topmost windows.
$b1
$h[CALLMICRO]($i[microaddress])
$b0
Sections of new microcode can be invoked,
through a call to a chosen microcode location. This would usually
refer to additional, loadable microcode memory.
In case of partial replacement (e.g. when trying out new instructions)
proper care should be taken of the consistency of the stacks (main
and microinstruction one).
$b1
$h[CLEAR]
$b0
Resets the evaluation stack pointer. Should be invoked after abnormal
completion.
$b1
$h[REPORTADDR]($i[reportpointer])
$b0
Sets $i[reportpointer] as destination for $h[REPORT] nodes.
$b1
$h[REPORT]($i[reportvalue])
$b0
Will deposit $i[reportvalue] at the location $i[reportpointer].
Can be used to trace the progress of evaluation.
$b2
$18(Interaction between the user processor and the interpreter)
$p1
After initialisation, as well as after each completed evaluation the graphics
processor-interpreter puts itself into a wait state. 
$b1
The process requiring the evaluation should set up all the necessary
startup environment including the required action on completion 
(e.g. $h[REPORT] node) and then wake up the graphics processor through
a write into location E04000.
$b1
The processor picks up from the environment its starting execution pointer
and performs depth-first scan of the structure. It will halt upon completion,
upon encountering flag Wait=1 or upon invalid opcode.
$b2
$h[Startup environment]
$p1
Local graphics processor memory is under addresses 16_E0E000-16_E0FFFE
in the APM address space.
$b1
$h[$i0 address $t3 attribute $t9 description]
$b1
$i0 E0E000 $t3 Execution pointer $t9 Prior to evaluation should be loaded
with a pointer to the required entry node (or to the first command in stream
execution). During evaluation it contains the current execution pointer.
$b1
$i0 E0E004 $t3 Execution flags $t9
$b1
$i0 E0E006 $t3 Current colour $t9 Contains current colour.
$b1
$i0 E0E008 $t3 Current planes $t9 16-bit mask with 1's indicating planes
with enabled write operation
$b1
$i0 E0E00A $t3 Current X $t9 Current working X coordinate
$b1
$i0 E0E00C $t3 Current Y $t9 Current working Y coordinate
$b1
$i0 E0E00E $t3 Bounding box $t9 left X coordinate
$b0
$i0 E0E010 $t9 bottom Y coordinate
$b0
$i0 E0E012 $t9 right X coordinate
$b0
$i0 E0E014 $t9 top Y coordinate
$b1
$i0 E0E016 $t3 Clipping box $t9 left X coordinate
$b0
$i0 E0E018 $t9 bottom Y coordinate
$b0
$i0 E0E01A $t9 right X coordinate
$b0
$i0 E0E01C $t9 top Y coordinate
$b1
$i0 E0E01E $t3 base point $t9 X
$b0
$i0 E0E020 $t9 Y
$b1
$i0 E0E022 $t3 reference point $t9 X
$b0
$i0 E0E024 $t9 Y
$b1
$i0 E0E026 $t3 deferred scaling $t9 X scaling factor
$b0
$i0 E0E028 $t9 Y scaling factor
$b1
$i0 E0E02A $t3 Iteration index $t9 Iteration index can be explicitly set
or it can be decremented. When 0 it inhibits evaluation of the subgraph of
the node.
$b1
$i0 E0E02C $t3 current font $t9 Current font pointer contains the address
of the base of the current font definition.
$b1
$i0 E0E030 $t3 Argument array $t9 It is a pointer to the base of the current
argument array.
$b1
$i0 E0E034 $t3 Cursor $t9 Cursor pointer addresses a graph currently used
for drawing cursors. Such graph will usually contain indexed argument
references in the array defining the bounding box of the image.
$E*
