Classic Computer Magazine Archive COMPUTE! ISSUE 65 / OCTOBER 1985 / PAGE 98

Using The
Atari 130XE
And DOS 2.5

Tom R. Halfhill, Edtor

The Atari 130XE is the first computer in Atari's XE line and by far the least expensive 128K RAM computer on the market. Here's a guide to using the new features of the 130XE and the latest version of Atari DOS.

Making good on its promise to continue supporting the 8-bit line of computers first introduced in 1979, Atari recently brought out the 130XE, its most powerful 8-bit machine yet. Atari also started distributing free copies of its new disk operating system, DOS 2.5, to solve some compatibility problems between the single-density DOS 2.0 and the enhanced-density DOS 3.
    Both products are evolutionary rather than revolutionary. DOS 2.5 bears a strong resemblance to DOS 2.0 and is designed to smoothly handle both Atari disk formats. Likewise, the 130XE has much in common with the XL series and original 400/800. Because the 130XE's internal operating system is virtually identical to the 800XL's, the 130XE works with all existing Atari peripherals and nearly all the software. Nevertheless, the 130XE does incorporate some features not found on earlier Ataris:
    • 128K of Random Access Memory (RAM), with the extra 64K accessible by bank-switching in 16K banks. Without bank-switching, the amount of free memory for BASIC programs remains the same as on 48K and 64K Ataris-about 32K or 37K, depending on whether DOS is booted.
    • A high-speed RAM disk option for the extra 64K when DOS 2.5 is booted with a special startup file. (A RAM disk is a disk drive simulated in memory; you can save and load files much faster with a RAM disk than with a conventional disk drive, although the contents of the RAM disk are erased when power is shut off.) The RAM disk can be disabled if you want to use the extra 64K for other purposes.
    • Revision C Atari BASIC. The 130XE's BASIC has been cured of the infamous lockup bug that plagued the revision A BASIC cartridge sold for the 400, 800, and 1200XL, and the even-worse bugs that infested revision B BASIC in the 600XL and 800XL when Atari tried to fix revision A.
    • Enhanced Cartridge Interface (ECI) for future expansion. The expansion connector found on the rear of the 600XL and 800XL has been slightly redesigned for the 130XE. The new ECI is supposed to be more versatile than the rarely used XL connector, allowing you to add faster disk drives, hard disks, and other devices-none of which have been announced, however. (Don't confuse the ECI with the ROM cartridge slot, which is fully compatible with cartridges made for older Atari computers.)
• Chroma and luma video outputs for sharper screen displays. This allows you to hook up the 130XE to video monitors with separate chroma and luma inputs for a much sharper image than with normal composite video. The old Atari 800 had this feature, but it was eliminated on later models.

Dual-Personality DOS
Before examining the 130XE's new features in greater detail, let's cover the new functions of DOS 2.5, since they affect all users of 8-bit Atari computers as well as 130XE owners.
    First of all, if you don't have a copy of DOS 2.5, get one soon. Atari is shipping DOS 2.5 with 1050 disk drives and distributing it free through user groups, electronic bulletin boards, and the Atari forum on CompuServe. It is quickly replacing DOS 3 because it integrates the best features of existing DOS versions, is compatible with all Atari computers, and works interchangeably with both single-density (810 format) and enhanced-density (1050 format) disk drives. (Of course, enhanced density disks are still unreadable on 810 drives.)
    The new DOS menu is identical to the DOS 2.0 menu except for one extra feature: option P, Format Single. Since DOS 2.5 is a dual-density DOS, it must be capable of formatting disks for both single density and enhanced density. Option P formats a disk in single density, leaving 707 sectors free (about 88K of storage). Option I, Format Disk, now defaults to enhanced density, leaving 1010 sectors free (about 126K). Also, one existing option has been slightly changed: Option j, Duplicate Disk, now formats the target disk before copying.
    Three new utility files are included with DOS 2.5. The first, SETUP.COM, lets you customize DOS in various ways without the POKEs that used to be necessary. For instance, you can significantly speed up disk accesses by turning off the write-with-verify mode. You can also set up one of three AUTORUN.SYS files: the usual RS-232 handler for the 850 Interface Module; a file which automatically boots a BASIC program; or a file which boots both the RS-232 handler and a BASIC program.
    The second utility, DISKFIX.COM, can help clean up garbled disks by closing open files and verifying that allocated sectors correspond to information in the disk directory. It can even recover deleted files, as long as new data hasn't been saved over the deleted data. The third utility, COPY32.COM, converts DOS 3 files to 2.0/2.5 format. All three utilities guide you with screen prompts and are nearly foolproof.

New Disk Commands
DOS 2.5 also makes a few additional disk commands available in BASIC. There are now two methods of reading a disk directory:

OPEN #1,6,0,"D:*.*":FOR X=1 TO
 lE9:GET #1,A:? CHR$(A);:NEXT X
OPEN #1,7,0,"D:*.*":FOR X=1 TO
 1E9:GET #1,A:? CHR$(A);:NEXT X

    The first method is the same as before. But the second method identifies files in the directory which cannot be accessed from DOS 2.0 because they occupy extra sectors on an enhanced-density disk. These files are flagged by a pair of less-than/greater-than symbols, such as <FILENAME.BAS>.
    Also, there are now three ways to format a disk from BASIC:

XIO 253,#1,0,0,"Dl:"
XIO 253,#1,34,0,"D1:"
XIO 254,#1,0,0,"Dl:"

    The first XIO statement formats a disk in single density. The second formats in enhanced density (generating an error 139 if attempted on an 810 drive). The third XIO statement attempts to format in enhanced density, then switches to single density if the drive isn't 1050-compatible.
    Incidentally, if you select option j (Duplicate Disk) with DOS 2.5 when using a 1050 drive, the disk is automatically formatted in enhanced density before copying starts. Keep this in mind if you're duplicating a disk for someone who doesn't have an enhanced-density drive. Instead, you'll have to format the destination disk for single density (option P) and then copy the source disk one file at a time.

  Memory Location 54017 (130XE Only)

 Bit Position Function

If 1, enable OS ROM, disable RAM from $C000-$FFFF (default)
If 0, disable OS ROM, enable RAM from $C000-$FFFF
If 0, enable BASIC ROM at $A000-$BFFF (default)*
If 1, disable BASIC ROM, enable RAM at $A000-$BFFF
If 00 (decimal 0), switch first 16K bank of extra 64K into $4000-$7FFF
If 01 (decimal 4), switch second 16K bank of extra 64K into $4000-$7FFF
If 10 (decimal 8), switch third 16K bank of extra 64K into $4000-$7FFF
If 11 (decimal 12), switch fourth 16K bank of extra 64K into $4000-$7FFF
If 1, deny 6502 access to extra bank (default)
If 0, allow 6502 access to extra bank
If 1, deny ANTIC access to extra bank (default)
If 0, allow ANTIC access to extra bank
Not presently used. Default = 1
If 1, disable self-test ROM, enable RAM at $5000-$57FF (default after powerup)
If 0, enable self-test ROM, disable RAM at $5000-$57FF

*Note: A similar chart on page 122 of the 130XE Owner's Manual indicates that bit 1 should always be set. However, bit 1 should not be set unless you want to disable BASIC.

Instant DOS
The 130XE's extra 64K RAM can be used as either a superfast RAM disk with DOS 2.5 or as additional memory for programming. Of these two options, the RAM disk is by far the easiest to use, especially for those who aren't too familiar with bankswitching or bit manipulations.
    The only accessory you need to set up a RAM disk with the 130XE is a free DOS 2.5 file called RAM DISK.COM. When you boot DOS 2.5 on a 130XE, RAMDISK.COM automatically initializes the RAM disk and loads two DOS files: DUP.SYS and MEM.SAV DUP.SYS is the DOS utility package-the part that normally must be loaded from disk when you type the DOS command in BASIC. Usually this takes 10 to 20 seconds or more. But with DUP.SYS stored in the RAM disk, the DOS 2.5 menu comes up almost instantly when you type DOS.
    The second DOS file stored in the RAM disk, MEM.SAV, temporarily saves the portion of BASIC memory that would be overwritten when you enter DOS. That means you can enter DOS and return to BASIC without losing your BASIC program.
    DUP.SYS and MEM.SAV take up 87 sectors total, leaving the RAM disk with 412 free "sectors"-51.5K of high-speed (though temporary) storage. If you don't mind waiting for the DOS menu to load from disk as usual, you can delete DUP.SYS and MEM.SAV from the RAM disk to create 499 free sectors (62.3K).
    You access the RAM disk by addressing it as drive 8 (D8:). For example, LOAD"D8:FILE NAME.EXT" or SAVE"D8:FILENAME.EXT" Almost all DOS commands work, too: Disk Directory, Delete File, Rename File, Copy File, Lock File, Unlock File, Binary Load, Binary Save, and Run At Address.
    Duplicate File doesn't work because there's no way to swap disks with a RAM disk (use the two-drive Copy File command instead). Also, the Format Disk and Duplicate Disk commands sometimes cause strange results and should be avoided. For instance, if you erase DUP.SYS by deleting it or formatting the RAM disk, then replace it by duplicating a floppy disk that contains DUP.SYS, you might not be able to enter DOS from BASIC afterward.
    Aside from these exceptions, the 130XE RAM disk seems to be very transparent; it's worked with everything we've tried. Although a RAM disk is no substitute for a floppy-it's at the mercy of power interruptions and system crashes - it can make a world of difference when running disk-intensive applications, such as assemblers, compilers, database managers, mailing list programs, and word processors with linked files.

Like Memory In The Bank
Using the 130XE's extra memory for programming is a lot more difficult than using it as a RAM disk. For one thing, the 6502 microprocessor which is the central brain of 8-bit Atari computers was not designed to access more than 64K memory at a time. So even though the 130XE has 128K RAM, the 6502 is "blind" to the extra 64K.
    Making the extra memory visible requires a technique known as bank-switching. A block, or bank, of memory in the regular 64K is temporarily switched off and replaced with a bank from the "hidden" memory. Under program control, banks can be switched in and out at will. It's sort of like reading a book and flipping between the page you're on and a footnote section in the back.
    The 130XE organizes its extra 64K RAM into four 16K banks. Only one of these banks can be switched in at a time. When you're using the RAM disk, the RAMDISK.COM file and DOS 2.5 handle these details for you automatically. But using this memory for other purposes means writing your own bank-switching routine in BASIC or machine language.
    Bank-switching on the 130XE is controlled by memory location 54017 ($D301 hexadecimal). This byte was previously reserved for port B of the Peripheral Interface Adapter (PIA), an input/output control chip. On the Atari 400 and 800, it's used for controller jacks 3 and 4, which have been eliminated on the XL and XE series. On the 1200XL, part of this byte controls the keyboard LEDs, which were dropped from the 600XL, 800XL, and XE series. On all XLs and XEs, location 54017 also lets you switch off the operating system and BASIC ROM to reveal the full 64K RAM underneath. On the 130XE, you can now flip other bits at this location to switch on any 16K bank of the extra 64K RAM into the address space from 16384 to 32767 ($4000 to $7FFF). See the accompanying table for a guide to this important address.
    Notice that bits 4 and 5 control whether the 6502 and ANTIC chips can access the extra banks of memory. Some special applications may blind either chip from seeing the banks. Also note that the 130XE Owner's Manual contains errors on page 122 when explaining how location 54017 works. The location normally contains 241 when the RAM disk is booted and 253 otherwise, not 193; and all bits except bit 1 should be set for normal operations.
    If you're an experienced machine language programmer, you shouldn't have any trouble ma nipulating the bits at location 54017. BASIC programmers won't have it so easy, because bit-flipping is rarely required in BASIC and Atari BASIC lacks bitwise operators. So try this formula:

POKE 54017,193+4*bank+16*mode

 where bank is the 16K bank you want to select (0 = bank 1, 1 = bank 2, 2 = bank 3, 3 = bank 4) and mode chooses which chip has access to the extra banks (0 = 6502/ANTIC, 1 = ANTIC, 2 = 6502, 3 = neither).
    A word of caution: One wrong POKE into this critical memory location could instantly disable the operating system or BASIC or both, triggering a hopeless system crash. The only recovery might be to switch the machine off and then on again, wiping out your program. So be careful when experimenting.