BASIC-DOS

A PCjs Retro-Programming Project

BASIC-DOS is on Twitter Project maintained by jeffpar

Preview

Part 3: BASIC Files vs. Batch Files

There are three versions of the PRIMES program on the BASIC-DOS1 diskette: the BAS file previously demonstrated, a BAT version that uses line numbers only as needed (as labels), and an EXE version that was written in assembly language. The source code for the assembly language version can be found in both the BASIC-DOS Repository and Build Machine, along with the rest of the BASIC-DOS source code.

When processing an external filename, BASIC-DOS searches for extensions in the same order as PC DOS: COM, EXE, and BAT. And if none of those are found, it also searches for a BAS file. And unlike PC DOS, you can override the search order with an explicit file extension.

Let’s take a look at the BD1.BAT batch file in the machine below.

IBM PC, 64Kb RAM, Dual Floppy Drives, CGA

Color Display
Caps
Num
Scroll
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
Esc
1 !
2 @
3 #
4 $
5 %
6 ^
7 &
8 *
9 (
0 )
- _
= +
Back
-
Num
Scroll
Tab
Q
W
E
R
T
Y
U
I
O
P
[ {
] }
7
↑ 8
9
Ctrl
A
S
D
F
G
H
J
K
L
; :
' "
` ~
← 4
5
→ 6
+
Shift
\ |
Z
X
C
V
B
N
M
, <
. >
/ ?
Shift
PrtSc
1
↓ 2
3
Alt
Space
Caps
Ins 0
Del .
Esc
Tab
F1
F2
F3
F4
F5
F6
F7
F8
F9
F10
Num
Scroll
1 !
2 @
3 #
4 $
5 %
6 ^
7 &
8 *
9 (
0 )
- _
= +
Back
-
+
Q
W
E
R
T
Y
U
I
O
P
[ {
] }
7
↑ 8
9
A
S
D
F
G
H
J
K
L
; :
' "
` ~
← 4
5
→ 6
\ |
Z
X
C
V
B
N
M
, <
. >
/ ?
Shift
PrtSc
1
↓ 2
3
Ctrl
Shift
Alt
Space
Caps
Ins 0
Del .

As in PC DOS 2.00, an ECHO command has been added to control the echoing of lines in a batch file. However, the only ECHO options are ON and OFF, because if you want to echo something else, well, BASIC already has a command for that: PRINT.

Variables, including function definitions, remain in memory after a batch file (or BASIC program) has been run. So the ADD function defined by BD1.BAT is still available, and can be used by any BASIC command or expression typed directly at the command prompt. For example:

PRINT ADD(123456,654321)

will print 777777. All the standard BASIC numerical, logical, and relational operators are available as well.

Notice that BASIC-DOS 1) doesn’t require function names to begin with “FN”, 2) it allows them to be defined at the command prompt (ie, what IBM PC BASIC calls “Direct Mode”, aka Immediate Mode), and 3) it allows multi-line function definitions within BASIC files, enabling the creation of more sophisticated functions.

Also take this opportunity to experiment with BASIC-DOS line-editing, which combines all the editing features of both PC DOS and PC BASIC, improving the PC DOS editing experience. Use the BASIC-DOS HELP command to list available editing keys (HELP KEYS).

Next: Part 4: Pipes and Sessions

Copyright (c) 2020-2021 Jeff Parsons Released under MIT License