Mapping the XL/XE
New from the author of the classic Atari guidebook
by Ian Chadwick
There are a lot of changes in Atari Operating Systems since the original OS for the 400/800 models. Atari originally created a new OS for the ill-fated 1200XL, then modified it for the 800XL when the 1200 failed to get consumer support.
The new XE series is really just the XL in a new box. Only the 130XE has been changed. And the change is only in memory management for the additional 64K of RAM. Atari left a lot of the 1200 in the XL/XE OS including function key management and the self-test ROM which isn't useful to owners of the new models.
Described below are specific memory locations you can use to take advantage of special features in the newer Ataris. These are the features not found on the 400 or 800 models.
PEEKS & POKES
As an introduction to PEEKS and POKES, you can examine any memory location from BASIC by using a PEEK like PRINT PEEK (17) and placing any number between zero and 255 in any RAM location (some ROM locations too) with a POKE like POKE 708,71. The address you PEEK or POKE to can be any number between zero and 65535, but addresses higher than 40960 are taken up by BASIC and the Operating System ROM, so you can PEEK them, but not POKE most of them without some special techniques.
You can't hurt your computer by POKEing but you can crash your program or get your system locked up temporarily. Before you go POKEing about, make sure you first SAVE any program you're working on. If you get stuck, press [RESET], or re-boot your computer.
Several locations in the 400/800 OS were moved, or their functions were deleted entirely, and new uses were found for those addresses. Many previously unused (spare or reversed) bytes have been used for new or relocated OS operations. These are:
Name: | Decimal: | Hex: |
---|---|---|
PTEMP | 31 | $1F |
LINBUF | 583-622 | $247-$26E |
CSTAT | 648 | $288 |
TMPX1 | 668 | $29C |
HOLD5 | 701 | $2BD |
ADDCOR | 782 | $30E |
Name: | 800 location: | Moved to: |
---|---|---|
PTIMOT | 28/$1C | 788/$314 |
PBPNT | 29/$1D | 734/$2DE |
PBUFSZ | 30/$1E | 735/2DF |
CRETRY | 54/$36 | 688/$29C |
DRETRY | 55/$37 | 701/$2BD |
CKEY | 74/$4A | 1001/$3E9 |
CASSBT | 75/$4B | 1002/$3EA |
NEWROW | 96/$60 | 757/$2F5 |
NEWCOL | 97,98/$61,$62 | 758,759/$2F6,$2F7 |
ROWINC | 121/$79 | 760/$2F8 |
COLINC | 122/$7A | 761/$2F9 |
TEMP2 | 788/$314 | 787/$313 |
568 ($238), 569 ($239), 581 ($245), 654 ($28E),
713-735 ($2C9-$2DF), 745 ($2E9), 757-761 ($2F5-$2F9),
829-831 ($33D-$33F), 1000 - 1020 ($3E8-$3FC)
For detailed information about the changed uses, refer to Mapping the Atari (Revised Edition), by Ian Chadwick, Compute! Publications, Inc., 324 W. Wendover Avenue, Suite 200, Greensboro, NC 27408. (919)275-9809. $16.95.
SCREEN DISPLAY
Lots of popular games make use of fine scrolling across large multi-screen maps, usually in conjunction with an altered character set. You can do this vertically in GRAPHICS 0 without having to write special display lists.
LOAD a BASIC program, POKE 622,255 ($26E) and then LIST. The program scrolls smoothly off the screen. Now, if you type DOS and list the disk directory, you'll see fine scrolling is still enabled. Cancel fine scrolling by POKE 622,0.
Fine scrolling works with the text screen editor (E:) but other graphics modes still require special display list techniques.
You can redirect the screen display to the printer by POKE 838,202 and POKE 839,254 ($346, $347). To send it back to the display again, use POKE 838,175 and POKE 839,242.
CHARACTER SETS
The XL/XE has another set of letters and numbers the international, or European, character set. You can switch from your normal ATASCII display to this set by POKE 756,204 ($2F4) and return to the American set by POKE 756,224. If you change over, try typing several CONTROL-key combinations to see the other character set.
The international character set takes 1K of memory from 52224 to 53247 ($CC00-$CFFF). If you use a program to turn your OS ROM into OS RAM, you can use this space for your own routines or graphics.
THE KEYBOARD
You can control the delay rate for repeating keys and the speed of the repeat. Location 729 ($2D9) controls the delay between the time a key is pressed and the time it begins repeating, measured increments of 1/60th second each one VBLANK interval. Initially it is set at 48 0.8 seconds before a key will repeat. A short delay can speed things up, try POKE 729,6. Increase the delay time by POKE 729,120. Any number between one and 255 will do, while zero means no repeat at all.
Location 730 ($2DA) controls the repeat rate the number of times a key repeats in a second while you hold down the key. It is initially set at 6. Like 729, the rate is a measure of VBLANK intervals (60ths of a second), so this default value is 10 repeats per second. Therefore, 60 would be one a second, 1 would be 60 per second. Zero means no repeats at all.
To disable the keyboard completely, POKE 621,255 ($26D). You'll have to press [RESET] to regain control, or have your program POKE zero into this location (perhaps when a console key is pressed, since this doesn't lock out the console keys).
You can redefine the keyboard by rewriting the system keyboard definition table. The address is stored in 121 and 122 ($79, $7A; LSB/MSB) and normally points to 64337 ($FBS1). This is a 192-byte table of keystrokes. The first 64 are lowercase, then key plus [SHIFT] and finally key plus [CONTROL] in the following order (reading left to right):
l j ; F1 F2 k + * o ... p u RETURN i - = v ... c F3 F4 b x z 4 ... 3 6 ESC 5 2 1 , SPACE . n ... m / inverse r ... e y TAB t w q 9 ... 0 7 BACKS 8 < > f h d ... CAPS g s a
The F1-F4 keys are function keys for the 1200XL. They have their own definition table vector at 96, 97; $60, $61. The keys marked "..." are unused. Remember when writing a new table that shifted "w" is "W" but a shifted "5" is "%" and [CONTROL] with a key gives a graphic symbol or command, just like on your keys. Use the ATASCII values for your table, then POKE the address into these locations. One use would be to design a Dvorak keyboard or to mask out unwanted keys for input.
Many 400/800 programs made direct jumps to keyboard 'get' and 'put' routines rather than through the proper vectors, which makes them incompatible with XL/XE machines. The get routines in the XL/XE begin at 62026 ($F24A). This was 63038 ($F63E) in the 800. The put routines begin at 62128 ($F2B0). or 63140 ($F6A4) in the 800. If you have a program which won't work on your XL/XE, try finding if it uses these locations and change them.
Other routines, like printer I/O have also moved. But if the program uses the vector address and doesn't jump to the routine directly, it should still work. Vector tables are located between 58368 and 58495 ($E400 to $E47F) and jump vectors between 58488 and 58508 ($E450 to $E48C).
KEYBOARD CLICK
The XE and XL computers produce a noisy chirp each time a key is pressed. You can turn it off by POKE 731,255 ($2DB) and back on with POKE 731,0. The difference betwen turning the volume on your TV down and POKEing 731 is that other sound prompts are still active cassette or disk load sounds for example. Only the keyboard is silenced.
THE HELP KEY
Many programs use the [START],[SELECT] and [OPTION] keys, they register a key press at 53279. But few use the [HELP] key, because it uses a new location, 732 ($2DC). You can PEEK the status of the [HELP] key in your own programs. A 17 means HELP has been pressed, while 81 means it has been pressed with the [SHIFT] key and 145 means it has been pressed with [CONTROL]. That number remains in 732 until you POKE it with zero to clear it.
BASIC
Did you forget to hold down the [OPTION] key when you turned on the computer? Instead of rebooting the system, simply POKE 1016,255 ($3FB) with any non-zero number and press [RESET]. You'll jump to DOS immediately and the system won't see BASIC installed. Of course, if you want to go to BASIC later, you'll have to re-boot.
MEMORY MANAGEMENT
Location 54017 ($D301) was PORTBthe register for the third and fourth joystick or paddle ports on the 800. Now it's used for memory management:
Bit: Use 0 0 disables ROM from 49152 to 53247 ($COOO-$CFFF) and 55296 to 65535 ($D800-$FFFF) 1 0 means BASIC is enabled, 1 = disabled 2 130XE memory management (see Antic, November 1985) 3 ditto (controls extra 64K bank access) 4 ditto (in 16K blocks addressed by ANTIC, the 6502) 5 ditto (or both) 6 reserved for future use (256K XE?) 7 0 means self-test ROM enabled, 1 means RAM enabled
The new use of PORTB was described in Antic, November 1985 in my article 130XE Memory Management. Bits 2 through 5 are used by the "Freddie" chip in the 130XE, the only difference between the XE and XL computers.
OTHER LOCATIONS
There isn't space here to cover the entire XL/XE memory map. You'll find a complete description in my revised edition of Mapping the Atari. But here are a few other locations unique to the XL/XE computers.
CMCMD (07, $07) is used as a flag for passing commands to the 835 and 1030 modems. When it's not zero, it passes a command.
PALNTS (98; $62) holds the version of the display handler. Zero for North America.
DSCTLN (725, 726; $2D5, $2D6) is the disk sector size. A default of 128 bytes, it can be as large as 65535 though most drives won't support a non-default size.
DMASAV (735; $2DD) was designed to restore the 1200XL display if disabled. If you POKE DMASAV with your DMA value from 559 ($22F) 34 for GR.0 screens then you can disable the display with POKE 559,0. Any key press moves the value in DMASAV back to 559 and restores the screen!
PUPBT (829-831; $33D-$33F) are three registers used to test memory integrity on warmstart. If the values aren't 92,147 and 37 ($SC, $93, $25) respectively, the system does a coldstart when you press [RESET].
GINTLK (1018, $3FA) reads one when an external cartridge is installed, zero if not (or if ROM BASIC is in use).
The self-test code is actually in the OS ROM, hidden below the GTIA, ANTIC and POKEY chip area ($D000 to $D7FF). When called, it is moved down to the area between 20480 and 22527 ($5000-$57FF) and run from there. If you can burn your own OS EPROM, you could replace this code with something far more useful, like a monitor.
What was once an empty 4K block in the 800 is now used for interrupt handlers and for the international character set 49152 to 53247 ($C000-$CFFF). Some older 800 programs test this area for certain allowed values before they will run. This is to discover if you have something "unofficial" like Omnimon in that space. You may need the FIX XLtranslator disk in such a case.
There is also a fair amount of code used for the parallel device handler, including considerable RAM space reserved for device variables. Since manufacturers have not taken advantage of this rather powerful feature, the code doesn't do anything and the numerous RAM locations can be used for your own storage. For example, addresses 713 to 724 ($2C9-$2D4). Rumors abound about a revised, enhanced OS due soon one which corrects various faults like the printer timeout. If and when such an OS is released, I'll report the changes here for Antic readers.
Ian Chadwick is the author of the standard reference book for serious Atari programmers, Mapping the Atari. We are also proud to announce that he has now joined Antic Magazine as a Contributing Editor.