Classic Computer Magazine Archive COMPUTE! ISSUE 49 / JUNE 1984 / PAGE 116

MacroDOS For Atari

Part 1

Jerry Allen

This utility will simplify Atari disk operations, allowing you to read the directory and erase files without losing the program in memory.

MacroDOS is an instant access disk utility package for a one- or two-drive DOS 2.0 system. MacroDOS uses only three pages of RAM and therefore can be permanently coresident in memory with the FMS. You can pretty well forget about MEM.SAV. And when you call DOS, you won't have to worry about losing your BASIC or machine language program when you return. The utility can also be used without a cartridge.

MacroDOS supports all the normal DUP functions excepting file and disk duplication, some of which can still be accomplished with the SAVE (binary file) command. Also, MacroDOS incorporates a new feature to DUP systems: hex or dec RUN and address entries, and a permanently available hex-to-decimal, decimal-to-hex converter. You'll have no more lost time looking for that subroutine, which must be around somewhere, or couldn't be loaded anyway because it conflicts with something that is in memory.

You will still be allowed the option of using Atari DUP, but now, before you take that step, the directory can be safely checked to confirm that MEM.SAV is indeed there.

A Safe Location

MacroDOS resides in memory after the FMS, where Atari DUP would normally load. The big difference here is that it pushes MEMLO up to stay out of the way of your programs. You will still have use of page 6, page 4, and even page 1. When SYSTEM RESET or BREAK is hit, MacroDOS will reinitialize itself unless you have exited to Atari DUP, which resets the old vectors.

Some of the MacroDOS operations differ slightly, but if you have used Atari DOS-DUP, there is really little to learn, and you may even find that the new operation is easier to master and execute.

When working with MacroDOS, you should be using DOS. SYS 2.0S in the same (or a smaller) configuration that comes on your master disk. If the listing for the machine language program (Part 2, next month) is used, you should be able to realign the program for larger versions of DOS.SYS using more buffer space. The program will check MEMLO and change everything accordingly.

The program included this month, however, is for BASIC users, and it's constrained to using a version of DOS.SYS which, after it has loaded, has a MEMLO of 7420 ($1CFC), or less. Use the direct mode command as follows to check if in doubt: PRINT PEEK(743) + 256*PEEK(744). If your DOS.SYS has not been altered from the master disk, MEMLO will be 7420.

A Few Prompts To Learn

There are a few new prompts. First is the > prompt, which expects the return of a function command's first letter. The directory, format, and write DOS functions use the prompt D# and expect just a single number of 1–4, or just a RETURN, which defaults to drive 1. The format command also uses a ? to ask if you're sure, and looks for a Y or YES before proceeding.

Functions requiring a filename use FN?. The device name (D:, Dl:, or D2:) must be included in the name. Rename (RNM) requires only one device name and none for the name after the comma. The @ prompt is used to mean "at" or "to" when an address input is required. Asterisk wild cards are still allowed.

MacroDOS Commands

[D]IR – used to read the disk directory. The second prompt requires a drive number of 1–4 or RETURN only for drive 1.

[R]NM – rename a file. As in Atari DUP, use the device name only with the old name (that is, D3:MAC*.*,AUTORUN.SYS).

[*]LK – lock a file.

[U]n* – unlock a file.

[F]MT – format a disk. Answer SURE? (?) with a Y. Give drive number.

[E]RS – erase file.

[CJRT – return to cartridge; BASIC or Assembler.

[S]AV – save binary file. Enter the filename at the prompt. Do not use commas. Enter the from address at the @ prompt. Then the to address at the next prompt. The numbers given can be hex or decimal or both, but must be preceded by a $ for hex or a period if decimal. This command allows appending to an existing file if a slash (/) is used after the last letter of the filename. RUN and INIT addresses must be added by appending to a file. POKE (or use command C in DEBUG) 736,737 ($2E0,$2E1) for RUN, and 738,739 ($2E2,$2E3) for INIT. Remember to POKE low, high. Then go to MacroDOS and append the addresses you just changed to the file. Do not hit SRESET between the POKEs and the SAVE or 736–739 will be cleared.

[L]OD – binary load.

[@]RN – run at address. Hex or decimal.

[W]DS – write DOS.SYS (only).

[$]>. – hex to decimal. Enter $ and # together. Range: $00 to $FFFF.

[.]>$ – decimal to hex. Enter a . and # together. Range: .0 to .65535.

[!]DS – escape to Atari DOS (DUP.SYS). Remember that without MEM. SAVE on a disk without write protection in drive 1, programs will be wiped out. After using this command, you'll have to reboot or load from Atari DUP using MEM.SAV. (I don't use the letter A because it's Atari's DUP DIR command and too easy to accidentally use. The ! forces you to shift, and therefore, to think a little more.)

In Part 2, we'll continue the discussion of MacroDOS features, and present the machine language source code.

If you don't want to type in the programs, send $3 and a disk or tape with an SASE mailer.

Jerry Allen
1906 Carnegie #E
Redondo Beach, CA 90278

MacroDOS

Refer to the "Automatic Proofreader" article before typing this program in.

MI 20 DIM H$ (104) : TRAP 95 : OPEN #1,8,
      0, "D : AUTORUN.SYS" : FOR N=1 TO 1
      6 : READ H$ : B = 0
H0 30 FOR C = 1 TO 99 STEP 2
DP 40 IF H$ (C,C+2)="END" THEN GOSUB
   80 : END
DH 50 A = 16* (ASC(H$(C))-48-7* (ASC(H$(
      C))>57))
OB 60 A = A+ASC(H$(C+1))-48-7* (ASC(H$(
      C+1))>57) : B = B+A
MG 70 PUT #1,A : NEXT C : GOSUB 80 : NEXT
      N
FN 80 IF B<>VAL (H$ (LEN(H$)-3)) THEN
      ? "ERROR AT LINE "; N*100 : STOP
EJ 90 RETURN
EF 95 END
NB 100 DATA FFFFFC1C082020AE1E84F288
       8CE3028CE10284FFA280A00586F38
       4F4A03A9848B9A71F20B21E68A888
       10F3A9088D5A0320766200
IP 200 DATA 1EA004AD800SD9E21FF01C88
       10F8C944D06DA9068D5A0320741D2
       06A1EA21020761E20701E10F6B9E7
       1F48C9FEF00920951D5209
KE 300 DATA 68206C1E109CA93F20B21E20
       761EAD8005C959D08D20741D30E6A
       94420B21EA92320B21E20761EAD80
       058DED1F8DF41FA0064896
OC 400 DATA B9EC1F91F38810F860A94620
       B21EA94E20B21EA93F20B21E4C761
       EC957D01120741DC8B9F31F91F3B8
       D0F8206A1E10B1C94C5965
KH 500 DATA D03485FF20951D4E5A03206A
       1E20991EA9FFC5D4D004C5D5F0F32
       0B6DD20991E20701F20E61DF0E5AD
       E302F008200517A9005814
BD 600 DATA 8DE30260C953D03720951DA0
       FFC8B1F3C92FD007EE5A03A99B91F
       3C99BD0EE206A1EA9FF85D485D520 
       951E20ED1E20951E206602
GK 700 DATA B6DD20ED1E20951E20701F10
       39C940D00620ED1E6CD400C943D00
       34C74E4C921D00EA940850CA91585
       0D2040154C9F17C9244940
AB 800 DATA D00820081F20541F100AC92E
       D00620021F202D1F106FA903A210D
       008A200A909D002A9059D4203A91E
       9D4803A9059D4503A93740
EF 900 DATA 809D4403A9009D49032056E4
       302B60A90BD002A907A2109D4203A
       9029D4803A9009D4503A9D4D0D9A9
       0C10BA85D4A200A90B4938
QL 1000 DATA 9D4203A90110E3C003F0D1C
        088F0159848A9C520B21E2044DA6
        885D420541F68684CFC1CA5FFF0F
        720E61DADE102F0EF20086297
MC 1100 DATA 17D0EAA94020B21E20761EA 
        C8005C02EF006C024F008D0BD200
        0D84CD2D92044DAA001B1F3C99BF 
        01938E930C90A3002E9075889
IK 1200 DATA A20406D426D5CAD0F905D48 
        5D4C810E160A000A201A9F035D44 
        A4A4A4A20481FA90F35D420481FC 
        A10EB3021C90A300269065311
BH 1300 DATA 693091F3C86020AAD920E6D 
        8A000B1F3C8C98030F9297F8891F 
        3C8A99B91F34C701EE6D4D002E6D 
        5A210A5E09D4403A5E19D7399
CE 1400 DATA 450338A5D4E5E09D4803A5D 
        5E5E14C8C1E204015A9FE8DE702A 
        91F8DE802A9FC850AA91C850B603
        E9B9B5344A120243EAE20577B
GO 1500 DATA 2E3EA4205344D7204E52C02 
        0444FCC205641D39B5452C320544
        DC6205352C5204D4ED2202A4ED52
        04B4CAA205249C49B52454936
GN 1600 DATA 2A554620212324FE44313A2
        A2E2A9B44313A444F532E5359539
        BA991850CA91F850D4C941FE202E
        302FE1FEND000000000003710