STELLA Programmer's Guide
STELLA Programmer's Guide
PROGRAMMER'S
GUIDE
by
Steve Wright
12/03/79
Table of Contents
TELEVISION PROTOCOL
(The TV picture according to Atari)
In general, the remaining 70 scan lines (3 for VSYNC, 37 for VBLANK, and
30 for overscan) will provides 5,320 machine cycles (70 lines x 76 machine
cycles) for housekeeping and game logic. Such activities as calculating the
new position of a player, updating the score, and checking for new inputs
are typically done during this time.
STELLA PROGRAMMER'S GUIDE 2
The TIA is a custom IC 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 video
modulation circuits which combine and shape those signals to be compatible
with ordinary TV reception. A “playfield” and 5 moveable objects can be
created and manipulated by software.
All registers have fixed address locations and pre-assigned 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 the microprocessor can read
are the collision registers and input port registers. These registers are conveniently
arranged so that the data bits of interest always appear as data bits 6 or 7 for easy access.
STELLA PROGRAMMER'S GUIDE 4
3.0 Synchronization
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.
To physically turn the beam off during its repositioning time, the TV set
needs 37 scan lines of vertical blanks signal from the TIA. This is
accomplished by writing a “1” in D1 of VBLANK to turn it on, count 37
lines, then write a “0” to D1 of VBLANK to turn it off. The microprocessor
is of course free to execute other software during the vertical timing
commands, VSYNC and VBLANK.
For example, if the COLUMP0 register is set for light red, both P0 and M0
will be light red when drawn.
A color-lum register is set for both color and luminosity by writing a single 7
bit instruction to that register. Four of the bits select one of the 16
available colors, and the other 3 bits select one of 8 levels of luminosity
(brightness). The specific codes required to create specific color and lum are
listed in the Detailed Address List of the TIA hardware manual. As with all
registers (except the “strobe” registers), the data written to them is latched
until altered by another write operation.
5.0 Playfield
The PF register is used to create a playfield of walls, clouds, barriers, etc., that are
seldom moved. This low resolution register is written into to draw the left half of the
TV screen only. The right half of the screen is drawn by software selection of whether a
duplication or a reflection of the right half.
The PF register is 20 bits wide, so the 20 bits are written into 3 addresses:
PF0, PF1, and PF2. PF0 is only 4 bits wide and constructs the first 4 “bits”
of the playfield, starting at the left edge of the TV screen. PF1 constructs
the next 8 “bits”, and PF2 the last 8 bits” which end at the center of the
screen. The PF register is scanned from left to right and where a “1” is
found the PF color is drawn, and where a “0” is found, the BK color is
drawn. To clear the playfield, obviously zeros must be written into PF0,
PF1, and PF2.
STELLA PROGRAMMER'S GUIDE 6
To make the right half of the playfield into a duplication or copy of the left
half, a “0” is written to D0 of the CTLPF (control playfield) register.
Writing a “1” will cause the reflection to be displayed.
All 5 moveable objects (P0, M0, P1, M1, BL) can be assigned a horizontal
location on the screen and moved left or right relative to their location.
Vertical positions, however, are treated in an entirely different manner. In
principle, these objects appear at whatever scan lines their graphics
registers are enabled. For example, let us assume the ball is to be
positioned vertically in the center of the screen. The screen has 192 scan
lines and we want the ball to be 2 scan lines “thick”. The ball graphics
would be disabled until scan line 96, enabled for 2 scan lines, then disabled
for the rest of the frame. Each type of object (players, missiles, and ball)
has its’ own characteristics and limitations.
The ball can also be vertically delayed one can line. For example, if the ball
graphics were enabled on scan line 95, it could be delayed to not display on
the screen until scan line 96 by writing a “1” to D0 of the vertical delay
(VDELBL) register. The reason for having a vertical delay capability is
because most programs will update the TIA every 2 lines. This confines all
vertical movements of objects to 2 scan line “jumps”. The use of vertical
delay allows the objects to move one scan line at a time.
STELLA PROGRAMMER'S GUIDE 7
The player graphics are drawn line-by-line like all other graphics. The
difference here is each scan line of the player is 8 “bits” wide, whereas the
missiles and ball are one “bit” wide. Therefore, a player can be though of as
being drawn of graph paper 8 squares wide and as tall as desired. To “color
in the squares” of this imaginary graph paper, 8 data bits are written into
the players graphics registers (GP0, GP1). This 8 bit register is scanned
from D7 to D0, and wherever a “1” is found that “square” gets the players’
color (from the color-lum register) and where a “0” is found that “square”
gets the background color. To position a player vertically, simply leave all
“0’s” in the graphics registers (GP0, GP1) until the electron beam is on the
scan line desired, write to the graphics register line-by-line describing the
player, then write all “0’s” to turn off the players’ graphics until the end of
that frame.
Vertical delay for the players works exactly like the ball by writing a “1” to
D0 in the players’ vertical delay registers (VDELP0, VDELP1). Writing a
“0” to these locations disables the vertical delay.
STELLA PROGRAMMER'S GUIDE 8
The horizontal position of each object is set by writing to its’ associated reset
register (RESP0, RESP1, RESM0, RESM1, RESBL) which are all “strobe”
registers (they trigger their function as soon as they are addressed). That
causes the object to be positioned wherever the electron bean was in its
sweep across the screen when the register was reset. for example, if the
electron beam was 60 color clocks into a scan line when RESP0 was written
to, player 0 would be positioned 60 color clocks "in” on the next scan line.
Whether or not P0 is actually drawn on the screen is a function of the data
in the GP0 register, but if it were drawn, it would show up at 60. Resets to
these registers anywhere during horizontal blanking will position objects at
the left edge of the screen (color clock 0). Since there are 3 color clocks per
machine cycle, and it can take up to 5 machine cycles to write the register,
the programmer is confined to positioning the objects at 15 color clock
intervals across the screen. This “course” positioning is “fine tuned” by the
Horizontal Motion, explained in section 8.0.
There are timing constraints for the HMOVE command. The HMOVE
command must immediately follow a WSYNC (Wait for SYNC) to insure the
HMOVE operation occurs during horizontal blanking. This is to allow
sufficient time for the motion registers to do their thing before the electron
beam starts drawing the next scan line. Also, for mysterious internal
hardware considerations, the motion registers should not be modified for at
least 24 machine cycles after an HMOVE command.
Each object is assigned a priority so when any two objects overlap the one
with the highest priority will appear to move in front of the other. To
simplify hardware logic, the missiles have the same priority as their
associated player, and the ball has the same priority as the playfield. The
background, of course, has the lowest priority. The following table
illustrates the normal (default) priority assignments.
Priority Objects
1 P0, M0
2 P1, M1
3 BL, PF
4 BK
This priority assignment means that players and missiles will move in front
of the playfield. To make the players and missiles move behind the
playfield, a "1" must be written to D2 of the CTRLPF register. The
following table illustrates how the priorities are affected:
Priority Objects
1 PF, BL
2 P0, M0
3 P1, M1
4 BK
One more priority control is available to be used for displaying the score.
When a "1" is written to D1 of the CTRLPF register, the left half of the
playfield takes on the color of player 0, and the right half the color of player
1. The game score can now be displayed using the PF graphics register, and
the score will be in the same color as its associated player.
STELLA PROGRAMMER'S GUIDE 10
10.0 Collisions
The TIA detects collisions between any of the 6 objects it generates (the
playfield and 5 moveable objects). There are 15 possible two-object
collisions which are stored in 15 one bit latches. Each collision register
contains two of these latches which are read by the microprocessor on D6
and D7 of the data bus for easy access. A "1" on the data line indicates the
collision it records has occurred. The collision registers could be read at any
time but is usually done during vertical blank after all possible collisions
have occurred. The collision registers are all reset simultaneously by
writing to the collision reset register (CXCLR).
11.0 Sound
There are two audio circuits for generating sound. They are identical but
completely independent and can be operated simultaneously to produce
sound effects through the TV speaker. Each audio circuit has three
registers that control a noise-tone generator (what kind of sound), a
frequency selection (high or low pitch of the sound), and a volume control.
11.1 Tone
The noise-tone generator is controlled by writing to the 4 bit audio control
registers (AUDC0, AUDC1). The values written cause different kinds of
sounds to be generated. Some are pure tones like a flute, others have
various "noise" content like a rocket motor or explosion. Even though the
TIA hardware manual lists the sounds created by each value, some
experimentation will be necessary to find "your sound".
11.2 Frequency
Frequency selection is controlled by writing to a 5 bit audio frequency
register (AUDF0, AUDF1). The value written is used to divide a 30KHz
reference frequency creating higher or lower pitch of whatever type of sound
is created by the noise-tone generator. By combining the pure tones
available from the noise-tone generator with frequency selection a wide
range of tones can be generated.
11.3 Volume
Volume is controlled by writing to a 4 bit audio volume register (AUDV0,
AUDV1). Writing 0 to these registers turns sound off completely, and
writing any value up to 15 increases the volume accordingly.
STELLA PROGRAMMER'S GUIDE 11
There are six input ports whose logic states can be read on D7 by reading
the input port addresses (INPT0, thru INPT5). These six ports are divided
into two types, "dumped" and "latched".
1.0 General
The PIA uses the same clock as the microprocessor so that one PIA cycle
occurs for each machine cycle. The PIA can be set for one of four different
"intervals", where each interval is some multiple of the clock (and therefore
machine cycles). A value from 1 to 255 is loaded into the PIA which will be
decremented by one at each interval. The timer can now be read by the
microprocessor to determine elapsed time for timing various software
operations and keep them synchronized with the hardware (TIA chip).
For example, if the value of 100 were written to TIM64T (HEX address 296)
the timer would decrement to 0 in 6400 clocks (64 clocks per interval x 100
intervals) which would also be 6400 microprocessor machine cycles.
3.0 RAM
The PIA has 128 bytes of RAM located in the Stella memory map from HEX
address 80 to FF. The microprocessor stack is normally located from FF on
down, and variables are normally located from 80 on up (hoping the two
never meet).
The two ports (Port A and Port B) are 8 bits wide and can be set for either
input or output. Port A is used to interface to carious hand-held controllers
but Port B is dedicated to reading the status of the Stella console switches.
A "0" in a data bit indicates the joystick has been moved to close that
switch. All "1's" in a player's nibble indicates that joystick is not moving.
PAL/SECAM CONVERSIONS
PAL
1. The number of scan lines, and therefore the frame time increases from
NTSC to PAL according to the following table:
NTSC PAL
scan micro scan micro
lines seconds lines seconds
VBLANK 40 2548 48 3085
KERNAL 192 12228 228 14656
OVERSCAN 30 1910 36 2314
FRAME 262 16686 312 20055
SECAM
1. SECAM is a little weird. It takes the PAL software, but the console
color/black & white switch is hardwired as black & white. Therefore, it
reads the PAL black & white tables in software and assigns a fixed color to
each lum of black & white according to the following table:
Lum Color
0 Black
2 Blue
4 Red
6 Magenta
8 green
A cyan
C yellow
E white
There is a trap here: the manual is the same for NTSC, PAL, & SECAM.
This means that the descriptions for black & white must jive between NTSC
& PAL. If you make major changes to PAL black & white to achieve good
SECAM color, NTSC black & white must be made similar.
2. PAL sounds work fine on SECAM with one exception: when a sound is to
be turned off, it must be one by setting AUDV0/AUDV1 to 0, not by setting
AUDC0/AUDC1 to 0. Otherwise, you get an obnoxious background sound.
STELLA PROGRAMMER'S GUIDE 17
GENERAL DESCRIPTION
This circuit operates on a line by line basis, always outputting the same
information every television line unless new data is written into it by the
microprocessor.
Horizontal position counters are used to trigger the serial output of five (5)
horizontally movable objects; two players, two missiles and a ball. The
microprocessor can add or subtract from these position counters to move
these objects right or left.
Walls, clouds and other seldom moved objects are produced by a low
resolution data register called the playfield register.
A fifteen (15) bit collision register detects all fifteen possible two object
collisions between these six (6) objects (five moveable and one playfield).
This collision register can be read and reset by the microprocessor. Six input
ports are also provided on this chip that can be read by the microprocessor.
These input ports and the collision register are the only chip addresses that
can be read by the microprocessor. All other addresses are write only.
Two (2) independent audio generating circuits are included, each with
programmable frequency, noise content, and volume control registers.
STELLA PROGRAMMER'S GUIDE 18
DETAILED DESCRIPTION
If the read-write line is low, the data bits indicated in this table will be
written into the addressed write location when the 02 clock goes from high
to low. Some registers are eight bits wide, some only one bit, and some
(strobes) have no bits, performing only control functions (such as resets)
when their address is written.
If the read-write line is high, the addressed location can be read by the
microprocessor on data lines 6 and 7 while the 02 clock is high.
The addresses given in the table refer only to the six (6) real address lines.
If any of the four (4) chip select lines are used for addressing, the addresses
must be modified accordingly.
2. Synchronization
A. Horizontal Timing
A hardware counter on this chip produces all horizontal timing (such as
sync, blank, burst) independent of the microprocessor, This counter is
driven from an external 3.58 Mhz oscillator and has a total count of 228.
Blank is decoded as 68 counts and sync and color burst as 16 counts.
B. Vertical Timing
There are one bit, addressable registers on this chip for vertical sync and
vertical blank. The timing for these functions is established by the
microprocessor by writing zero or one into these bits. (VSYNC, VBLANK )
C. Composite Sync
Horizontal sync and the output of the vertical sync bit are combined
together to produce composite sync. This composite sync signal drives a
chip output pad to an external composite video resistor network.
STELLA PROGRAMMER'S GUIDE 19
D. Microprocessor Synchronization
The 3.58 MHz oscillator also clocks a divide by three counter on this chip
whose output (1.19 Mhz) is buffered to drive an output pad called 00. This
pad provides the input phase zero clock to the microprocessor which then
produces the system 02 clock (1.19 Mhz).
Software program loops require different lengths of time to run depending
on branch decisions made within the program. Additional synchronization
between the software and hardware. This is done with a one bit latch called
WSYNC (wait for sync). When the microprocessor finishes a routine such as
loading registers for a horizontal line, or computing new vertical locations
during vertical blank, it can address WSYNC, setting this latch high. When
this latch is high, it drives an output pad to zero connected to the
microprocessor ready line (RDY). A zero on this line causes the
microprocessor to halt and wait. As shown in figure 2, WSYNC latch is
automatically reset to zero by the leading edge of the next horizontal blank
timing signal, releasing the RDY line, allowing the microprocessor to begin
its computation and register writing for this horizontal television line or
line pair.
A. Description
Objects such as walls, clouds, and score) which are not required to move, are
written into a 20 bit register called the playfield register. This register
(Figure 5) is loaded from the data bus by three separate write addresses
(PF0, PFl, PF2). Playfield may be loaded at any time. To clear the playfield,
zeros must be written into all three addresses.
D. Timing Constraints
Even though the playfield bytes (PF0, PFl, PF2) may be written to any time,
if one of them is changed while being serially scanned, part of the new value
may both show up on the television horizontal line.
A. Description
The playfield is a fixed graphics register, always starting its serial output
when triggered by the beginning of each television line. This chip also
includes five "moveable" graphics registers, whose serial outputs are
triggered by five separate horizontal position counters every time these
counters pass through zero count. These position counters are clocked
continuously during the unblanked portion of every horizontal line and their
count length is exactly equal to the normal number of clocks supplied to
them during this time. They will therefore pass through zero at the same
time during each horizontal television line and the triggered outputs will
have no horizontal motion. A typical horizontal counter is shown in figure 4.
If extra clocks are supplied to these counters (or normal clocks suppressed)
the zero crossing time will shift and the object will have moved left (extra
clocks) or right (fewer clocks). Some position counters have extra decoders
(in addition to a zero decode) to trigger multiple copies of the same object
across a horizontal line.
All position counters can be reset to zero count by the microprocessor at any
time, by a write instruction to the reset addresses (RESBL, RESM0, RESMl,
RESP0, RESPl). If reset occurs during horizontal blank, the object will
appear at the left side of the television screen. Properly timed resets may
position an object at any horizontal location consistent with the
microprocessor cycle time.
A. General Description
There are five write only registers on this chip that contain the horizontal
motion values for each of the five moving objects. A typical horizontal
motion register is shown in figure 4 . The data bus (bits 4 through 7) is
written into these addresses (HMP0, HMPl, HMM0, HMMl, HMBL) to load
these registers with motion values. These registers supply extra (or fewer)
clocks to the horizontal position counters only when commanded to do so by
an HMOVE address from the microprocessor. These registers may all be
cleared to zero (no motion) simultaneously by an HMCLR command from
the microprocessor, or individually by loading zeros into each register.
These registers are each four bits in length and may be loaded with positive
(left motion), negative (right motion) or zero (no motion) values. Negative
values are represented in twos complement format.
B. Timing constraints
These registers may be loaded or cleared at almost any time. The motion
values they contain will be used only when an HMOVE command is
addressed, and then all five motion values will be used simultaneously into
all five horizontal position counters once. The only timing constraint on this
operation involves the HMOVE command. The HMOVE command must be
located in the microprocessor program immediately after a wait for sync
(WSYNC) command. This assures that the HMOVE operation begins at the
leading edge of horizontal blank, and has the full blank time to supply extra
or fewer clocks to the horizontal position counters. These registers should
not be modified for at least 24 Computer cycles after the HMOVE command.
STELLA PROGRAMMER'S GUIDE 22
A. General Description
There are five graphics registers for moving objects on this chip. These
graphics registers are loaded (written) in parallel by the microprocessor and
like the playfield register are scanned and converted to serial output.
Unlike the playfield register, which is always scanned beginning at the left
side of each horizontal line, moving object graphics registers are scanned
only when triggered by a start decode from their horizontal position counter.
A typical graphics register is shown in figure 4 .
B. Missile Graphics
The graphics registers for both missiles are identical and very simple. They
each consist of a one bit register called missile enable (ENAM0, ENAM1).
This graphics bit is scanned (outputted) only when triggered by its
corresponding position counter. There are control bits (bits 4, 5, of NUSIZ0,
NUSIZ1) that can stretch this single graphics bit out over widths of 1, 2, 4,
or 8 clocks of horizontal line time. (A full line is 160 clocks).
C. Player Graphics
The graphics registers for both players are identical and are rather complex.
They each consist of eight bit parallel registers (GRP0, GRP1) and a bi-
directional parallel to serial scan counter that converts the parallel data
into serial output. A one bit control register (REFP0, REFP1) determines
the direction (reflection) of the parallel to serial scan, outputing either D7
through D0, or D0 though D7. This allows reflection (horizontal flipping) of
player serial graphics data without having to flip the microprocessor data.
The clock into the scan counter can be controlled (three bits of NUSIZ0 and
NUSIZ1) to slow the scan rate and stretch the eight bits of serial graphics
out over widths of 8, 16, or 32 clocks of horizontal line time. These same
control bits are used in the player-missile motion counters to control
multiple copies, so only three player widths ( scan
rates) are available.
STELLA PROGRAMMER'S GUIDE 23
D. Vertical Delay
Each of the player graphics registers actually consists of two 8 bit parallel
registers. The first (GRP0, GRP1) is loaded (written) from the
microprocessor 8 bit data bus. The second is automatically loaded from the
output of the first. The reason for this is a complex subject called vertical
delay. A large amount of microprocessor time is required to generate
player, missile and playfield graphics (table look up, masking, comparisons,
etc.) and load these into this chip's registers. For most game programs this
time is just too large to fit into one horizontal line time. In fact for most
games it will barely fit into two line times (127 microseconds). Therefore,
individual graphics registers are loaded (written) every two lines, and used
twice for serial output between loads. This type of programing will
obviously limit the vertical height resolution of objects to multiples of two
lines. It also will limit the resolution of vertical motion to two lines jumps.
Nothing can be done about the vertical height resolution; however, vertical
motion can be resolved to a single line by addition of a second graphics
register that is automatically parallel loaded from the output of the first,
one line time after the first was loaded from the data bus. This second
graphics register output is therefore always delayed vertically by one line. A
control bit called vertical delay (VDEL0, VDEL1) selects which of these two
registers is to be used for serial output. If this control bit is set by the
microprocessor between picture frames, the object will be moved down
(delayed) by one line during the next frame. In most programming
applications player 0 graphics and player 1 graphics are loaded (written)
alternately, during the blank time just prior to each line as shown in (figure
1). Since GRP0 and GRP1 addresses from the microprocessor alternate,
they are delayed by one line from each other. The GRP0 address decode can
therefore be used to load the delayed graphics register for player 1, and
GRP1 likewise to load the delayed graphics register for player 0. The two
vertical delay bits (VDEL0, VDELl) then select delayed or undelayed
registers for player 0 and player 1 as serial outputs.
STELLA PROGRAMMER'S GUIDE 24
E. Ball Graphics
The ball graphics register is almost identical to the missile graphics
register. It also consists of a single enable bit (ENABL) whose output is
triggered by the ball position counter. It also has two control bits (bits 4, 5
of CTRLPF) that can stretch this single graphics bit out over widths of 1, 2,
4, or 8 clocks of horizontal line time. Unlike the missile graphics; however,
the ball graphics register has capability for vertical delay similar to the
player graphics. A second graphics (enable) bit is alternately loaded from
the output of the first, one line after the first was loaded from the data bus.
A ball vertical delay bit (VDELBL) selects which of these two graphics bits
is used for the ball serial output. The first graphics bit (ENABL) should be
loaded during the same horizontal blank time as player 0 (GRP0), because
GRP1 is used to load the second enable bit from the output of the first on
alternate lines.
A. Definitions
The serial outputs from all the graphics registers represent real time
horizontal location of objects on the television screen. If any of these outputs
occur at the same time, they will overlap (collide) on the screen. There are
six objects generated on this chip (five moving and playfield) allowing
fifteen possible two object collisions. These overlaps (collisions) are detected
by fifteen "and" gates whenever they occur, and are stored in fifteen
individual latch register bits, as shown in figure 6.
B. Reading Collision
The microprocessor can read these fifteen collision bits on data lines 6 and 7
by addressing them two at a time. This could be done at any time but is
usually done between frames (during vertical blank) after all possible
collisions have serially occurred.
C. Reset
All collision bits are reset simultaneously by the microprocessor using the
reset address CXCLR. This is usually done near the end of vertical blank,
after collisions have been tested.
STELLA PROGRAMMER'S GUIDE 25
8. Input ports
A. General Description
There are 6 input ports on this chip whose logic state may be read on data
line 7 with read addresses INPT0 through INPT5. These 6 ports are
divided into two types, "dumped" and "latched". See Figure 8.
As long as bit 7 of register VBLANK is zero, these four ports are general
purpose high impedance input ports. When this bit is a 1 these ports are
grounded.
When disabled, these latches are removed from the circuit completely and
these ports become two general purpose input ports, whose present logic
state can be read directly by the microprocessor.
When enabled, these latches will store negative (zero logic level) signals
appearing on these two input ports, and the input port addresses will read
the latches instead of the input ports.
When first enabled these latches will remain positive as long as the input
ports remain positive (logic one). A zero input port signal will clear a latch
value to zero, where it will remain (even after the port returns positive)
until disabled. Both latches may be simultaneously disabled by writing a
zero into bit 6 of register VBLANK.
STELLA PROGRAMMER'S GUIDE 26
A. Purpose
As discussed in the section on collisions, simultaneous serial outputs from
the graphics registers represent overlap on the television screen. In order to
have color-luminosity values assigned to individual objects it is necessary to
establish priorities between objects when overlapped. The priority encoder
is shown in figure 3.
B. Priority Assignment
The lack of any objects results in a color-lum value called the background.
The background (BK) has lowest priority and only appears when no objects
are outputing. In order to simplify the logic, each missile is given the same
color-lum value and priority as it's corresponding player (P0, M0) and the
ball is given the same color-lum value and priority as the playfield (PF, BL).
Objects with higher priority will appear to move in front of objects with
lower priority. Players will therefore move in front of playfield (clouds,
walls, etc.).
C. Priority Control
There are two playfield control bits that affect priority, one called playfield
priority (PFP) (bit 2 of CTRLPF) and one called score (bit 1 of CTRLPF).
When a one is written into the PFP bit the priority assignment is modified
as shown below.
Players will then move behind playfield (clouds, wall, etc.). When a one is
written into the score control bit, the playfield is forced to take the color-lum
of player 0 in the left half of the screen and player 1 in the right half of the
screen. This is used when displaying score and identifies the score with the
correct player. The priority encoder produces 4 register select lines shown
in figure 3) that are mutually exclusive. These 4 lines select either
background, player 0, player 1 or playfield, and only one of them can be true
at a time.
STELLA PROGRAMMER'S GUIDE 27
A. Description
There are four registers (shown in figure 3) that contain color-lum codes.
Four bits of color code and three its of luminance code may be written into
each of these registers (COLUP0, COLUP1, COLUPF, COLUBK) by the
microprocessor at any time. These codes (representing 16 color values and 8
luminance values) are given in the Detailed Address List.
B. Multiplexing
The serial graphics output from all six objects is examined by the priority
encoder which activates one of the four select lines into a 4 x 7 multiplexer.
This multiplexer (shown in figure 3) then selects one of the four color-lum
registers as a 7 line output. Three of these lines are binary coded
luminosity and go directly to chip output pads. The other four lines go to the
color phase shifter.
This portion of the chip (shown in figure 3) produces a reference color output
(color burst) during horizontal blank and then during the unblanked portion
of the line it produces a color output shifted in phase with respect to the
color burst. The amount of phase shift determines the color and is selected
by the four color code lines from the Color-lum multiplexer. Binary code 0
selects no color. Code 1 selects gold (same phase as color burst). Codes 2
(0010) through 15 (1111) shift the phase from zero through almost 360
degrees allowing selection of 15 total colors around the television color
wheel.
Two audio circuits are incorporated on this chip. They are identical and
completely independent, although their outputs could be combined
externally into one speaker. Each audio circuit consists of parts described
below, and in figure 7.
A. Frequency Select
Clock pulses (at approximately 30 KHz) from the horizontal sync counter
pass through a divide by N circuit which is controlled by the output code
from a five bit frequency register (AUDF). This register can be loaded
(written) by the microprocessor at any time, and causes the 30 KHz clocks to
be divided by 1 (code 00000) through 32 (code 11111). This produces pulses
that are digitally adjustable from approximately 30 KHz to 1 KHz and are
used to clock the noise-tone generator.
STELLA PROGRAMMER'S GUIDE 28
B. Noise-Tone Generator
This circuit contains a nine bit shift counter which may be controlled by the
output code from a four bit audio control register(AUDC), and is clocked by
the frequency select circuit. The control register can be loaded by the
microprocessor at any time, and selects different shift counter feedback taps
and count lengths to produce a variety of noise and tone qualities.
C. Volume Select
The shift counter output is used to drive the audio output pad through four
driver transistors that are graduated in size. Each transistor is twice as
large as the previous one and is enable by one bit from the audio volume
register (AUDV). This audio volume register may be loaded by the
microprocessor at any time. As binary codes 0 through 15 are loaded, the
pad drive transistors are enabled in a binary sequence. The shift counter
output therefore can pull down on the audio output pad with 16 selectable
impedance levels.
STELLA PROGRAMMER'S GUIDE 29
Figure 2. Synchronization
Figure 3. Color-Luminance
STELLA PROGRAMMER'S GUIDE 31
VSYNC
This address controls vertical sync time by writing D1 into the VSYNC latch
D1
VBLANK
This address controls vertical blank and the latches and dumping transistors on the input
ports by writing into bits D7, D6 and D1 of the VBLANK register.
D7 D6 D1
D7 D6 D5 D4 PF0
D7 D6 D5 D4 D3 D2 D1 D0 PF1
D7 D6 D5 D4 D3 D2 D1 D0 PF2
center
4 7 7 0 0 7 7 0 0 7 7 4 REF = 1
PF0 PF1 PF2 PF2 PF1 PF0
CTRLPF
This address is uded to write into the playfield control register (a logic 1 causes action
as described below)
D5 D4 D2 D1 D0
NUSIZ0 (NUSIZ1)
These addresses control the number and size of players and missiles.
D5 D4 D2 D1 D0
Missile Size D5 D4 Width
0 0 1 clock
0 1 2 clocks
1 0 4 clocks
1 1 8 clocks
RESMP0 (RESMP1)
These addresses are used to reset the hoiz. location of a missile to the center of it’s
corresponding player. As long as this control bit is true (1) the missile will remain
locked to the center of it’s player and the missile graphics will be siddabled. When a
zero is written into this location, the missile is enabled, and can be moved independently
from the player.
D1
HMOVE
This address causes the horizontal motion register values to be acted upon during the
horizontal blank time in which it occurs. It must occur at the beginning of horiz. blank
in order to allow time for generation of extra clock pulses into the horizontal position
counters if motion is desired this command must immediately follow a WSYNC
command in the program.
HMCLR
This address clears all horizontal motion registers to zero (no motion)
D7 D6 D5 D4
0 1 1 1 +7
0 1 1 0 +6
0 1 0 1 +5 Move left
0 1 0 0 +4 indicated number
0 0 1 1 +3 of clocks
0 0 1 0 +2
0 0 0 1 +1
0 0 0 0 0 No Motion
1 1 1 1 -1
1 1 1 0 -2
1 1 0 1 -3
1 1 0 0 -4 move right
1 0 1 1 -5 indicated number
1 0 1 0 -6 of clocks
1 0 0 1 -7
1 0 0 0 -8
WARNING : These motion registers should not be modified during the 24 computer
cycles immediately following an HMOVE command. Unpredictable motion values may
result.
STELLA PROGRAMMER'S GUIDE 41
GRP0 (GRP1)
These addresses write data into the player graphics registers.
D7 D6 D5 D4 D3 D2 D1 D0
REFP0 (REFP1)
These addesses write D3 into the 1 bit player reflect registers
D3
D0
D0 - [0 = no delay, 1 = delay]
CXCLR
This adderess clears all collision latches to zero (no collision)
COLOR D7 D6 D5 D4 D3 D2 D1 LUM
grey - gold 0 0 0 0 0 0 0 black
0 0 0 1 0 0 1 dark grey
orange, brt-org 0 0 1 0 0 1 0
0 0 1 1 0 1 1 grey
pink - purple 0 1 0 0 1 0 0
0 1 0 1 1 0 1
purp-blue, blue 0 1 1 0 1 1 0 light gret
0 1 1 1 1 1 1 white
blue - lt. blue 1 0 0 0
1 0 0 1
torq. - grn. blue 1 0 1 0
1 0 1 1
grn. - yel. grn. 1 1 0 0
1 1 0 1
org. grn - lt org. 1 1 1 0
1 1 1 1
AUDF0 (AUDF1)
These addresses write data into the audio frequency divider registers.
D4 D3 D2 D1 D0 30KHz divided by
0 0 0 0 0 no division
0 0 0 0 1 divide by 2
0 0 0 1 0 divide by 3
... ... ... ... ... ...
1 1 1 1 0 divide by 31
1 1 1 1 1 divide by 32
STELLA PROGRAMMER'S GUIDE 43
AUDC0 (AUDC1)
These addresses write data into the audio control registers which control the noise
content and additional division of the audio output.
D3 D2 D1 D0 Type of noise or
division
0 0 0 0 set to 1
0 0 0 1 4 bit poly
0 0 1 0 div 15 -> 4 bit poly
0 0 1 1 5 bit poly -> 4 bit poly
0 1 0 0 div 2 : pure tone
0 1 0 1 div 2 : pure tone
0 1 1 0 div 31 : pure tone
0 1 1 1 5 bit poly -> div 2
1 0 0 0 9 bit poly (white noise)
1 0 0 1 5 bit poly
1 0 1 0 div 31 : pure tone
1 0 1 1 set last 4 bits to 1
1 1 0 0 div 6 : pure tone
1 1 0 1 div 6 : pure tone
1 1 1 0 div 93 : pure tone
1 1 1 1 5 bit poly div 6
AUDV0 (AUDV1)
These addresses write data into the audio volume registers which set the pull down
impedance driving the audio output pads.
D3 D2 D1 D0 Audio Output
Pull down current
0 0 0 0 No output current
0 0 0 1 lowest
0 0 1 0
... ... ... ...
1 1 1 0
1 1 1 1 highest
STELLA PROGRAMMER'S GUIDE 44