BASIC-DOS

A PCjs Retro-Programming Project

BASIC-DOS is on Twitter Project maintained by jeffpar

Preview

Part 4: Pipes and Sessions

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. So you might wonder how BASIC-DOS can support pipes if it the file system doesn’t support write operations (yet).

Well, it can, thanks to two features that PC DOS never included:

  1. A PIPE driver
  2. Background sessions

For a command such as:

TYPE PRIMES.BAS | CASE

the interpreter opens a PIPE$ handle to create a FIFO queue and passes the handle as STDIN for a new background session running CASE.COM, a simple BASIC-DOS I/O filter program that upper-cases letters.

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. You can dump active SCBs using the MEM /S command (see HELP MEM for more options).

Sessions can run entirely in the background, or they can be assigned to specific regions of the screen. The next two machines illustrate how this works, using two side-by-side foreground sessions.

The CONFIG.SYS of the first machine has defined two 40-column foreground sessions. Use SHIFT-TAB to toggle keyboard focus between them. Notice how the border changes to indicate which session has focus. Feel free to type CTRL-C to kill the looping DIR command in the first session.

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 .

The CONFIG.SYS of the next machine has defined two 80-column foreground sessions.

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 .

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

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