Classic Computer Magazine Archive COMPUTE! ISSUE 51 / AUGUST 1984 / PAGE 102


Bill Wilkinson

The assembler listing which accompanies this article is a set of patches to Atari DOS 2.0s. If you own an Atari 1050 drive, these patches will allow you to use it in "enhanced density" mode.

Before we get started with the listing and its explanation, though, let's look at a new tidbit.


Are you an 800XL owner? Do you have an unprotected diskette which boots a machine language program via an AUTORUN.SYS file? Would you like to avoid pushing the OPTION button? Are you willing to follow a few simple steps to do so?

Your 800XL enables and disables the built-in BASIC by changing the contents of location $D301 (54017). In Atari 400s and 800s, this location is usually used to input the state of joysticks 3 and 4. In an 800XL, this port controls various system hardware configurations.

For example, bit 0 of $D301 controls whether the OS ROM is active or whether you are using the RAM underneath it. And—guess what—bit 1 of $D301 controls whether the builtin BASIC is active or not. Specifically, the following table applies:

Bit 0 = 1 OS ROM enabled
         0 OS ROM disabled, RAM enabled
Bit 1 = 1 Atari BASIC disabled, RAM enabled
	 0 Atari BASIC enabled

At least one of the other bits in $D301 is used (to control whether or not the diagnostic ROM is enabled), but the "normal" values for $D301 are either $FF (BASIC disabled) or $FD (BASIC enabled).

No Option Button

So all we need to do is add a couple of instructions to our AUTORUN.SYS file, to select RAM instead of BASIC, and we will no longer have to hold down the OPTION button. For example, we might add:

STA $D301

And, yet, there is an easier way. Remember, Atari LOAD files may consist of multiple segments, each of which starts with a start address and an end address. The entire file starts with a pair of $FF bytes, but it doesn't hurt if there are extra $FF header bytes in front of other segments.

So consider: If we specify that we have a LOAD file which starts at location $D301 and ends at location $D301, the DOS file loader will try to load (and thereby store) a single byte at location $D301. This is equivalent to storing a byte via our program.

Disabling BASIC

So simply use the following steps to modify your AUTORUN.SYS to disable the built-in BASIC:

Under Atari DOS 2.0s:

  1. Boot your DOS disk while holding down the OPTION button.
  2. Put the disk containing the AUTORUN.SYS you want to modify into drive 1.
  3. Use the E option from the DOS menu. When prompted for old and new filenames, respond: D : AUTORUN.SYS, AUTORUN.OLD
  4. Use the K option from the DOS menu. When prompted for filename, starting address, etc., respond: D:AUTORUN.SYS, D301, D301
  5. Use the C option from the DOS menu. When prompted for from and to filenames, respond: D:AUTORUN.OLD, AUTORUN.SYS/A

Under OS/A+ or DOS XL:

  1. Boot your DOS disk while holding down the OPTION button. If the DOS XL menu appears, use the Q option.
  2. Put the disk containing the AUTORUN.SYS you want to modify into drive 1.
  4. Type the command: SAVE AUTORUN.SYS D301 D301
  5. Type the command: COPY – AF AUTORUN.OLD AUTORUN.SYS

And that's it. Your AUTORUN.SYS file should now be ready to use.

Check The Pointers

Caution! Even though the built-in BASIC is now disabled, HIMEM (the contents of location $2E5) and RAMTOP (contents of location $6A) will still reflect the 40K byte configuration where BASIC is present. If your program pays attention to one or both of these two values, it would also be worth performing the following steps:

  1. Change RAMTOP to reflect the full 48K bytes.
  2. Close channel zero (the screen editor).
  3. Open channel zero for the E: device.

These steps will insure that all 48K bytes of accessible RAM are in use by your program. I won't go into how to accomplish these here and now. Write if you would like me to show how to code those steps in machine language.

Coming Attractions

A project related to this, which I hope to implement in an upcoming column, would be an "M:" device driver. Once upon a lifetime ago, in this column, I presented such a driver. It used the "excess" memory (between the top of a BASIC program and the bottom of the graphics screen) as a pseudodevice.

I would like to do the same thing again, but this time use the extra memory under the OS ROMs or under the built-in BASIC as a superfast RAM disk. Stay tuned for further developments.

DOS 2.0s For Enhanced Density 1050s

First, I would like to point out that the task of reconfiguring Atari DOS 2.0s for an enhanced density 1050 is difficult. I would also like to note that it is extremely difficult (if not impossible) to finish the task if you have only one drive.

So, may I suggest that you cooperate with a friend and his drive if you have only one of your own. If your friend's drive is an 810 or a non-Atari drive, it should be set up as drive 1. Your 1050 should be set up as drive 2.

Also, you should use an assembler capable of placing its object code directly in memory. (For example, AMAC—the Atari Macro Assembler—cannot be used for this job.) This is because loading the DOS-modifier code from a disk will use DOS itself, and you are almost guaranteed to run into conflicts. Atari's Assembler Editor cartridge, the old OSS EASMD, OSS's MAC/65, and (I believe) SYNASSEMBLER will all work properly (though the syntax for SYNASSEMBLER may vary a bit from what I show here).

You should boot a normal Atari DOS 2.0s disk, making sure that you can access a normal single diskette in drive 2 (at least to the point of making sure you can list its directory). Be sure you have at least two (2) blank or junk disks ready and at hand. Then begin.

Patching DOS

Type in the program, as shown herein. You may use automatic line numbering if you wish. Type in just the part from the right of the line num­bers. LIST or SAVE the source code to disk and then assemble it. Check it against the listing given here. Do not proceed until you are reasonably sure that you have typed it in and assembled it correctly.

Then change line 1000 to read:


and assemble the code once more.

Voilà! DOS has been patched!

But, because DOS's DRVTBL has changed format, you must now hit the SYSTEM RESET key. Then give the DOS command from your assembler. Assuming that you get to the DOS menu (and if you don't, you did something wrong), it would probably be a good idea to immediately format (menu option I) a blank disk in drive 1 and write the DOS files (option H).

Implementing Enhanced Density

Now comes the tricky part. The way we have patched DOS 2.0s, DOS automatically checks each drive at power-on (or SYSTEM RESET) time to find its current configuration (single density, double density, or enhanced density). But the 1050 assumes it is in single-density mode unless you have inserted an enhanced-density diskette. So, up until now, DOS thinks it is working with all single-density disk drives. How do we change its mind?

The easy way: Turn your power off, put your BASIC (or BASIC XL) cartridge into your machine, and turn the power back on, thus booting the disk we just formatted and wrote DOS files to. Insert a blank disk into the second drive (your 1050). From BASIC, give the following command:

XIO 254, #l, 0, 34,"D2 : "

If you are a faithful reader, you will recognize that as the format command, given from BASIC. But the 34 in the next-to-last position is new! That's right. As we have patched DOS, a nonzero value given in AUX2 is assumed to be the format command value to be sent to the disk drive. The only legal values here are 33 (for single density, à la 810 drives) and 34 (for 1050 enhanced density)!

Now drive 2 contains what we hope is an enhanced-density diskette. Once more, hit SYSTEM RESET so that DOS will recognize the new density. Then give the DOS command from BASIC. Once in DOS, use the H menu option to write the DOS files to drive 2.

If you have performed all these steps correctly, you should now have a bootable enhanced-density diskette in drive 2. You might wish to change your 1050 back to being drive 1 and try to boot from it with this new diskette.

Simpler Commands

The beauty of this system is that, once you have created this one enhanced-density master, you may make new enhanced-density masters by using just the I and H commands from the DOS menu.

There is, however, one potential problem. How do you copy files from an old single-density disk to a new enhanced-density disk? For now, the only practical way is to borrow a second drive and have one of each type of disk on your system. There may be ways around even this problem. We'll see.

Patching Other DOS Versions

The patch program given here will also work on all versions of OS/A + and DOS XL from 1.2 to 2.3 (except that it will not patch the DOSXL.SYS versions).

The procedures are almost the same, but it is significantly easier to use a single drive. Try the following if you have only a single disk, on which you boot OS/A+ or DOS XL:

Patches To Atari DOS 2.0s
0000			1000	•OPT LIST, NO OBJ
	         	1010 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
		   	1030 ; PATCHES TO ATARI DOS 2.0S
			1040 ;
			1070 ;    DOS 2.0S, TO A MAXIMUM OF 965 FREE SECTORS
			1100 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
			1110 ;
			1140 ;		    "INSIDE ATARI DOS"
			1160 ;
	=1311        1170 DRVTBL = $1311
	=1301		1180 CURFCB = $1301
	=0048		1190 ZSBA =  $48
	=11DB		1200 DERR1 = $11DB
	=12FE		1210 DRVTYP = $12FE
	=0021		1220 DCBCFD = '!
	=0302		1230 DCBCMD = $0302
	=0045		1240 ZDRVA = $45
	=0A4A		1250 NOBURST = $0A4A
	=0A4C		1260 WRBUR = $0A4C
	=0D18		1270 XFORMAT = $0D18
	=0BD6		1280 XFV =   $0BD6
	=1372		1290 Z =	$1372
	=034B		1300 ICAUX2 = $034B
	=1382		1310 FCBOTC = $1382
			1340 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

The rest of this listing will appear in "Insight: Atari" next month.

  1. Type in, save, and check out the patch listing as described above.
  2. Hit SYSTEM RESET. If you end up back in an assembler cartridge, type a DOS command.
  3. From the D1: prompt, use an INIT command. Or use the I option from the DOS XL menu.
  4. Use Option 1 (on a blank disk) or 3 (on an existing disk) of INIT. Use Option 4 to re­turn to DOS.
  5. Insert a BASIC cartridge. Reboot from the disk you just INITed.
  6. Type the following BASIC command: XIO 254, #1, 0, 34, "D1:"
  7. Hit SYSTEM RESET after the formatting is finished. If you are not then in the BASIC cartridge, use the CAR command.
  8. Type the following BASIC command line: OPEN #1, 8, 0, "D1 : DOS.SYS" : CLOSE #1

The reason the procedure works on a single drive is that neither OS/A+ nor DOS XL re­quires the DUP.SYS file of Atari DOS. The disk initialization can thus be performed entirely from BASIC.