Jump to content
IGNORED

Atari DOS Directory BASIC One-Liner


ballyalley

Recommended Posts

I'm going through the book "Dr. Wacko Presents's Atari BASIC & the Whiz-Bang Miracle Machine." On page 143 is a program that will PRINT the disk directory to screen using just BASIC commands. It's pretty neat. I didn't even know that you could do that from within BASIC without using a ML routine. This got me to thinking. Could there be a BASIC one-liner to do this? I typed in some keywords and came up with this article called "Hidden Atari DOS Commands" that was published in Compute! magazine in April 1984:

http://www.atarimagazines.com/compute/issue47/139_1_Hidden_Atari_DOS_Commands.php

There is indeed a one-liner that will print a DOS directory. The OCR'ed version of the program on the above webpage is not correct. I fixed it by looking at the actual (pdf of) the magazine. Check out this straight-forward ATARI BASIC one-liner that displays the disk directory:

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

I'm using DOS 2.0s and this one-liner actually works exactly as advertised. Cut and paste the above "program" into Altirra (under View>Paste Text) if you don't believe me!

There are also one-liners for some other DOS functions:

Erase a file
Protect a file
Disable File Protection
Format Disk
Write DOS

Am I missing out on any other great BASIC one-liners like this?

Link to comment
Share on other sites

Directory can be had various one-line ways, I used to just go:

O. #1,6,0,"D:*.*":F.A=1TO9999:GET#1,D:PUT#16,D:N.A

You get a listing then Error 136 at the end. If necessary, enter CL. #1 to close off the file (doing END or RUN will accomplish the same).

 

Much of what's otherwise in DOS command line or menu is just CIO special commands which Basic can do with XIO - so yes, stuff like Lock/Unlock file, Delete file can be done as one-liner as well.

 

In theory you could even create batch type files that work with Dos 2.x

 

The ENTER <filespec> command normally processes a Listed program file but you could create immediate mode commands as well.

 

So, e.g. you could ENTER "D:LOCK" - then have a one-liner in the file "LOCK" that DIMs a string then asks for the filespec to do the Lock command on, then execute it.

Edited by Rybags
  • Like 1
Link to comment
Share on other sites

Back in the day there used to be lots of type in listings that accessed DOS commands this way. It's quite scary how much knowledge gets 'lost' as the years go by then rediscovered but that's often the way in any technical area. I get very frustrated at work when some 22 year old tells us oldsters about some great new tech he's just done at college only to find it existed under a different name in the 70s or 80s but fell out of fashion.

  • Like 1
Link to comment
Share on other sites

I "borrowed" a general Input Output routine from some magazine or public domain program. I used it to quickly load a bitmap and another machine language routine into memory, but if I recall it had other uses if you knew what parameters to pass. I unfortunately never saved the documentation on it. It was just a single line. Here's a screen shot of the line of code and where I used it in my program.

 

Bob

IO.bmp

Link to comment
Share on other sites

I "borrowed" a general Input Output routine from some magazine or public domain program. I used it to quickly load a bitmap and another machine language routine into memory, but if I recall it had other uses if you knew what parameters to pass. I unfortunately never saved the documentation on it. It was just a single line. Here's a screen shot of the line of code and where I used it in my program.

 

Bob

 

The code is part of "Space Station Multiplication" educational game as an extra Disk bonus from ANTIC VOL. 9, NO. 2 / JUNE 1990.

Also, it is in a disk image can be downloaded from Atari-Mania from HERE

 

madi

Link to comment
Share on other sites

 

The code is part of "Space Station Multiplication" educational game as an extra Disk bonus from ANTIC VOL. 9, NO. 2 / JUNE 1990.

Also, it is in a disk image can be downloaded from Atari-Mania from HERE

 

madi

LOL, thanks for the free plug to my program. I didn't want it to look like I was doing some self promoting in someone else's thread. I wish I had kept the docs to that I/O routine.

 

Bob

Edited by bfollett
Link to comment
Share on other sites

Just a quick question for the more versed AtariAge forum users. My attached photo above needs to be clicked on to view it, but I've seen photos attached here that also show a thumbnail of the image. What am I doing wrong? How do you get the thumbnail view?

 

Thanks,

 

Bob

Fairly certain you need to attach the file as a JPG, not a BMP, and you will automatically get the preview.

Link to comment
Share on other sites

Fairly certain you need to attach the file as a JPG, not a BMP, and you will automatically get the preview.

 

 

 

or PNG

Ahhh, thanks, my paint program defaults to the last file format used, so I must have been working on a bmp and didn't notice that it was saving to that format, I usually use jpg so I should be good to go in the future as long as I pay attention to the save dialog.

 

Bob

Link to comment
Share on other sites

On the C64 your only access to the disk is with cryptic commands like this.... ;)

 

Yes, the C64 commands were cryptic, but Atari's are not. Ataris have a real operating system in ROM, with a nice set of commands common to most devices. They appear cryptic here because posters have used BASIC abbreviations. Yet another example of the C64's cheap crapiness.

  • Like 3
Link to comment
Share on other sites

 

Ataris have a real operating system in ROM, with a nice set of commands common to most devices. They appear cryptic here because posters have used BASIC abbreviations. Yet another example of the C64's cheap crapiness.

I always found that "semi device-independent" system really amazing and dimly recall even writing a letter to the publishers of a German (Data Becker) book about Atari Peeks & Pokes because they advocated ML shortcuts negating the CIO system.

Link to comment
Share on other sites

To generalize a bit...

 

From the earliest days of Dos 2.0, users looked for ways to get to Dos commands without leaving the Basic or Asm Ed programming environment. (Dos 1.0 had the menu included as part of the file management system, so it was BIG, especially with the small amount of ram normally available in those days.) The MEM.SAV function was a way around this, but it was really slow, saving the user memory to an 810 disk. So many work-arounds were developed including early command line Dos versions (OSA+, K-Dos), cartridge and disk "Basic add-ons" like the Monkey Wrench and the Disk Commander, "wedges" as from Compute! (1981, IIRC), and many others. Most of these became generally obsolete when expanded memory machines (like the 130XE) became available plus Dos 2.5 with it's nearly instantaneous MEM.SAV swap to the D8: ramdisk. After the 130XE became available, most Dos 2 work-alikes (MyDos, etc.) had ram disks. And of course, command line dos versions like Sparta never needed MEM.SAV.

 

-Larry

Link to comment
Share on other sites

In theory you could even create batch type files that work with Dos 2.x

 

The ENTER <filespec> command normally processes a Listed program file but you could create immediate mode commands as well.

 

What a great idea! I tried this out with the directory one-liner that I mentioned; it worked great. The "batch" file I created is called "DIR.BAS." I plan to put it on all my disks. Thanks for the tip!

Link to comment
Share on other sites

CLOSE #1:CLR :DIM DN$(,ZZ$(16),Z$(5),Z(4):OPEN #1,4,0,"K:":? "}Enter Decimal Number up to 65535"
? "œ":DN$="H3:DEC"
? "œ":FOR I=1 TO 4:Z(I)=0:NEXT I:ZZ$="0123456789ABCDEF"
? "œ":FOR I=1 TO 5:GET #1,Z:IF Z>47 AND Z<59 THEN ? CHR$(Z);:Z$(I,I)=CHR$(Z):NEXT I:CLOSE #1
A=PEEK(709):POKE 709,PEEK(710):Z=VAL(Z$):FOR I=1 TO 4:Z(I)=0:NEXT I
ZZ=INT(Z/4096):IF ZZ>0 THEN Z(1)=ZZ:Z=Z-4096*ZZ
ZZ=INT(Z/256):IF ZZ>0 THEN Z(2)=ZZ:Z=Z-256*ZZ
ZZ=INT(Z/16):IF ZZ>0 THEN Z(3)=ZZ:Z=Z-16*ZZ
Z(4)=Z:POKE 709,A
? "œDECIMAL ";Z$;" = ";:FOR I=1 TO 4:? ZZ$(Z(I)+1,Z(I)+1);:NEXT I:? " HEX"
? "œPress SPACE BAR to Continue,":? "H to Convert HEX Numbers,":? "Any other Key to Quit.":CLOSE #1
? "œ":OPEN #1,4,0,"K:":GET #1,Z:CLOSE #1:IF Z=72 THEN DN$(4)="HEX":ENTER DN$
IF Z=32 THEN ENTER DN$


Decimal Number look up.

CLOSE #1:CLR :DIM DN$(,Z$(4),ZZ$(4) "}Enter HEX Number to Convert.":OPEN #1,4,0,"K:"
? "œ":DN$="H3:HEX"
? "œ":FOR I=1 TO 4:GET #1,Z:IF Z>47 AND Z<58 OR Z>64 AND Z<71 THEN Z$(I,I)=CHR$(Z) CHR$(Z);:NEXT I
CLOSE #1:ZZ$="0000":Z=LEN(Z$):A=PEEK(709):POKE 709,PEEK(710)
ZZ$(1+4-Z)=Z$:Z$=ZZ$(1,1):Z=0:ZZ=0
Z=Z$="F"*15+Z$="E"*14+Z$="D"*13+Z$="C"*12+Z$="B"*11+Z$="A"*10+Z$="9"*9+Z$="8"*8
Z=Z+Z$="7"*7+Z$="6"*6+Z$="5"*5+Z$="4"*4+Z$="3"*3+Z$="2"*2+Z$="1":Z=Z*4096:ZZ=ZZ+Z:Z$=ZZ$(2,2)
Z=Z$="F"*15+Z$="E"*14+Z$="D"*13+Z$="C"*12+Z$="B"*11+Z$="A"*10+Z$="9"*9+Z$="8"*8
Z=Z+Z$="7"*7+Z$="6"*6+Z$="5"*5+Z$="4"*4+Z$="3"*3+Z$="2"*2+Z$="1":Z=Z*256:ZZ=ZZ+Z:Z$=ZZ$(3,3)
Z=Z$="F"*15+Z$="E"*14+Z$="D"*13+Z$="C"*12+Z$="B"*11+Z$="A"*10+Z$="9"*9+Z$="8"*8
Z=Z+Z$="7"*7+Z$="6"*6+Z$="5"*5+Z$="4"*4+Z$="3"*3+Z$="2"*2+Z$="1":Z=Z*16:ZZ=ZZ+Z:Z$=ZZ$(4,4)
Z=Z$="F"*15+Z$="E"*14+Z$="D"*13+Z$="C"*12+Z$="B"*11+Z$="A"*10+Z$="9"*9+Z$="8"*8
Z=Z+Z$="7"*7+Z$="6"*6+Z$="5"*5+Z$="4"*4+Z$="3"*3+Z$="2"*2+Z$="1":ZZ=ZZ+Z
POKE 709,A:? "œHEX ";ZZ$;" = ";ZZ;" DECIMAL"
? "œPress SPACE BAR to continue,":? "D to Convert DECIMAL Numbers,":? "Any Other Key to Quit."
? "œ":OPEN #1,4,0,"K:":GET #1,Z:CLOSE #1:IF Z=32 THEN ENTER DN$
IF Z=68 THEN DN$(4)="DEC":ENTER DN$

Hex Number look up table.

All done in immediate mode.with the option to swap back between Hex look up and Dec look up.

I have this set up for and emulator looking at my hard disk three, but could be put on the same disk(atr) or even ramdisk D8:

 

I also have an error nubers look up file and an xio number look up table.

 

One for Turbobasic...

 

dirx3.txt

 

That will do DIR on multiple Disks(atr) 3 columns.

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...