Presentation on theme: "Atari 2600 Program Development"— Presentation transcript:
1 Atari 2600 Program Development Joe Decuiralumnus of Atari & Amiga
2 Agenda Goals and non-goals Why do this Requirements for Program DevelopmentDevelopment ToolsHardware environmentSystem programming modelExample Game Design (Combat)Suggestions
3 Goals for todayAudience understands what is required to develop game software for a production Atari 2600 VCSSome discussion about how that might apply to developing game software for successors, both hardware and emulator software.Not goal: demonstrations – I can’t do that without a video projector.
4 Why program for the VCS today? There is not a mass market to buy cartridgesThere is an emerging base of users who enjoy simpler games:Owners of original Atari 2600 VCS consolesPC owners running emulatorsTo create games without the huge effort involved in creating modern graphics-intensive games.Summary: fun, education, impress your friends
5 Requirements for Program Development Target environment requirementsSpecifications for the hardware, registers, etcProgram generation tools: assemblerTarget environment emulator, hard or softProgram debug toolsProgram distribution:ROM cartridgesBinary image files for use on emulators
6 Objective of Program Development Produce a 6507 binary image:2-4K bytes for use as a 2600 cartridgePossibly larger when used with a software emulator, particularly if it can emulate bank-switching techniques (e.g. PCAE 2.2)
7 Development Targets There are several development targets: Original Atari 2600 hardwareVCS Hardware clones (e.g. Coleco)Modern hardware clones, e.g. LCD handheld modelsPC emulators (e.g PCAE 2.2, etc)The capabilities of the successive targets may exceed those of the original hardware, in memory, but they have to match some other limits to remain compatible with old games.
8 Original Production 2600 Hardware Resources 6507 at 1.2MHz ( / 3)6502, 13 bit address space, no interrupts, RDY128 bytes of RAM, mapped to 00XX, 01XXSpace for ROM cartridges of up to 4KBTwo joysticks, supported by TIA and 6532TIA video and audio chip6532 Timer
9 Original Production 2600 Hardware Limitations NO host development capabilitiesNO interrupts – single thread for everythingNO DMA, 6507 does everythingNO vertical support in hardwareVery small RAMSmall ROM, 8K address spaceNote: software emulators can remove these limitations, a boon for program debugging.
10 Original 2600 Program Development Environment 6502 Cross Assembler, based on hostE.g. timesharing machine, or DEC PDP-11Hardware Emulator, w/RAM in code spaceDebug monitor, for downloading and manipulating object codeHP-1600 series symbolic logic analyzerCapture and disassemble bus trafficPre-trigger or post-trigger on bus values
11 6502 Tools 6502 is 26 years old; current tools are scarce. Self-assemblers for 6502 code ran on Apple II, Atari 800/PCS or Commodore 64sWindows or Macintosh PCs have plenty of resources to run cross assemblers (or compilers) for They also exist for older machines:6502-specific hardware logic analyzers are out of productionThey might be available used
12 Simple way to test game code Make a ROM imageBurn a PROMMount it on a cartridgePlug it into a production VCSSee what happensIterate until it works as intended
13 Easiest VCS Development Today Start in a soft environment:Use suitable PC Emulator (e.g. PCAE)Generate assembly code:PC Cross-assemblerRun the code in the emulator, with Debug tools turned on
14 PCAE 2.2 Debug Features An example Atari VCS emulator for PCs Display and/or modify:Program code6507 registersZero page RAMTIA registersCurrent virtual beam positionOnline command and TIA register referenceBreakpoints on conditions
15 Hardware environment: Testing ROMs The developer needs only two tools:PROM burnerPC basedStand alone serial port devicesPROM cartridge with socket4KB DIP package PROMs are long obsoleteExtra logic is needed to invert A12 as a chip select (e.g. an inverter)
16 Making a Hardware Debugger Get a 6502 evaluation board with a debug monitor: KIM-1 ; JOLT (using TIM 6530 chip; Rockwell AIM-65; Synertek SYM-1; EPESee:Wire wrap a board with:6507 socket, wired to the 6502 pinsDecoder logic replacing the A12 pin on the 6507At least 4KB of RAM for CodeSerial connection to a host PC, if not on eval boardTake apart a 2600 VCS, remove the motherboard, remove the 6507 chip, connect the 6507 motherboard socket to the debug board socket.
17 Hardware test system diagram Debug BoardW/monitorRS-232Optional Hardwarelogic analyzerHost AssemblerSystemModifiedAtari VCSw/6507socketTVGame controllers
18 Hardware vs Software Debug environments Software emulation wasn’t feasible until recentlyPCAE runs full speed on a 486/Software debug has many advantages:The emulator knows the internal states of the CPU and the TIAThe emulator can freeze the action anywhere, while maintaining the game screenSoftware emulation of game controls is toughNo standard hardware that matches originals
19 Atari 2600 Programming Model System Block DiagramGraphicsControlsTIA registers
21 Stella System TIA video chip (see below) 6502-based processor, “6507”: 13 bit address, no interrupts, RDY line1.2 MHz6532 combo128 bytes of RAM (all mapped into zero page)16 bits of parallel I/O (joysticks and panel)timer (interrupt not used)cartridge slot for 2K or 4K ROMs (24 pins)2 game control ports
22 Stella GraphicsFundamental pixel resolution is 1 color burst clock (280nsec, 160/line) by 1 line.Motion objects are 1, 2, 4 or 8 clocks/bit.Motion objects may be replicated in hardware.Playfield is 4 clocks per bit.Playfield bits are either repeated or reflected in hardware.
23 Other TIA chip features 4 7-bit palette registers15 collision detection latches2 channel sound systemvariable prescaler4+5 bit polynomial countersvolume registerstrigger and potentiometer input portstrigger input could be used for light pens or light guns.
24 Human Input Requirements Console controls:Game select, and start switchesOptions: handicaps, color/monochromeVarious types of game controls:For TANK, etc: a joystick with a “fire” buttonFor PONG: a dual analog potentiometerFor Driving: a rotary controlFor head games: a keyboard
25 HID implementation One power switch 5 bits of console parallel I/O, not scanned5 + 5 bits of game control I/O, not scanned2 bits in TIA, 8 bits in parallel ports4 bits of potentiometer input, in TIA
26 TIA Register Map: 00-0A 00:0 Vertical Sync 00:1 Vertical Blank 02 Wait for Horizontal Sync03 Reset Horizontal sync (testing)04-05 Number and size of P0/M0, P1/M106-09 Color/lum registers0A Playfield controls
27 TIA Register Map: 0B-1F 0B-0C:3 Player reflect bits 0D-0F Playfield graphics (7-4; 7-0; 7-0)10-14 Horizontal reset, all 5 objects15-16 Audio control17-18 Audio frequency19-1A Audio volume1B-1C Player graphics (8 bits)1D-1F Missile/ball enable (1 bit each)
29 Example Simple Game Design General architectureDisplay generationGame playSounds
30 Combat Game Architecture The code has three components:Game play codeProcess game control and console control inputsProcess game results (e.g. collisions)Decide next graphics and soundsGraphics display codeGraphics tables
31 General VCS Game timing In Vertical Blank:detect collisions and control inputsdecide new game conditionscomputer new game graphics pointers, as inputs to the display kernelIn Display, for each line or two:step graphics pointersfetch graphicswait for horizontal blank, and write graphics
32 Combat Main loop VCNTRL: generate vertical sync GSGRCK: game select and resetLDSTEL: load Stella (TIA) registersCHKSW: read the joystick switchesCOLIS: Detect and process object collisionsSTPMPL: Move players and other objectsROT: generate & rotate object graphicsSCROT: generate score graphicsVOUT: display the game
33 Horizontal motion For each moving object: Given the horizontal position (0-159)Compute a loop count for a wait loop, mod 15Compute the horizontal motion step, -7 to +7Wait for horizontal syncRun the wait loopReset the object motion counterWrite the horizontal motion registerWrite HMOVE after all registers set up
34 Combat Display Kernel For pairs of horizontal lines: Compute indexes to playfield:move 2.5 bytes from ROM tablesplayfields are vertically reflected in softwareFor each object that is on, copy graphicsFor 8 bit objects, copy graphics from RAMFor 1 bit objects, enable/disableUse Wait-for-sync, and write graphics in horizontal blank
35 Concluding Suggestions Acquire or create an emulator-based toolkitLearn from existing code:Download old ROM imagesDisassemble them for studyExperiment by patching them and observing the resultsCreate original games, focused on game play:Easy to learnDifficult to masterGood luck monetizing your work.
36 Web Resources Salon.com: “Atari Lives” Salon.com/tech/feature/2001/07/09/atari/index.htmlPC Atari Emulators, PCAE by Dullea:6502 Tools:Atari Hardware Manual, scanned:
Your consent to our cookies if you continue to use this website.