$n $l1b $18 Graphics protocol interpreter $16 $p2 The processor is used as an interpreter of a graphics data structure where a directed acyclic graph residing in main system memory is used as an interface to represent and manipulate images on the screen. $b1 Leaf nodes in the graph are responsible for the final drawing operations and they can invoke operations like filling a polygon, drawing a straight line, drawing a string of characters etc. These are executed with the necessary current environmental attributes like: colour, font etc. $b1 Non-leaf (composition) nodes are responsible for the composition of the picture out of subordinate subpictures as well as for the necessary modifications of the environment. These modifications include coordinates manipulations, colour setup, font selection etc. $i0 The final picture is computed through a depth-first scan of the structure by the processor. The evaluation relies heavily on the processor local stack, where many descriptors of the environment are pushed prior to their modification when passing the node on the way down (call phase) and subsequently restored on the way up (return phase). $i0 Nodes with multiple exit edges are implemented through multiple, horizontally linked binary branch nodes, with their vertical edges corresponding to the ordered exit edges of the represented node. $p1 The nodes can be also linked into a simple linear structure, thus allowing the processor to act as an interpreter of a stream of graphics commands. Additional flags parameterizing the operation of the processor allow single-stepping and incremental creation of images. $b2 $17 $h(Arguments and data structures) $16 $b2 $a indent=1 $i0 - $t1 All pointers are 32-bit integers, interpreted as absolute byte addresses in the APM system address space. $b1 $i0 - $t1 Additive/subtractive arguments are represented as 16-bit 2's complement integers. $b1 $i0 - $t1 Coordinates of transformation vectors are 16-bit 2's complement fractions. $b1 $i0 - $t1 Scaling factors are unsigned 16-bit numbers with binary point between bits 7 and 8 of the word. $a indent=0 $p2 There are a number of data structures that can appear as arguments in the instructions. $b1 $a indent=3 $i0 pixelmap $t3 is represented by 2 16-bit words specifying the height and the width of the map, followed by the map itelf, stored as width-long sequence of 1 pixel-wide vertical lines. Pixels can contain 8 or 16 bits each and depending on the supported framestore they will be stored 2 or 1 per 16-bit word. Following the increasing addresses of the representation (and from more to less significant parts of the word) pixels will be drawn on the screen from bottom upwards, with consecutive vertical lines appearing to the right of their predecessors. $b1 $i0 template $t3 is represented by 2 16-bit words specifying the height and the width of the template, followed by the template itself, 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 $i0 fonts $t3 are stored as lists of templates for individual characters. As these templates are smaller, the size descriptor of each character is compressed into one 16-bit word, with height and width stored as more and less significant bytes respectively. A list of character templates representing a font is preceded by a 1-dimensional array of integers, indexed by the ASCII codes of characters and containing offsets from the base of array to the templates of the corresponding characters. Entries of 0 in the array indicate characters which should terminate the execution of character drawing instructions. $b1 $i0 lists $t3 are terminated by a constant 16_400. These can be lists of pairs (for 2D graphics) or triples (for coordinates in 3D space). $a indent=0 $b2 $17 $h(Instruction format) $16 $p1 Each instruction consists of 8 consecutive 16-bit half-words. $b1 Half-word 0 contains the instruction code in its more significant byte and a repetition/limit index in the less significant byte. The index can be used for iterating some of the instructions or to limit the argument fields of some other. $b1 Half-word 1 contains flags, part of which parameterize the execution of the instruction or of its subordinate subgraph. $b1 Flags (Wait,Draw,Subpic,Xsave,Ysave,Pointer,Cursor,Jump,Last) occupy bits $14(<8:0>) of the half-word. $b0 $b1 $a indent=3 $i0 Last $t3 flag marks the last instruction of a horizontally linked chain of instructions. Upon encountering Last=1 the interpreter will execute the "return" part of the instruction which invoked the currently terminated chain. L=1 encountered at the topmost level 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 flag marks the last instruction of the stream. $b1 $i0 Jump $t3 flag when set to 1 indicates that the next instruction to be executed in the current horizontal chain is pointed at by a 32-bit pointer formed by half-words 6 and 7. $b0 For J = 0, the next instruction follows immediately after the current one. $b1 $i0 Cursor $t3 flag set to 1 results in filling the cursor plane with the bounding box of the picture subordinate to the current instruction. $b1 $i0 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 pointer to the arguments stored elsewhere. $b1 $i0 Ysave $t3 flag when 1 causes the current Y evaluation coordinate to be pushed on the evaluation stack, prior to the execution of the instruction. The coordinate is popped back in the return phase of the instruction. $b1 $i0 Xsave $t3 flag has similar interpretation as Ys but applies to current Y evaluation coordinate. $b1 $i0 Subpic $t3 flag when 1 indicates that there is a subpicture, subordinate to the current instruction and the pointer to its starting instruction is held in half-words 4 and 5. $b1 $i0 Draw $t3 when 0 inhibits drawing in the subordinate subgraph. $b1 $i0 Wait $t3 flag forces the processor into a wait state immediately after the execution of the call part of the instruction. $a indent=0 $b1 Flag (Cover,) is the bit $14(<15>) of half-word 1. $b1 $a indent=3 $i0 Cover $t3 flag when 1 indicates that during the evaluation the coordinates of the pointing device were covered by the bounding box of the picture subordinate to the current instruction. $a indent=0 $n $17 $h(Nodes of the graphics data structure) $16 $b1 In the following descriptions arguments of operation represent values stored in half-word 2 and half-word 3 of the instruction, or for Pointer=1 values pointed by these half-words. $b2 $h(Composition nodes) $b1 FONT($26[fontbase]) $b0 The subordinate graph will use the font starting at $26[fontbase]. $b1 INK($26[colour]) $b0 $26[colour] becomes the colour for all the subordinate drawing operations. $b1 PLANE($26[mask]) $b0 Planes indicated by 1's in $26[mask] will be enabled for writing in the subordinate graph. The starting configuration contains 1's for all planes except the cursor one. $b1 RASTER($26[rasterpointer]) $b0 In the subordinate graph the raster at $26[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 CLIP($26[sizeX,sizeY]) $b0 Clipping in a rectangle of size ($26[sizeX,sizeY]), starting from the current position. $b1 MOVE($26[modX,modY]) $b0 Current X and Y coordinates are modified by $14[modX] and $14[modY] respectively. $b1 TRANSFORM($26[TransformPairPointer]) $b0 $26[TransformPairPointer] points at a pair of 32-bit pointers, where the first one identifies a 2x3 transformation matrix and the second points at a 2-D argument list. $b1 This and the other list oparations result in pushing the argument list onto the stack, while replacing it with its mapping through operation of the node. The list is subsequently restored in the return phase. SELECT($26[SelectPairPointer]) $b1 Selects arguments from the list pointed by the second pointer in the pair, using a list of selection indexes pointed at by the first pointer in the pair. $b2 $17 $h(3-dimensional objects) $16 $p1 Some of the instructions are designed to operate on lists of 3-dimensional coordinates. These include nodes similar to those of transformation and selection in 2-dimensional space and initially will not be described in this document. $b1 Appropriate viewing transformation of 3-dimensional objects into their images in 2-dimensional space is also necessary. It will map a list of 3-D points into a list of their 2-D images. These can be subsequently used in straight-line drawing or polygon-fill operations. $b2 $17 $h(Enquiry and optimised evaluation nodes) $16 $p1 It is possible for the process manipulating the structure (e.g. window manager) to invoke only a partial evaluation of the structure, thus speeding up the response from the graphics processor. In most cases, where the activity becomes limited only to the topmost window (e.g. running of an editor) the evaluation can be restricted only to the subgraph of that window. $b1 For that purpose the evaluation process should be given the necessary information about the starting environment. This is achieved through using a node, which instead of arguments contains placeholders for the environmental attributes at that particular point in evaluation. $b1 DEPOSITXY($26[coorX,coorY]) $b2 $17 $h(Drawing nodes) $16 $p1 Drawing nodes are responsible for the final drawing operations. Each node starting at given coordinates modifies these coordinates to the oposite end of the diagonal of the bounding box of the created picture. In most applications such instruction will be used to represent a leaf node (flag Subpic=0) and the evaluation will subsequently move to the return phase of the node above. $b1 BOX($26[Xsize,Ysize]) $b0 Fills with current colour a box of size ($26[Xsize,Ysize]), starting at current evaluation coordinates. Evaluation coordinates for X and Y are modified by $26[Xsize] and $26[Ysize] respectively. $b1 POLYGON($26[argumentlistpointer]) $b0 Fills with current colour a polygon starting at current evaluation coordinates and outlined by consecutive relative movements specified in in a list pointed by $26[argumentlistpointer]. $b1 LINE($26[Xsize,Ysize]) $b0 Draws a straigh line from the current evaluation coordinates to a point distant by ($26[Xsize,Ysize]). $b1 LINES($26[argumentlistpointer]) $b1 TEMPLATE($26[templatepointer]) $b0 A pattern defined by the template is filled with current colour at the current evaluation coordinates. $b1 PIXELMAP($26[pixelmappointer]) $b1 ASCII($26[ASCIIpointer]) $b0 Draws in current colour and with current font a string of ASCII characters. Interpretation continues up to a character defined as a terminator by the selected font or for the number of characters indicated by the limit index, whichever comes first. $b2 $17 $h(Control instructions) $16 $b1 COLOURMAP($26[colourmappointer]) $b0 Consecutive locations of the framestore colourmap are loaded with the consecutive values from the colourmap. For the 4-plane framestore, bits $14[<11:8>], $14[<7:4>] and $14[<3:0>] of 16 consecutive 16-bit words in colourmap are loaded as intensities for blue, green and red respectively. For a colour map circuit with 8-bit intensities, red, green and blue are represented by bits $14[<7:0>], $14[<15:8>] and $14[<23:16>] of a 32-bit word, with the length of the colourmap being 2$R-0.25[number of planes] of such words. $b1 FLYBACKY $b0 Withholds execution of the following instruction till the beginning of the nearest framestore vertical flyback. Most of the following instructions as well as COLOURMAP require such synchronization. $b1 SETXY($26[Xoffset,Yoffset]) $b0 Explicitly sets $h(X) and $h(Y) evaluation coordinates. Can be used for partial evaluation, where SETXY is the entry node of the partial evaluation, sharing the indirect argument field with the necessary DEPOSITXY node of the main data structure. When dual-buffering scheme is used it will be necessary to use two such argument fields. $b1 PAN($26[Xoffset,Yoffset]) $b0 Left-hand bottom corner of the display will is placed at ((Xoffset/16)*16,Yoffset) in the framestore. Can be used with SETXY to implement dual-buffering. $b1 FLIP $b0 The base of display is moved into the base of video buffer with the recently evaluated image. Evaluation coordinates are moved to the base of the dual video buffer. $b1 CALLMICRO($26[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). $b2 $17 $h(Interaction between the user processor and the interpreter) $16 $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 and then wake up the graphics processor through a write into location 00D04000. $b1 The processor picks up from the environment its starting execution pointer and upon completion, deposits the completion code in the location specified by the environment. $b2 $h(Startup environment) $p1 The location of the local graphics processor memory in the address space of the APM is set up to 00D0E000. $b1 $a indent=6 $i0 execution pointer $t6 Prior to evaluation, location (00D0)E020 contains the pointer to the topmost node of the graphics structure or a pointer to the first command of the stream. During evaluation it contains the current execution pointer, and in case of invalid opcode, it will retain the address (+2) of the offending location. $b1 $i0 completion code $t6 Upon completion of evaluation, the processor will deposit the completion code at the location picked up from 00D0E024 There are following completion codes: $b0 $h(successful): 00FF signals successful completion of evaluation $b0 $h(illegal opcode): 0010 represents illegal code encountered in one of the nodes. Execution pointer contains the address two bytes after the offending location. $b1 $i0 pointing device $t6 Locations 00D0E026 and 00D0E028 contain the X and Y coordinates of a pointing device. During evaluation the processor sets to 1 flag COVER for all these nodes, where the bounding box of the subordinate picture covers the coordinates. $a indent=0 $n $18 $h(Data sheets for the devices) $16 $e