Show HN:Thoreau BASIC——如果 BASIC 没有过时,会怎样?
Show HN: Thoreau BASIC – What if BASIC hadn't gone out of fashion?

原始链接: https://thoreaubasic.com/

**Thoreau BASIC 3.2** 是 GW-BASIC 风格编程语言的现代 64 位演进版本。它可运行于 Windows,也可直接从 UEFI 固件启动而无需操作系统;程序可打包为独立的 Windows EXE 文件或可启动的 EFI 应用程序。 3.2 版本新增了 BASIC 原生文件浏览器和菜单、保留文件名大小写、最长 4,095 字节的路径、交替校验状态检查点、分阶段保存和经验证的备份、CRC32、文本统计、扩展的系统报告、JIT 优化,以及改进的程序重新启动功能。 其功能包括 24 位图形、精灵、鼠标输入、TCP/IP 和 HTTP、调试与性能分析工具、多核 `PARFOR`、原生 x64 JIT 编译,以及复数、四元数和八元数运算。多媒体支持涵盖 GM/GS 波表,以及 MIDI、WAV、FLAC 和 Opus 播放,并可在播放前扩展音色库。 Windows 和 UEFI 版本使用相同的解释器和波表。该版本还包含 BASIC 示例程序 Pixel Prose 及其独立应用程序。可通过项目的 itch.io 页面下载并获取更多信息。

Thoreau BASIC 3.2 是一款免费的 x64 解释器。它保留了 GW-BASIC 的语法,包括强制使用的行号、GOTO、GOSUB 和经典图形命令,同时加入了现代功能。它既可以运行在 Windows 上,也可以直接通过 UEFI 启动原生硬件,并提供即时(JIT)编译、解释器回退、SIMD 加速、并行循环、64 位数组、超复数、网络功能、高级图形与音效、调试工具以及独立可执行文件生成等能力。其演示包括实时曼德博集合浏览器、三维程序、游戏和基于精灵图的应用程序。 《黑客新闻》上的讨论大多带有怀旧情绪,人们将早期的行号 BASIC 与结构化方言、VB/DOS、Visual Basic、VB.NET,以及 PureBasic 等现代替代方案进行了比较。支持者称赞 BASIC 易读且容易上手,另一些人则认为,缺乏作用域和大型程序组织能力是它的根本缺陷。批评者还质疑其庞杂的命令集、仅限于 Windows/x86 的平台支持,以及 seemingly 不协调的功能。作者确认行号是必需的,并表示移植到 ARM/树莓派是最现实的未来方向。
相关文章

原文

Download

Windows x64 · ZIP

UEFI x64 · ZIP

Plain-text documentation

3.2 release notes

THOREAU_GM.TBGM · losslessly compressed wavetable · 513.5 MB

3.2

File browsers and menus are now ordinary BASIC commands. GETFILES gathers files, directories and the parent entry with an optional file mask. SELECTBOX turns a string array into a keyboard- and mouse-controlled selector, with multiple columns, optional colors, and single or double box-drawing frames.

Filenames keep their original spelling and case throughout the file commands. Masks are case-sensitive. Full paths can contain up to 4,095 bytes, including an added extension; filesystem limits on individual names still apply.

STATEWRITE and STATELOAD checkpoint selected variables to two alternating, checksummed generations. FLUSH, FILECOMMIT and FILECOPY support staged saves and verified backups. CRC32 checks byte strings, and TEXTSTATS counts words and characters in a range of a string array.

SYSTEMINFO$ reports CPU and firmware details, usable AVX2 or SSE2, PARFOR capacity, the calibrated TSC counter rate, display backend and build information. Targeted JIT changes reduce work in floating-point INT and native complex, quaternion and octonion arithmetic. RUN can restart a program without growing the host stack, and HELP category headings appear once.

The Opus wavetable and WAV, FLAC, Opus and MIDI playback remain available. Sound banks are expanded to PCM before playback, with no decompression while music plays. Standalone EXE and EFI applications can omit the bank with NOGM. See the manual and release notes for the full changes and syntax.

What it is

Thoreau BASIC starts from GW-BASIC-style syntax but is not trapped in 1983. It has 64-bit memory, 24-bit graphics, sprites, mouse input, TCP/IP and HTTP, a complete GM/GS wavetable with MIDI/WAV/FLAC/Opus playback, complex/quaternion/octonion values, a debugger, profiler, source tools, multicore PARFOR, and native x64 JIT compilation.

The same BASIC language runs as a normal Windows program or directly from UEFI firmware without an operating system. BASIC programs can also be packaged as standalone Windows EXE or bootable EFI applications.

Still BASIC

10 CLS
20 PRINT "HELLO FROM THOREAU BASIC"
30 FOR I=1 TO 5
40 PRINT I
50 NEXT I
60 END
RUN

And now the orchestra is BASIC too:

SOUND PRELOAD
LOADMID 0,"BALLADE.MID"
PLAYMID 0

Graphics, networking and sound remain ordinary BASIC commands, not separate frameworks.

BASIC without an operating system

The UEFI build boots directly on x64 machines. It uses GOP graphics, firmware or raw HID keyboard input, mouse support with fallbacks, networking through firmware protocols or Thoreau's own SNP-based stack, HDA/Azalia PCM sound where available, and the same interpreter/JIT and GM wavetable used by the Windows version.

Pixel Prose

Pixel Prose is included as a Thoreau BASIC example and is also available as standalone EXE and EFI builds. The original versions for DOS, Commodore 64 and Amstrad CPC live with my other retro projects on itch.io.

Project

The project page and downloads are on itch.io.

Contact

[email protected]

Bug reports, compatibility notes and strange BASIC edge cases are very welcome.

If you want to support development, PayPal is available. No nag screens, no locked features.

联系我们 contact @ memedata.com