Atari 2600 programming

Harry Dodgson dodgson at cs.wmich.edu
Sat Jan 28 03:08:04 AEST 1989


Specifications for the Atari 2600/7800

		2600				7800

CPU:		6507				6502C (custom, NOT 65C02)
RAM:		128 Bytes, in VLSI		4K, high speed
ROM:		6K max				52K max
Cpu Clock:	1.19 MHz			1.79 MHz
Graphics Clock:	3.58 MHz			7.16 MHz
Slot Config:	Rom access only			Most CPU lines + video/audio
CPU Avail:	less than 50%			over 90%


Notes:
1. ROM specs are based on a non-bank select scheme.
2. Graphics Clock is the master clock used to drive the video chips.

Programming the 2600 in a nutshell.
	The Atari 2600 consists of 3 important ICs: the CPU (6507),
the Television Interface Adapter (TIA or Stella), and the RIOT (6532).
The 7800 has a CPU (6502C or Sally) instaed of the 6507 and a GCC1702 
(Maria) chip in addition to the Stella chip.

The CPU:
	The 6507 CPU is a 6502 with 2 important exceptions: it only has
external address lines for 8K of memory and there are NO interrupt lines
connected.  This is not as limiting as it seems if you examine some of
the games for the machine.

The Stella chip:
	This chip makes all the video displays and sounds for the 2600 VCS.
It also has 6 registers which are used as A/D converters and for the trigger
buttons on the joysticks.  The chip also controls the RDY line of the CPU
to initiate horizontal syncronization control.  The chip is NOT a DMA chip.
The CPU must write each line of data into the chip registers AS it draws
the screen.  This accounts for the low CPU availability. The Chip is addresed
through 44 write only registers, and 13 read only registers mapped to
the low end of page 0.  For those familiar with the Atari 800, this chip
is about 1/2 of a TIA/Pokey in all respects.  But, there is no ANTIC chip to
drive it; the CPU must do all the work that the ANTIC does in the 800.

The RIOT
	This chip reads all the console switches (excluding power), the
joysticks, and other controllers.  It also contains the only RAM in the
system and a general purpose timer.  The RAM is mapped to the high end of both page 0 and page 1.  This means that it acts as both page 0 fast access memory
and the 6502 stack.  The timer and I/O ports are mapped to Page 2 and 3.


	In order to produce a video display, a program must do the following:
1. Start the vertical blanking interval
2. Start the vertical sync interval immediately
	there is time for about 80 instructions after this
3. End vertical sync
	the game computations must be done now as there won't be time later
4. End vertical blanking
5. Set up each line of the video display as it is drawn
	there is time for about 6 instructions to the video chip before
	the current line starts being displayed.  Atari recommends changing
	the display every other line to gain processing time.
6. Loop back to step 1

The Cartridge:
	A standard cartridge contains the equivalent of a 2716 or 2732/2532
with one notable exception: the chip select line is active high, not low.
The high order address line of the 6507 (A12) is used as the chip enable.
There was at least one company that used EPROMs with a 74LS04 inverter to
compensate for this.

The Pinouts:
Note:	numbers indicate left to right numbering

	Top Row			Bottom Row
Slot	2716	CPU		2716	CPU

1	13	D3		1	A7
2	14	D4		2	A6
3	15	D5		3	A5
4	16	D6		4	A4
5	17	D7		5	A3
6	*	A12		6	A2
7	19	A10		7	A1
8	NC	A11		8	A0
9	22	A9		9	D0
10	23	A8		10	D1
11	24	+5V		11	D2
12	12	Shield Ground	NC	Ground
    * to inverter and back to 18 for chip select

Major differences between 2600 and 7800 mode:
	2600 mode is default in the 7800.  If it finds 128 bytes at the high
end of memory to match its encryption scheme, it will enable 7800 mode. There is a small ROM inside the unit which displays the Atari pattern on screen as
it does this.
	The 7800 mode is DMA driven, so the processor is free most of the time
to do other things, as the graphics chip runs 4 times faster than the CPU.
	The 7800 cartridge slot includes 8 more lines: A13, A14, A15, R/W,
phase 2 clock, audio, video, and HALT (unique to Atari 6502).
	The 2600 video has foreground/background, 2 player/missles, and one
ball. The 7800 can display as many objects as the DMA can read in one line.
	The sound is exactly the same as it still uses the Stella chip
 (except Ballblazer which has its own sound chip in the cartridge).

-- 
Harry Dodgson Jr.               Internet:  dodgson at cs.wmich.edu
Western Michigan University
Computer Science Department        Voice:     (616) 387-5803
Kalamazoo, MI  49008



More information about the Alt.sources mailing list