Shell

See all articles from Update April 1988

I am sure that some of you read my article on this subject in TDM but I am also sure that you will find this expansion of the concept a useful one. The listing in this article is a ‘shell’. It allows you to COPY or ERASE any or all of the files on a disk.

Let me pause to define the term ‘shell’. A shell is a wrap around the Disk Operating System, DOS, just like a clam’s shell wraps around it. Only, in this case, the shell not only hides the contents, but it also makes the contents simpler to use.

Now for the program, the first part asks you what you want to do in a series of questions. You never even have to hit enter.

The second part of the program creates a sequential file using the screen channel. This redirects the screen output to a sequential disk file. While this part runs, only disk activity will be noted until the end where the filenames are read back into a string array. Here you will hear rapid keystrokes as the input comes from the disk file.

The next part lists the filenames to the screen. As you mark files for action, they are converted to inverse video. When you are done, the requested action is taken on the files you indicated.

In operation, the number keys, 5 to 8, are used to control the cursor. The direction corresponds to the arrows above the keys. The “M” key marks a filename for action. The “U” key unmarks a file. The “N” key causes the next page (if all the files won’t fit on one page) to be displayed. The “D” key tells the program that you are through marking files. A safety is installed before an ERASE command is followed. Just indicate your decision by pressing “Y” or “N”.

This operation is very simple. After all, the operation of a shell should be simple or it isn’t easier to use than DOS. It should accent the power of the DOS not take away.

Lines 1 and 2 are for those of you who have SPDOS V1.1 and wish to make this an AUTO execute file. All others may omit these lines.

   0 REM
********************************
* *
* SHELL *
* COPYRIGHT @ 1987 *
* Munson H. Cockayne, Jr. BSCS *
* *
********************************
1 ON ERR GO TO 1: INPUT "Press ENTER";c$
2 ON ERR RESET
10 PRINT #1; "1) ERASE"'"2) MOVE"
20 PAUSE 0: LET c$= INKEY$
30 INPUT ;: PRINT #1;"The files are on drive?": PAUSE 0: LET r$= INKEY$ : LET d1= CODE r$-48: IF d1>4 OR d1<1 THEN GO TO 520
40 IF c$ ="2" THEN INPUT ;: PRINT #1;"To drive?": PAUSE 0: LET r$= INKEY$ : LET d2= CODE r$-48: IF d2<1 OR d2>4 THEN GO TO 540
50 INPUT;
100 DIM t$(143,12)
110 CLS
120 PRINT #4: OPEN #2," CAT ": PRINT d1
130 PRINT #4: CAT "",: PRINT d1
140 PRINT # 4: CLOSE #2
150 PRINT #4: OPEN # 5," CAT ": PRINT d1
160 LET cnt=0
170 FOR i=1 TO 10: INPUT #5;f$: NEXT i
180 INPUT #5; f$
190 IF f$(2)=" CAT " THEN GO TO 220
200 LET cnt=cnt+1
210 LET t$(cnt)=f$(2 TO )
220 INPUT #5;f$: IF LEN f$=0 THEN GO TO 250
230 INPUT #5;f$
240 GO TO 180
250 PRINT #4: CLOSE #5
260 PRINT #4: ERASE " CAT ",: PRINT d1
600 POKE 23658, 8: REM Shift to all caps mode
1000 FOR p=1 TO cnt STEP 40
1005 FOR i=0 TO 19
1010 IF p+i <= cnt THEN PRINT t$(p+i);
1020 IF p+i+20 <= cnt THEN PRINT TAB 16;t$(p+i+20);
1030 PRINT 1035 NEXT i
1040 GO SUB 2000
1050 CLS
1060 NEXT p
1100 FOR i=1 TO cnt
1120 IF CODE t$(i)=20 THEN IF c$="1" THEN GO SUB 3000
1130 IF CODE t$(i)=20 THEN IF c$="2" THEN PRINT #4: MOVE t$(i,3 TO ),"": PRINT d1,d2
1140 NEXT i
1890 POKE 23658,0: REM Shift to normal mode
1900 IF c$="2" THEN PRINT #4: CAT "",: PRINT d2
1910 IF c$="1" THEN PRINT #4: CAT "",: PRINT d1
1990 GO TO 10000: REM Just stops without stop error report
2000 LET column=0
2010 LET row=0
2020 GO SUB 5000
2030 PAUSE 0: LET r$= INKEY$
2035 LET index=p+(column=16)*20+row
2040 IF r$="7" THEN IF row THEN GO SUB 5100: LET row=row-1
2050 IF r$="6" THEN IF index+1 <= cnt THEN IF row<19 THEN GO SUB 5100: LET row=row+1
2060 IF r$="8" THEN IF index+20 <= cnt THEN GO SUB 5100: LET column=16
2070 IF r$="5" THEN GO SUB 5100: LET column=0
2080 IF r$="N" THEN RETURN
2090 IF r$="D" THEN LET p=143: RETURN
2100 IF r$="M" THEN IF CODE t$(index) <> 20 THEN LET t$(index)= CHR$ 20+ CHR$ 1+t$(index)
2110 IF r$="U" THEN IF t$(index,1)= CHR$ 20 THEN LET t$(index)= t$(index,3 TO )+" "
2120 GO SUB 5100
2130 GO TO 2020
3000 PRINT #1;"ERASE: ";t$(i,3 TO );"?": PAUSE 0: LET r$= INKEY$ : INPUT ;
3010 IF r$="Y" THEN PRINT #4: ERASE t$(i,3 TO ),
3020 RETURN
5000 PRINT AT row,column; OVER 1; FLASH 1;" "
5010 RETURN
5100 PRINT AT row,column;t$(p+(column=16)*20+row)
5110 RETURN

There are a few notable limitations to this little shell. Line 100 DIMensions t$ to 143 strings. Even though there are 144 filenames possible with SPDOS, our little CAT file will use one of these. It is skipped by line 190 since it will not exist by the time we start marking files.

Another less obvious limitation is that it cannot MOVE files that really crowd memory because this BASIC program is also tieing up a fair amount of memory on its own. I still find it to be a great little utility when I want to move several files. The memory problem just doesn’t crop up that often for me.

If there are any questions/problems, write to:

342 Trotter Court
Sanford, FL 32773

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.