QA findings from a multi-round review of the FreeDOS submission prep work:
- TUI rendering refactor: src/tui.c emitted ANSI escape sequences via
printf, which displays as raw text on bare FreeDOS (no ANSI.SYS).
Add four HAL ops (tui_enter, tui_leave, render_run, set_cursor_shape)
and route per-cell rendering through them. POSIX backend keeps the
ANSI path; DOS backend drives BIOS INT 10h via the existing
bios_set_cursor / bios_write_char helpers. The TUI's logical cursor
goes through the saved orig_locate to avoid recursing through the
swapped-in gw_hal->locate.
- DOS extended-key mapping: dos_getch returns 0x100 | scancode for
arrows / F-keys; tui_read_key wasn't translating those to its TK_*
constants, so the editor never saw arrow keys or F1-F10 on DOS.
Add a __MSDOS__-conditional translation table in tui_read_key.
- Version banner: GW_VERSION was still 0.16.0 even though the v0.17.0
release prep was already in CHANGES.TXT. Bump.
- Compiler PulseAudio link: gwbasic-compile -c hardcoded
'-lgwrt -lm -lpthread' on the gcc command line. When libgwrt was
built against libpulse-simple (the default on any host with the
PulseAudio dev headers installed), the compile workflow failed with
'undefined reference to pa_simple_drain'. CMake now passes
GWRT_HAS_PULSEAUDIO to gwbasic-compile when libpulse is present, and
the compiler appends -lpulse-simple to the link line.
- FRE("") garbage collection: the interpreter skipped strpool_gc with a
comment 'unsafe during expression eval', but that's exactly what real
GW-BASIC's FRE("") does (and the AOT compiler path already did). Add
the GC call; strpool_pin/unpin is the existing escape hatch if a
caller has live pool pointers on the C stack. Fixes the string_gc
compat test.
- Test harness normalization: run_tests.sh stripped trailing whitespace
on the actual output but not the expected file, causing spurious
mismatches against golden files captured from real GWBASIC.EXE.
Normalize both sides identically. Fixes the peek_gfx mismatch.
- Print_using: snprintf into mantissa[32] with %.*f and an unbounded
dec triggered a -Wformat-truncation warning. Clamp dec to 20 (IEEE
double has at most ~17 significant decimal digits).
- Doc/version consistency: 16-bit binary size reported as 127KB in one
place and 128KB in three; standardize on 128KB. HAL backend count
said '1 file' but is now 2. CI test count said 'all 66 test
programs' but is 72. Add a v0.17.0 row to the development.md table.
Update getting-started.md DOS section to match the BIOS-rendering
reality and add a manual TUI verification checklist.
- dos_init now writes back BIOS-reported cols/rows to dos_hal struct
fields (forward-declared so dos_init can reference it).
After these changes: 72/72 interpreter tests pass, compat 68/68
matched, no warnings on the Linux build.
47 lines
2.1 KiB
Markdown
47 lines
2.1 KiB
Markdown
# GW-BASIC 2026
|
||
|
||
A portable C reimplementation of Microsoft GW-BASIC, using the
|
||
[original 8088 assembly source](https://github.com/microsoft/GW-BASIC)
|
||
(released by Microsoft in 2020) as the authoritative reference.
|
||
|
||
This is not a transpilation -- it reimplements the algorithms in clean C11
|
||
with modern data structures while targeting bug-compatible behavior.
|
||
Unlike the original assembly (43,771 lines across 43 `.ASM` files), this
|
||
version is structured as modular C suitable for new feature development.
|
||
|
||
## Highlights
|
||
|
||
- **Authentic full-screen editor** -- dynamically sized screen buffer (25×80
|
||
default, full terminal with `--full`), free cursor movement, Enter-on-any-line,
|
||
F1-F10 function keys, Insert/Overwrite toggle
|
||
- **Binary and ASCII file formats** -- `SAVE` writes tokenized binary by default,
|
||
`LOAD` auto-detects format (just like the real thing)
|
||
- **INKEY$ extended keys** -- arrow keys, F-keys, and navigation keys return proper
|
||
`CHR$(0)` + scan code two-byte sequences
|
||
- **Sixel graphics** -- `SCREEN 1`/`SCREEN 2` rendering in compatible terminals
|
||
- **Sound** -- `SOUND`, `BEEP`, `PLAY` (MML) via PulseAudio, plus continuous tone
|
||
via `OUT` (8253 PIT / PPI speaker emulation)
|
||
- **Hardware I/O** -- `OUT`, `INP`, `WAIT` port emulation (PIT, PPI, CGA, COM1,
|
||
game port) for classic programs that drive hardware directly
|
||
- **Full file I/O** -- sequential, random-access, SAVE/LOAD/MERGE/CHAIN/COMMON
|
||
- **Printer output** -- `LPRINT`/`LLIST` to file or real hardware via `--lpt`
|
||
- **Classic programs** -- Hamurabi, Lunar Lander, Gunner, and Diamond from
|
||
David Ahl's *BASIC Computer Games* (1978) run out of the box
|
||
- **Ahead-of-time compiler** -- `gwbasic-compile prog.bas -c` produces native
|
||
executables via C codegen + GCC (56/56 eligible tests pass, 100%)
|
||
- **Jupyter kernel** -- inline Sixel graphics, INPUT support, Pygments syntax
|
||
highlighting; `pip install -e . && gwbasickernel-install --user`
|
||
- **72 test programs** with golden-file regression testing and DOSBox-X
|
||
compatibility testing against real GWBASIC.EXE
|
||
- **MIT License**
|
||
|
||
```{toctree}
|
||
:maxdepth: 2
|
||
|
||
getting-started
|
||
language-reference
|
||
architecture
|
||
development
|
||
roadmap
|
||
```
|