BASIC-DOS

A PCjs Retro-Programming Project

BASIC-DOS is on Twitter Project maintained by jeffpar

Preview

Part 4: Pipes and Sessions

The two machines below each run two foreground sessions on the same screen. The first boots the BASICDOS-360K-D40 diskette, whose CONFIG.SYS defines two 40-column sessions side by side; use SHIFT-TAB to toggle keyboard focus between them, and notice how the border changes to indicate which session has focus (the second session runs DIR | TR a-z A-Z in a loop, which you can stop with CTRL-C). The second boots the BASICDOS-360K-D80 diskette, whose CONFIG.SYS defines two 80-column sessions, one above the other, and runs RESTART to list both sessions.

IBM PC, 128Kb 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 .

IBM PC, 128Kb 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 .

In PC DOS, pipes require a writable disk with enough disk space to contain the entire pipe output; in other words, pipe operations are really just “faked” using temporary files. BASIC-DOS doesn’t need any disk space for pipes, thanks to two features that PC DOS never included:

  1. A PIPE driver
  2. Background sessions

For a command such as:

TYPE PRIMES.BAS | TR a-z A-Z

the interpreter opens a PIPE$ handle to create a FIFO queue and passes the handle as STDIN for a new background session running TR.COM, a BASIC-DOS I/O filter program that translates characters (here, from lower-case to upper-case). Pipelines can have any number of filters (eg, DIR | SORT | MORE), the filters run simultaneously, and the amount of piped data is unlimited. BASIC-DOS includes FIND, MORE, SORT, TEE, TR, and WC filters, and output can be redirected with > and >> at the end of any command or pipeline.

What is a Session?

BASIC-DOS supports a tasking unit known as a “session”. Sessions represent separate execution environments, each of which can run a separate DOS program. Each program can open its own files, allocate its own memory, define its own signal handlers, etc, and BASIC-DOS smoothly multitasks between them.

BASIC-DOS maintains session state using internal structures called Session Control Blocks (SCBs). These contain all per-session kernel state, including the session’s current drive and directories, its handles, and its CTRL-C and critical error handlers. RESTART alone lists every session’s number, console, and program, and RESTART n can restart any of them (see HELP RESTART).

Sessions can run entirely in the background, or they can be assigned to specific regions of the screen, like the foreground sessions in the machines above.

Next: Part 5: Were Dual Monitors Ever This Cool?

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