Classic Computer Magazine Archive COMPUTE! ISSUE 40 / SEPTEMBER 1983 / PAGE 10

READERS' FEEDBACK


Atari Binary LOAD/RUN From BASIC
The use of binary files in BASIC programs is increasing as Atari programmers become more sophisticated. It is not generally known that you can use the DOS command L, including the "/N" option, directly from BASIC. The necessary routines are resident in DOS itself, not DUP. They will LOAD, INIT, and RUN (or not RUN) any binary file that DOS can handle, including compound files. Control is returned to BASIC for files which ordinarily return to DOS. Here is one method. Just insert your file name in F$.

  100 DIM F$(16):F$="D:GAME.OBJ":F$(LEN(F$)
      +1)=CHR$(155):POKE 5534,0:POKE 5535,192
  110 X=ADR(F$):Y=INT(X/256):POKE 853,Y:POKE
      852,X-256*Y:X=USR(ADR("hL)U"))

    The USR string which is not listed correctly by a printer is:

    small h, capital L, inverse SHIFT 0, CONTROL U

    To LOAD and INIT but not RUN, POKE 5534,192 in line 100.
    The USR code, PLA, JMP $15A9 calls the resident DOS routine used by option L.
    Note: Bill Wilkinson in his COMPUTE! column eloquently explains the advantages of following Atari protocol. I am embarrassed to point out that I violate that excellent advice by using a specific DOS routine which may be altered in future DOS revisions. It is safe to use this quick and dirty trick in your personal programs, but don't distribute it. Use my "Autotype" in COMPUTE!'s Second Book of Atari to insert the binary file directly and safely into any commercial BASIC program.
Forrest Meiere