Programmer's Guide - The TIA
The TIA
(as seen by the programmer)
1.0 GENERAL DESCRIPTION
The TIA is a custom I.C. designed to create the TV picture and sound from the instructions sent to it by the microprocessor. It converts the 8 bit parallel data from the microprocessor into signals that are sent to the video modulation circuits which combine and shape those signals to be computable with ordinary TV reception. A "playfield" and 5 moveable objects can be created and manipulated by software.
A playfield consisting of walls, clouds, barriers, and other seldom moved objects can be created over a colored background. The 5 moveable objects can be positioned anywhere, and consist of 2 players, 2 missies, and a ball. The playfield, players, missies, and the ball are created and manipulated by a series of registers in the TIA that the microprocessor can address and write into. Each type of object has certain defined capabilities. For example, a player can be moved with one instruction, but the playfield must be completely re-drawn in order to make it "move".
Color and luminosity (brightness) can be assigned to the background, playfield, and 5 moveable objects. Sound can also be generated and controlled for volume, pitch, and type of sound. Collisions between the various objects on the TV screen are detected by the TIA and can be read by the microprocessor. Input ports which can be read by the microprossor give the status of some of the various hand held controllers.
2.0 THE REGISTERS
All instructions to the TIA are achieved by addressing and writing to various registers in the chip. A key point to remember is that data written in a register is latched and retained until altered by another write operation into that register. For example, if the color register for a player is set for red, that player will be red every time it's drawn until that color register is changed. All of the registers are addressed by the microprocessor as part of the overall RAM/ROM memory space.
All registers have fixed address locations that are preassigned address names for handy reference. Many registers do not use all 8 data bits, and some registers are used to "strobe" or
trigger events. A "strobe" register executes its function the
instant it is written to (the data written is ignored). The only
registers a microprocessor can read are the collision registers and input port registers. These registers are conveniently arranged so the data bits of interest always appear as data bits 6 or 7 for easy access.
3.1 HORIZONTAL TIMING
When the electron beam scans across the TC screen and reaches the right edge, it must be turned off and moved back to the left edge of the screen to begin the next scan line. The TIA takes care of this automatically, independent of the microprossor. A 3.56 Mz oscillator generates clock pluses called "color clocks" which gc into a pulse counter in the TIA. This counter allows 160 color clocks for the beam to reach the right edge, then generates a horizontal sync signal (HSYNC) to return the beam to the left edge.
It also generates the signal to turn the beam off (horizontal blanking) during its return time of 68 color clocks. Total round trip for the electrom beam is 160 + 68 = 228 color clocks. Again, all the horizontal timing is taken care of by the TIA without assistance from the microprocessor.
3.2 MICROPROCESSOR SYNCHRONIZATION
The microprocessor's clock is the 3.58 MHz oscillator divided by 3, so one machine cycle is 3 color clocks. Therefore, one complete scan line of 228 color clocks allows only 76 machine cycles (228 / 3 =76) per scan line. The microprocessor must be synchronized with the TIA on a line-by-line basis but program loops and branches take unpredictable lenghts of time. To solve this software synchronization problem, the programmer can use the WSYNC(Wait fcr SYNC) strobe register. Simply writting to WSYNC causes the microprocessor to halt until the electron beam reaches the right edge of the screen, then the microprocessor resumes operation at the beginning of the 68 color clocks for horizontal blanking. Since the TIA latches all instructions until altered by another write operation, it could be updated every 2 or 3 lines. The advantage is the programmer gains more time to execute software, but a price is paid with lower vertical resolution in the graphics.
NOTE: WSYNC and all the following addresses' bit structures are itemized in the TIA hardware manual. The purpose of this document is to make them understandable.
3.3 VERTICAL TIMING
When the electron beam has scanned 262 lines the TV set must be signaled to blank the beam and position it at the top of the screen to start a new frame. The signal is called vertical sync, and the TIA must transmit this signal for at _east 3 scan lines. This is accomplished by writting a "1" in D1 of VSYNC to turn it on, count at least 3 scan lines, then write a "0" to D1 of VSYNC to turn it off.
To physically turn the beam off during its repositioning time, the TV set needs 37 scan lines of vertical blank signal from the TIA. This is accomplished by writting a "1" in D1 of VBLANK to turn it on, count 37 scan lines, then write a "0" to D1 of VBLANK to turn it off. The microprocessor is of course free to execute other software during these vertical timing commands, VSYNC and VBLANK.
- lighthouse's blog
- 473 reads





Post new comment