Classic Computer Magazine Archive COMPUTE! ISSUE 47 / APRIL 1984 / PAGE 143

Hidden Atari DOS Commands

Jason Lex Thomas

Even if you have only one disk drive, you can use COPY FILE and a few one-line programs to add power and convenience to your Atari DOS. There are a number of short examples to type in and try out.

The Atari Disk Operating System (DOS) menu is a very powerful tool. It provides many selections to help both the beginner and the advanced user get the most out of the Atari computer system. This article explores some special uses of selection C, COPY FILE.

COPY FILE is mainly used by owners of two or more disk drives who wish to transfer a file or series of files between drives. This is a powerful alternative to using the DUPLICATE FILE selection (option O). But COPY FILE also can be used in other ways, even if you have only one drive.

The Key Is Device Names

Before we get into the details, though, let's examine a few aspects of Atari DOS. When you select COPY FILE from the menu, the system asks you for source and destination filenames. The interesting fact is that you can also enter a device name here. (Not all device names are legal, but quite a few are.) This is not that surprising, because the Atari is an input/output based machine. To prove it, this BASIC program

10 PRINT "enter your name"
20 INPUT A"

can easily be written as

10 OPEN #1, 4, 0,"E:"
20 PRINT #1;"enter your name"
30 INPUT #l;A$
40 CLOSE #1

The result is about the same. And the Atari BASIC interpreter translates the two programs into similar code. The Atari uses these input/output control blocks (also called channels) for the editor (E:), keyboard (K:), and screen (S:) without the user having to know anything about them.

Confidential Input

Note that in line 10 of the second program above, the input and output are processed through the editor. We could have opened the keyboard (K:) instead, but then the name we keyed in would not have appeared on our screen. If we were incorporating a password routine into our program, we could open the keyboard rather than the editor, so that the password we enter will not be echoed to the screen.

To relate all this to COPY FILE, you can get a listing of a program or a printout of a sequential disk file if you select COPY FILE and then type:

D : filename,P:

when it asks you for the source and destination filenames. This will print the information that is in D:filename on the printer. This works well for programs you have LISTed to a diskette.

It also works for sequential text files that you have created for uploading or downloading on data base networks like CompuServe. Unfortunately, the cassette handler (C:) is not supported by the COPY FILE selection.

Copy Keyboard Entries To Disk

Perhaps the most intriguing device combination that you can enter is

E:,D: filename

which will let you copy anything that you type into a disk file.

The power of this technique derives from the fact that Atari has a direct-mode BASIC. That is, some BASIC instructions can be entered and executed immediately without a line number. Of course, instructions such as GOTO, GOSUB, and a few others which require line numbers are not as useful as if they are within a program.

The next few programs must be typed in using the abbreviations. To type these in, do the following:

  1. Type DOS to go into the DOS menu.
  2. Select option C. COPY FILE.
  3. When it asks for filenames, type in E:,D:filename (for the programs that follow).
  4. Type in the one-line program, followed by a carriage return.
  5. Type a CTRL 3 to tell the system that you have finished.
  6. At this point, you return to the DOS menu.

To use these programs from BASIC, simply type in

EN."D:filename

and the program will begin execution automatically. The best thing of all about these programs is that they occupy only one disk sector each and simulate many of the DOS commands without actually going to the DOS menu. Also, they require little memory and leave your program intact. It's great to be in the middle of program editing and only need to type EN. "D:DIR to get a directory.

These examples are all one-line programs, but you can have multiple lines. You'll have to be a little careful. Remember, no GOTOs or GOSUBs allowed!

Following is a series of programs which are keyed in using the COPY FILE function to copy from the editor to the disk. These programs are just a few examples of what can be done. All of the programs are to be keyed in followed by a single carriage return and a CTRL 3 as explained in the body of the text.

Disk Directory

This program displays a directory of the files on the disk in drive 1. Note that an Error 136 will occur at the end of the listing if you have fewer than 64 files on the diskette. This occurs because you have reached the end of file and can't TRAP anywhere. Simply type END and <RETURN> when through. Here's D:DIR:

CLR : T.40000 : CL . #1 : 0 . #1, 6, 0, "D : * . * " :
DIMA$(30) : F . X = 1TO64 :I . #1;A$ : ?A$ : N . X :
 CLR : CL . #1 : END

Erase File

This program will ask you which file you wish to delete from the disk, and then delete it without going to DOS. The program D:KILL follows:

CLR : T.40000 : CL.#1 : 0.#1, 4, 0, "E : " :  DIM
A * (30) : ?"killfile-" : I . #1;A" :  CL . #1 :
O . #l, 4, 0, A$ : XI033, #1, 0, 0, A$ : CL . #l : CL
R : END

Protect File

This program, D:LOCK, performs the LOCK FILE function of the DOS menu:

CLR : T.40000 : CL.#1 : 0.#1, 4, 0, "E : " : DIM
A$ (30) : ?"lockfile-" : I . #1;A" : CL . #1 : 0
. #1, 4, 0, A$ : XIO35, #1, 0, 0, A" : CL.#1 : CLR
: END

Disable File Protection

D:UNLOCK will perform the UNLOCK FILE selection of the DOS menu:

CLR : CL . #1 : 0 . #1, 4, 0,"E : " : DIMA$(30) :  ?
"unlockfile" : I . #1;A$ : CL . #1 : 0 . #1, 4, 0,
A$ :  xio36, #1, 0, 0, A$ : CL . #1 : CLR : END

Format Disk

D:FORMAT performs the FORMAT DISK option of the DOS menu:

CLR : CL . #1 : 0 . #1, 4, 0."E : " : ?"insert disk
to format and hit any key" : GET #1, A
: CL . #1 : XIO254, #1, 0, 0, "D1 : " : END

Write DOS

This program performs the WRITEDOS function of the DOS menu. However, D:WRITEDOS will write DOS.SYS only:

CLR : CL . #1 : 0 . #1, 4, 0, "E : " : ?"Insert disk
to write DOS & hit any key" : GET#1;
A : CL . #1 : 0 . #1, 8, 0, "D : DOS . SYS" : CL . #1

Change Colors

This program will allow you to alter the screen color as you desire. Try different number combinations for the POKEs into the color registers until you find a combination that suits you. This is D:COL:

POKE 709, 0 : POKE 710, 10 : POKE 712, 114