Signetics 2650 & 2636 programming/Objects

=Tutorial — Objects=

The most powerful feature of the PVI are its four reprogrammable objects. Several sources cite this Signetics chip (c.1977) as being the first commercially available hardware implementation of a memory mapped object on a video chip.

Tutorial code
The code for this tutorial can be found at Tutorial code - objects. It generates the static screen shown here. There are four objects, 1,2,3 and 4 in different colours and sizes. There are also duplicates of objects 1, 2 and 4.

This is the section of code that programs these objects. It is taken from the list file created by the WinArcadia assembler: ;set the colour of the four objects: 002D 0403    :        lodi,r0 %00000011 002F CC1FC1  :        stra,r0 colours12	    ; obj 1 white, 2 red 0032 0429    :        lodi,r0 %00101001 0034 CC1FC2  :        stra,r0 colours34	    ; obj 3 green, 4 yellow

; set the size of the four objects: 0037 04E4    :        lodi,r0 %11100100 0039 CC1FC0  :        stra,r0 objectsize

; load the shape and size of the four objects: 003C 070E    :        lodi,r3 $0E :loopISe: 003E 0F4059  :        loda,r0 one,r3- 0041 CF7F00  :        stra,r0 shape1,r3 0044 0F6067  :        loda,r0 two,r3 0047 CF7F10  :        stra,r0 shape2,r3 004A 0F6075  :        loda,r0 three,r3 004D CF7F20  :        stra,r0 shape3,r3 0050 0F6083  :        loda,r0 four,r3 0053 CF7F40  :        stra,r0 shape4,r3 0056 5B66    :        brnr,r3 loopISe Lets look at each part in turn.

Colour
The pixels within one object are all the same colour. The colour of each object is set by three bits (giving a choice of eight colours) in the PVI registers at $1FC1 and $1FC2.

The program sets: $1FC1 = 00000011 = 00 000 011 =  white  red $1FC2 = 00101001 = 00 101 001 =  green  yellow

Size
The size of each object can be set independently to one of four different sizes. Each object can have a height of either 10, 20, 40 or 80 lines, and the widths are scaled similarly to 8, 16, 32 or 64 horizontal clocks. The individual pixels are not square; they are roughly twice as wide as they are tall, an important point to remember when designing shapes. The program sets: $1FC0 = 11100100 = 11 10 01 00 = x8 x4 x2 x1

Object descriptors
The shape and position of the four objects are each defined by 14 registers called an object descriptor, comprised, in order, as 10 bytes of shape data, a horizontal coordinate(HC), a horizontal coordinate for the duplicates(HCB), a vertical coordinate(VC) and a vertical offset for the duplicates(VCB).

The code that programs these objects copies blocks of data from tables one, two, three, four to the object descriptors $1F00, $1F10, $1F20 and $1F40. Register R3 is used as an index register to go through a loop 14 times, on each pass setting up one byte in each of the four object descriptors.

Shape
In the ten-bytes of the object descriptor that defines the shape, and bits set to zero are transparent, while bits set to a one are displayed as the programmed colour.

Position
The position of any primary object on the screen is set by its corresponding horizontal(HC) and vertical(VC) coordinates with the origin at the top left of the screen. The coordinates can be any eight bit value, but a horizontal coordinate greater than 227 pushes the object off the right hand side of the screen, and vertical coordinate greater than 252 will be off the bottom of the screen.

Duplicates
The power of these objects comes from the fact that they can be output again further down the screen. And again and again…. In fact it is possible to have up to 80 objects on the screen at one time. These are referred to as duplicates. A duplicated object will always be below its predecessor, and they cannot overlap. The horizontal coordinate of a duplicate is simply the distance from the left edge of the screen, in the same way that the original duplicate is specified. The vertical position of a duplicate is trickier; it is set as a vertical offset from its predecessor.

It is also possible to reprogram the shape, size and colour of an object between duplicates, but that requires some real-time programming which will be discussed in a later tutorial.

Object 1 has a horizontal coordinate of 10, as do its duplicates. Its vertical coordinate is 20, and all of its duplicates are offset vertically by 20 from its predecessor.

Object 2’s duplicates are shifted 5 pixels left, and offset vertically by 10.

Object 3 is all on its own. Its duplicate has been pushed off the bottom of the screen by setting the vertical offset to 250.

Object 4’s duplicates are all touching. This is achieved by setting the offset to 255. This may seem a little odd, but if 255 is converted to 8 bit binary and then interpreted as a signed two’s complement number, we get -1. This is because VCB has to be set to “the number of lines -1” that you want to be skipped. If you want a gap of just one line, set VCB to 0 and so on.

Exercises

 * 1) Change the size of an object.
 * 2) Change shape of an object.
 * 3) Change the position of an object.
 * 4) Change the position of an object's duplicates.