Read the Blog, then check out the Preview, which
highlights a few of the original Demos.
Project Status
BASIC-DOS began as a technology demo: a reimagining of what the first IBM PC
operating system could have been, with a unified DOS and BASIC command
interpreter, preemptive multitasking sessions, and other features that PC DOS
wouldn’t offer for years (if ever). The goal now is to turn it into a usable
product.
This section tracks what’s been completed ([x]) and what remains
([ ]). Items marked partial work, but with known gaps.
Boot and System Configuration
Boot sector that loads the BASIC-DOS drivers, kernel, and interpreter
Boot prompt when a hard disk is detected (press Esc to boot from it)
CONFIG.SYS support for BOOTKEY, CONSOLE, DEBUG, FILES, MEMSIZE,
SESSIONS, SHELL, SKIP, and SWITCHAR
SKIP= lists built-in drivers (by their exact device names, separated
by commas) that should not be loaded (eg, SKIP=CON,FPU$); a skipped
driver is never initialized, and its memory is reclaimed
CON, with multiple console contexts (one per session)
COM, AUX, LPT, PRN, NUL, CLOCK$, and PIPE$ devices
Interrupt-driven, asynchronous I/O for CON and COM
Floppy disk reads, including multi-track requests and requests
that cross 64K boundaries
Floppy disk writes
Media check and BPB rebuilds (reads PC DOS 1.x and 2.x diskettes)
partial: Hard disk reads and writes (HDC$), for the FAT12 primary
partitions of up to two PC XT hard disks, which become drives C:, D:,
etc. (drives A: and B: are always reserved for diskettes)
Write-with-verify (DDC_WRITEV), formatting, and FAT16 hard disks
“Popup” and background console contexts
Kernel: Processes, Memory, and Sessions
COM and EXE program loading, PSPs, EXEC, and exit codes
Memory allocation (MCBs), including per-program heap requests
Preemptive multitasking of multiple sessions
CTRL-C/CTRL-Break handling, and CTRL-ALT-DEL session aborts
Session STOP/END operations (currently TODOs)
TSR support (INT 27h and INT 21h function 31h)
Environment segments for EXEC (EPB_ENVSEG)
Kernel: File System
FAT12 file reading
Handle-based open, read, seek, IOCTL, and close
Find first/next, disk info (free space), and current drive/DTA
Handle-based file creation (function 3Ch) and writing (function 40h)
File deletion (function 41h) and renaming (function 56h)
FAT cluster allocation and freeing
Write-back of modified FAT and directory buffers (every FAT copy is
updated), including when the buffer is reused, on file close, disk
reset, and restart
partial: FCB support (open, close, and reads only; no create,
write, delete, or rename)
Truncating/extending a file with a zero-length write
Enforcing the read-only attribute on open, and getting/setting file
attributes (function 43h) and date/time (function 57h)
Subdirectories (MKDIR, RMDIR, CHDIR, and paths); for now,
subdirectory entries are ignored (they can’t be opened, deleted, or
overwritten)
Absolute disk reads and writes (INT 25h and INT 26h)
FAT16, extended partitions, and a larger buffer cache (there are
currently only two sector buffers: one for FAT sectors and one for
directory sectors)
Command Interpreter: DOS Commands
COPY, DATE, DEL, DIR, EXIT, HELP, KEYS, MEM, RESTART, TIME, TYPE,
and VER
Running COM, EXE, BAT, and BAS files, and loading programs into
other sessions
BAT and BAS files can run other BAT and BAS files and then continue
(no CALL command required); a nested BAS file gets its own variables
Pipes (|) and output redirection (> creates or truncates the
output file, >> appends to it), including redirection at the end
of a pipeline (eg, DIR | CASE > TEST)
COPY creates (or truncates) the output file, and refuses to copy a
file onto itself
DEL/ERASE
Input redirection (<)
REN/RENAME, and SAVE (for BASIC programs)
Disk utilities (eg, FORMAT, CHKDSK, SYS)
Command Interpreter: BASIC Language
32-bit integer variables, constants, and expressions (including
AND, OR, XOR, EQV, IMP, NOT, MOD, and shifts)
Type suffixes (% for integers, # or ! for doubles, and $ for
strings), where the type is part of a variable’s identity (eg, after
DEFINT A-Z and then DEFDBL A-Z, A is a new variable, separate from
A%)
String pool management: temporary strings are released as soon as
they’re consumed, strings are compacted (and empty string blocks
freed) when space runs out, and runtime string errors (eg, “String
too long”) abort the program cleanly
CLS, COLOR, DEF FN (including string functions and parameters),
DEFDBL, DEFINT, DEFSNG, DEFSTR, ECHO, GOTO, IF/THEN/ELSE, LET, PRINT,
REM, and RETURN
Assignments without LET in BAS and BAT files (LET is still required
on the command line)
LOAD, LIST, NEW, and RUN
Functions: ERRORLEVEL, MAXINT, and RND%
Arrays of integers, doubles, and strings, with up to 255 dimensions:
DIM, ERASE, OPTION BASE, automatic dimensioning (with a largest
subscript of 10) of arrays used without DIM, and “Subscript out of
range” and “Duplicate definition” errors
Control flow: END, FOR/NEXT (with STEP, and integer or double loop
variables), GOSUB/RETURN, ON … GOTO/GOSUB, STOP, and WHILE/WEND
Memory management that’s forgiving of low or fragmented memory:
code, text, variable, and string blocks are modest (4K) blocks that are
chained together as needed (generated code continues in another code
block via a far JMP), no block type takes more than a quarter of the
largest free block, and smaller blocks (down to 512 bytes) are used
when necessary
Limitations: a DEF function’s code must fit in a single block, and
each array requires a single block (64K max)
Specific error messages for compile-time errors (eg, “NEXT without
FOR” and “WHILE without WEND” are currently reported as syntax errors)
STOP’s “Break” message (STOP is currently the same as END)
INPUT, LINE INPUT, READ, DATA, and RESTORE
The MID$ statement (ie, MID$(A$,N[,M]) = B$)
&H and &O prefixes in VAL
Comma print zones in PRINT (commas currently print a tab)
Error handling (eg, ON ERROR, ERR, ERL), and runtime error messages
for numeric errors
Floating-Point
BASIC-DOS will support only one floating-point type: IEEE 754 64-bit
(double-precision) values. It won’t use any MBF (Microsoft Binary Format)
code.
Parser support for floating-point constants (CLS_FLOAT tokens)
Numeric variables default to doubles (unless DEFINT is used), and
DEFSNG is treated as DEFDBL
MBF-based MSLIB option removed
FPU$ device driver, which detects an 8087 at boot and provides a
table of floating-point functions (IOCTL_GETFPU)
8087 functions: arithmetic (including ^), comparisons, conversions
between longs and doubles, ABS, INT, FIX, and SQR
Software emulation of all FPU$ functions for systems without an 8087
The interpreter reports at startup whether floating-point uses an
8087, emulation, or is disabled (no FPU$ driver); when disabled,
variables default to integers and “/” and “^” are integer operations
String-to-double (FPU_ATOD) and double-to-string (FPU_DTOA)
conversions, and %f support in sprintf
Expression generator support for mixed integer/floating-point
operations (promotion and demotion rules), using FPU$ calls
Floating-point constants and PRINT output in BASIC programs
BASIC math functions: ABS, ATN, COS, EXP, FIX, INT, LOG, SIN, SQR,
and TAN
FPUTESTS, run with and without an 8087 by tools/tests/quick.sh
Saving and restoring 8087 state on session switches (FPU$ functions
currently disable interrupts instead), and better error reporting for
FPU exceptions
Utility functions DOS_UTL_ATOF64, DOS_UTL_I32F64, and DOS_UTL_OPF64
(still stubs; possibly superseded by FPU$)
Build, Tests, and Documentation
Builds with MASM 4.0 using mk.sh (PC.js), which also updates
the BASIC-DOS demo disks after a successful build
STRFUNCS and STRPOOL: BASIC string function tests, and string pool
stress and leak tests
ARRAYS: BASIC array tests (including leak tests)
FLOW: BASIC control flow tests
Unattended test runs using tools/tests/quick.sh (boots BASIC-DOS
with and without an 8087, runs FPUTESTS, DOSTESTS, STRFUNCS,
STRPOOL, ARRAYS, and FLOW, and reports whether the tests passed)
tools/tests/chkdsk.sh runs MS-DOS 3.20 CHKDSK on a diskette image
saved by a test session (see QUIT /S in pc.js)
More tests (eg, BASIC language and CMD command tests)
HELP for commands, functions, and constants (eg, HELP MID$), found
by searching HELP.TXT, so new entries need no other changes