Appendix A: Useful Peeks and Pokes
10,11 ($A,$B) Start Vector-Disk Based Software-(DOSVEC)
These locations hold the start vector or run the address for disk based binary load software. This is also the address BASIC jumps to when you call up DOS.
12,13 ($C,$D) Initialization Address for Disk Boot (DOSINI)
These locations hold the initialization address for the disk handler.
14,15 ($E,$F) Upper Limit of BASIC Program (APPMHI)
These locations contain the memory high limit for your BASIC program. Memory above that is used for screen display.
88,89 ($58,$59) Screen Memory Address (SAVMSC)
These addresses contain the lowest address of screen memory.
106 ($6A) Top of RAM Address-most significant byte (RAMTOP)
Gives the total number of pages (256 bytes) available. Peek (106)/4 gives the number of 1K blocks available.
741,742 ($2E5,$2E6) Free Memory High Address (MEMTOP)
This address is the highest free location in RAM for program and data. This value is updated when you press RESET, when you change GRAPHICS mode, or when a channel (IOCB) is OPENed to the display. The display list starts at the next byte above MEMTOP.
743,744 ($2E7,$2E8) Free Memory Low Address (MEMLO)
This is the address of the first free location of RAM for program use. This value which is normally 1792 ($700) is updated when DOS is present.
77 ($4D) Attract Mode On/Off (ATRACT)
Setting this location to 0 disables the attract mode, This happens automatically whenever a key is pressed. Normally this location is incremented every 4 seconds until the value reaches 127 ($7F), then set to 254 ($FE) until the attract mode is terminated. The attract mode protects the television screen by rotating the colors when the Atari is idle.
87 ($57) Display Mode (DINDEX)
This location contains the current BASIC graphics mode (0-11) in non-XL machines and (0-15) in XL machines. This can be used to fool the OS into thinking it is in a different graphics mode.
90 ($5A) Starting Graphics Cursor Row (OLDROW)
Used to determine the starting row for DRAWTO and XIO 18 (FILL) command.
91,92 ($5B,$5C) Starting Graphics Cursor Column (OLDCOL)
These locations are used by DRAWTO and XIO 18 (FILL) commands to determine the starting column of the DRAW or FILL.
96 ($60) Ending Graphics Cursor Row (NEWROW)
Row to which DRAWTO and FILL will go.
97,98 ($61,$62) Ending Graphics Cursor Column (NEWCOL)
Column to which DRAWTO and FILL will go.
660,661 ($294,$295) Split-screen Text Memory Address (TXTMSC)
Address of upper left corner of the split-screen text window.
708-712 ($2C4-$2C8) Playfield Color Registers (COLOR0-COLOR4)
Each of these locations determines the color for the various playfields. You can change these registers from BASIC via either a POKE or the SETCOLOR command.
752 ($2FO) Cursor Inhibit (CRSINH)
Zero turns the cursor on. Any other number turns the cursor off.
54276 ($D404) Horizontal Fine Scroll Register (HSCROL)
When horizontal fine scroll is enabled by setting bit 4 in the LMS instruction in the display list, POKEing this location with a value from zero to 16 clock cycles (depending on graphics mode) will fine scroll the screen.
54277 ($D405) Vertical Fine Scroll Register (VSCROL)
POKEing a value from zero to 16 (depending on graphics mode) will fine scroll the screen one or more scan lines. Vertical fine scrolling can only be used if bit 5 is set in the LMS instruction in the display list.
54282 ($D40A) Wait for Horizontal Synchronization (WSYNC)
This location allows the OS to synchronize the VBI's or DLI's with the screen display. Simply accessing this location halts the CPU until horizontal sync occurs.
54283 ($D40B) Vertical Line Counter (VCOUNT)
This register keeps track of the current line number currently be drawn on the screen. PEEKing here returns the line count divided by two; ranging from zero to 130 ($82). It is used during Display List Interrupts to change colors or when working with kernels.
755 ($2F3) Character Mode Register (CHACT)
This location defaults to a value of 2. Zero means normal inverse characters, one is blank (invisible) inverse characters, three is solid inverse characters. Four to seven is the same as zero to three, except the display is printed upside down. For example; POKE 755,4 will invert the standard character set.
756 ($2F4) Character Base Register (CHBAS)
This high byte location is used to tell ANTIC where the character set is located. It normally defaults to 224 ($E0) for upper case characters and numbers. Lower case and graphics characters can be selected in graphics modes I and 2 by POKEing CHBAS with 226 ($E2).
763 ($2FB) Last ATASCII Character or Plot Point (ATACHR)
Returns the last ATASCII character read or written, or the value of a graphics point. The FILL and DRAW commands use this location for the color of the line drawn.
512,513 ($200,$201) Display List interrupt Vector (VDSLST)
These locations store the address of the instructions to be executed during a display list interrupt.
559 ($22F) DMA Control Register (SDMCTL)
This location enables or disables direct memory access by ANTIC. The normal default value is 34 ($22) which enables DMA for fetching normal playfield display data. You can turn the display off by POKEing a zero here.
560,561 ($230,$231) Display List Address (SDLSTL)
This is the starting address of the display list.
54286 ($D40E) Non-maskable Interrupt Enable (NMIEN)
This location is used to enable or disable vertical blank and display list interrupts. It is set to 64 ($40) upon powerup to enable VBI's. A value of 128 ($80) enables DLI's and 192 ($CO) enables both. A zero disables both.
16 ($10) POKEY Interrupts (POKMSK)
This location enables and disables POKEY functions such as its timers, serial input/output data ready, and the BREAK key interrupt. The interrupt key can be disabled by POKEing a 112 to this shadowed location, and at 53774 ($D20E). It is better for the user to write his own routine for the BREAK key is reenabled whenever RESET is pressed or when PRINT or OPEN statements address the screen. You can store the location of your own interrupt routine at locations 566, 567 ($236,$237).
17 ($11) BREAK Key Flag (BRKKEY)
A zero means the BREAK key is pressed; any other number means it isn't.
764 ($2FC) Keyboard Character (CH)
This returns the value of the last key pressed. This value is neither internal or ATASCII but "raw" keyboard matrix code. A 255 ($FF) POKEd here clears it.
53279 ($D01F) Console Keys (CONSOL)
Used to determine if one of the three yellow console buttons have been pressed. It is best to clear it first with the value of eight to ensure an accurate reading. A value of 6 indicates the START key has been pressed, a 5 the SELECT key, and a 3 the OPTION key. The location reads a 7 when no CONSOLE keys are pressed, and a 0 when all are pressed simultaneously.
624-631 ($270-$277) Paddle Game Controller (PADDL0-PADDL7)
A number between zero and 228 ($E4) is returned in these locations for each of the seven paddle potentiometers.
632-635 ($278-$27B) joystick Controller Port (STICK0-4)
These locations return one of nine possible joystick positions for each stick. These values range from 5-15 (35$F). These values are 15 when the joystick is centered or in the neutral position.
636-643 ($27C-$283) Paddle Trigger (PTRIG0-PTRIG7)
Used to determine if the button on each paddle is pressed. A zero is returned if it is pressed and a one is returned when it isn't.
644-647 ($284-$287) joystick Trigger (STRIG0-STRIG3)
These locations are used to indicate whether the joystick button is pressed. A zero is returned if it is pressed, and a one is returned when it isn't.
623 ($26F) Player/Playfield Priorities (GPRIOR)
Priority options select which screen objects will be "in front" of the others. Players have precedence over all playfields when this location is one. A value of 4 gives the playfields priority over all of the players, and values 2 and 8 allow only some of the players to have priority over some of the players. In addition, the value 16 ($10) allows the four missiles to be combined into a fifth player, and a value of 32 ($20) allows players to be overlapped to produce a third color. This location is also used to enable the three GTIA modes.
704-707 ($2C0-$2C3) Player-missile Color Registers (COLPM0-COLPM3)
Each of these locations determines the color of a player and its corresponding missile.
53248-53251 ($D000-$D003) Player Horizontal Position Registers (HPOSP0-HPOSP3)
These write only registers determine the horizontal positions of each of the four players. Values range from 0-277 ($0- $116).
53248-53251 (D000-$ D003) Missile to Playfield Collision Registers (MOPF-M3PF)
These read only registers tell you which playfield the missiles have collided with. The values are as follows; Playfield #0- 1, Playfield #1 -2, Playfield #2 -4, and Playfield #3- 8.
53252-53255 ($D004-$DO07) Player to Playfield Collision Registers (P0PF-P3PF)
These read only registers tell you which playfield the players have collided with. The values are the same as with the missiles above.
53252-53255 ($D004-$D007) Missile Horizontal Position Registers (HPOSM0-HPOSM3)
These write only locations determine the horizontal positions of each of the missiles. Values range from 0-277 ($0-$116)
53256-53259 ($D008-$DOOB) Player Width Registers (SIZE0-SIZE3)
These write only locations control the widths of the players. Values 0 and 2 produce normal width players, 1 double width players, and 3 quadruple width players.
53256-53259 ($D008-$D00B) Missile to Player Collision Registers (M0PL-M3PL)
These read only registers determine collisions between missiles and players. The values are as follows; with player #0 - 1, player #1 -2, player #2 -4, and with player #3 -8.
53260 ($D00C) Missile Width Register (SIZEM)
This write only location controls the magnification of all four missiles. While a value of 0 or 2 displays all of the missiles at normal width, 1 displays all of the missiles at double width, and 3 displays all of the missiles at quadruple width, missiles widths can be set individually. Each missile is controlled in two bit pairs starting with the lowest. The bit values for the 0th missile is the same as above.
53260-53263 ($D00C-$D00F) Player to Player Collisions (P0PL-P3PL)
These read only registers return non-zero values when players collide. In general, the registers contain a 1 after a collision with player#0, a 2 after one with player #l, a 4 after one with player #2, and as 8 after one with player #3.
53277 ($DOID) Graphics Control Register (GRACTL)
This, when used in conjunction with DMACTL ($22F) enables player-missile graphics. A value of 2 enables player DMA only, a value of 1 enables missile DMA only, and a value of 3 enables both.
53278 ($D01E) Clear Player-missile Collision Registers (HITCLR)
You POKE this location with any number to clear the collision registers. This is normally done at the end of VBLANK after you have tested for all collisions.
54279 ($D407) Player-missile Base Registers (PMBASE)
This location contains the high byte starting address of your player-missile area.
65 ($41) Input/Output Noise Control (SOUNDR)
Disk read/write operations can be silenced by POKEing a zero to this location.
53760,53762,53764,53766 ($D200,$D202,$D204,$D206) Audio Channel Frequency (AUDFI-3)
These locations control the frequency of the sound channels. The value N is used in the divide by N circuit. Thus the notes or tone becomes lower when N becomes larger. N can be in the range 1-256.
53761,53763,53765,53767 ($D201,$D203,$D205,$D207) Audio Channel Control (AUDC1-4)
These registers set the volume and distortion levels.
53768 ($D208) Audio Control Register (AUDCTL)
This location allows two channels to be joined for greater frequency range, and allows the user to vary the poly-counters which control noise, or to switch the clock base from 64KHz to 15KHz for a change in frequency range. To properly initialize the POKEY sound capabilities POKE AUDCTL with zero and POKE 53775,3 ($D02F). This is equivalent in BASIC of SOUND 0,0,0,0.
18,19,20 ($12,$13,$14) Internal Realtime Clock (RTCLOK)
Locations 20 increments every VBLANK interrupt or 1/60 second until it reaches 255 ($FF). Location 19 is then incremented by one and 20 is reset to zero. Likewise, location 18 is incremented when 19 reaches 255. This happens every 18.2 minutes.
53770 ($D204) Random Number (RANDOM)
This location produces a random number from 0-255 ($0-$FF) when read.
58454 ($E456) Central Input/Output (CIO) Utility Entry (CIOV)
This is actually a subroutine in the OS ROM that is used to pass I/O operations to the correct device driver. Once parameters are set in the correct IOCB's you jump here to use them. While BASIC only supports one byte at-a-time I/O (GET and PUT), addressing CIOV directly allows the user to input or output a buffer of characters at a time.
58460 ($E45C) Set Vertical Blank (SETVBK)
This OS routine, which sets system timers during the VBLANK routine, insures that both bytes of the vector addressed will be updated while VBLANK is enabled.
58466 ($E462) Exit Vertical Blank (XITVBK)
This OS subroutine is used to restore the computer to its pre-interrupt state upon exiting the user's VBLANK routine. The computer can then resume normal processing.
Return to Table of Contents | Previous Chapter | Next Chapter