Show HN: Thoreau BASIC – What if BASIC hadn't gone out of fashion?

thoreaubasic.com

88 points by Gorsefound 1 day ago

Thoreau BASIC started as a joke. I wanted a BASIC where I could type something ridiculous like:

  DIM A%(12000000000)

…and have it actually work. Then I kept adding things. The result is Thoreau BASIC, a free x64 BASIC interpreter inspired by GW-BASIC, running both as a normal Windows program and directly on bare-metal UEFI without an operating system.

Version 3.2 has become considerably more ambitious than the little interpreter I originally intended to write. The language still deliberately looks and feels like old Microsoft BASIC. Line numbers, GOTO, GOSUB, PRINT, PSET, LINE, CIRCLE, DRAW, etc. are all there. But underneath that rather innocent-looking surface is now quite a lot of machinery.

Some of the current features:

  native x64 JIT compilation, with automatic fallback to the interpreter
  PARFOR for multithreaded numeric loops
  SSE2 / AVX2 acceleration where available
  64-bit addressing and very large arrays
  native complex, quaternion and other hypercomplex numbers
  arbitrary-resolution 24-bit graphics
  sprites, bitmap operations, polygon filling and mouse input
  TCP/IP networking on Windows and UEFI
  an integrated profiler, debugger, tracing and program-analysis tools
  CREATEEXE to turn a BASIC program into a standalone Windows executable
  CREATEEFI to turn the same program into a directly bootable UEFI application

The sound system has also grown rather out of proportion. Thoreau BASIC can now handle up to 32 live instrument channels plus 64 sound effect channels and 256 voices, with real-time pan and brightness control. NOTE and SOUNDKEY can be used more like playable synthesis primitives rather than just old-school BASIC beeps.

3.2 also expands the less glamorous but surprisingly useful parts of the environment. There is better file browsing and selection with GETFILES and SELECTBOX, longer case-preserving paths, recovery/file-flush facilities, and considerably more detailed SYSTEMINFO$ diagnostics. The latter is useful for seeing things such as available CPU capabilities and the execution environment while debugging performance differences between machines.

One thing I've spent a lot of time on recently is making the BASIC programs themselves fast enough that they stop feeling like demonstrations of an interpreter. For example, the current Mandelbrot demo is a real-time interactive fractal explorer. Mouse movement pans the fractal, left-click zooms in and right-click zooms out, while the BASIC program continuously redraws and displays the frame rate.

There are also 3D and procedural demos, sprite programs, networking examples, hypercomplex fractals and games. An important design constraint throughout the project has been that Windows and UEFI should execute essentially the same BASIC language. A program shouldn't suddenly become a different species just because there is no operating system underneath it.

And yes, I am fully aware of the absurdity of combining GOTO 100 with AVX2, multithreading, TCP/IP and quaternion arithmetic. That is increasingly the point. I'm interested in the question: What would BASIC look like if it had never gone out of fashion? Thoreau BASIC 3.2 is my current answer.

I'd be especially interested in feedback from people who remember GW-BASIC/QBasic, compiler/interpreter people, and anyone sufficiently unreasonable to enjoy the idea of booting a modern x64 PC directly into a BASIC interpreter/JIT compiler.

ChicagoDave 18 hours ago

I was a pretty successful BASIC programmer, starting on DEC PDP-11 RSTS/E BASIC. Line number BASIC was good enough for simple applications, but quickly turned into spaghetti code.

Later, the VAX had BASIC with functions and subroutines and dropped the line numbers and this version of BASIC was significantly better. It was procedural, but you could organize your code into modules, keeping it readable and maintainable.

Eventually the non line number BASIC spread to the PC. Microsoft Professional Development System, then Visual BASIC.

qingcharles 20 hours ago

I was writing BASIC code for everything until a few years ago -- VB.NET -- until it was really clear that it had become a totally second-class citizen and I switched to C#.

I still think VB.NET is vastly more readable than C/C#/Java etc.

  • christophilus 19 hours ago

    It’s been 2nd class for a long time, but I loved it back in the early 2000s.

    • pasc1878 14 hours ago

      VB.NET was always second class to c#.

      Unfortunately it was a one-to-one match to C#.

      It would have been much netter if it was based on Visual Basic 6

      • kothurn-utopie2 14 hours ago

        Second class? Maybe in the perception of some C-loving programmers.

        VB.NET can do everything what you can do with C#. Saying that C# is better than VB.NET is like saying that French is better than Spanish.

        • Scharkenberg 8 hours ago

          C# has gained tons of features and improvements of existing ones, VB.NET has unfortunately been fully ignored. Not even put in the back burner, just left to die, apparently. Which is sad, because I find it more legible and beginner-friendly than any C-derived languages.

          • pjmlp 6 hours ago

            Nowadays the official posture is to update the language only to be able to consume some of those features.

            For example, the new async/await runtime model is also for VB.

      • pjmlp 13 hours ago

        .NET 2.0 introduced a few things back.

        VB 6 way to do COM still wins out, though.

      • bazoom42 12 hours ago

        > VB.NET was always second class to c#

        VB.NET and C# was treated as equals for a long time. I believe MS initially expected VB.NET to be the mainstream .net language, while C# was a compromise to attract Java and Delphi users.

        But the transition from VB to VB.NET was not handled well. VB was very well liked by its users (even if non-users looked down on it) but VB.NET was worst of both worlds. Too different from VB to be smooth upgrade, and still nok considered as professional a language as C#

    • FranOntanaya 14 hours ago

      You really felt productive doing anything with Visual Basic 6, at least until things slowed to a crawl because it wasn't so performant or it was held back by the typical Access database. You didn't need 200 hours of YouTube tutorials about the front-ed UI framework du jour to get going.

  • dalemhurley 15 hours ago

    So much easier then JavaScript/typescript, Python, and many other languages.

    • pjmlp 6 hours ago

      And designed to be compiled from the start, the interpreters in 8 bit home computers were due to hardware limitations, after the 16 bit transition compilers were back in.

  • vunderba 6 hours ago

    I never ended up trying VB.NET, but I spent a lot of time in middle school playing with VB3 and later VB6. Being able to drag and drop components to quickly scaffold out a WYSIWYG GUI which you could then double-click on to create premade handlers was the veritable cat's meow.

    I feel like that kind of event-driven programming model was very intuitive, even for younger audiences.

    • qingcharles 5 hours ago

      All of that stuff is still in the latest Visual Studio 2026. VS2026 looks basically identical to VB6. It's still great if you're making little desktop apps by hand and you can back them with any .NET language, e.g. C# etc.

mdp2021 15 hours ago

> What would BASIC look like

Check PureBasic. https://www.purebasic.com/

Compiles to native, interfaces to C libraries, available on most platforms...

  • ptx 11 hours ago

    It doesnt't seem to be open source, though. A proprietary language with a proprietary implementation is a dead end.

    • mdp2021 10 hours ago

      Still unmissable. Would not do without. Not everything is free - and some is really worth it.

      Fast during development, fast results, flexible, well conceived, a pleasure to work with...

      • jrm4 2 hours ago

        I truly and genuinely do not understand why you'd do something like this not open source? You definitely lose popularity and participation, and today, you almost definitely also lose money.

        • mdp2021 34 minutes ago

          > why you'd do something like this not open source

          The project started in 2003 - the market was different then. Curated products of that kind were normal (and an honest linear attempt to finance the endavour).

boznz 20 hours ago

With retirement + AI I have stopped giving a shit what programming language something is written in; If you can write it in BASIC, go for it.

segmondy 18 hours ago

too bad it's for win, raspberry pi, arduino, esp32, etc need this sort of stuff. lot's of hardware folks who just want to do hardware and not learn programming. they might eventually learn python or C, but BASIC would be so much better.

  • throooooo 14 hours ago

    I'm guessing those type of folks will be well served by LLMs and need not care about specific languages.

  • Gorsefound 14 hours ago

    A Raspberry Pi/ARM port is the most realistic next step; microcontrollers are a different beast. For ESP32/RP2040 today, MMBasic/PicoMite is worth a look.

pjmlp 13 hours ago

Xojo, Mikroe BASIC, VBA, and VB.NET are still around even if they don't make HN headlines.

  • JdeBP 10 hours ago

    The interesting thing would be if someone made a lookalike for Visual BASIC for DOS (not Windows) that ran as a standalone EFI application.

    That is the real 'what if it had not gone out of fashion' path. VB/DOS definitely went out of fashion. GUI BASICs became fashionable, instead. Everyone who does a 'visual' BASIC nowadays does a GUI one.

    The headlined BASIC is nothing like a VB/DOS for EFI, though.

    • pjmlp 8 hours ago

      I would argue that the BASIC variants in 8 bit home computers were already GUI BASIC, given their capabilities and underlying hardware.

      That wasn't the case with GW-BASIC, due to how MS-DOS came to be.

      However the idea of an EFI BASIC does sound rather nice, assuming the whole plethora of graphics programming as well.

      Other take the easy way out with RISC OS for the Raspberry PI, which has BASIC as main programming language alongside Assembly.

      • JdeBP 6 hours ago

        Oh yes. They were definitely graphical. No two ways about that.

        I'm talking more about the distinction between VB/DOS and VB/Windows. They both did the whole WIMP thing, with a visual editor to construct the forms for one's programs, but VB/DOS used a TUI rendering that drew everything with VGA character graphics and used the firmware low-level keyboard access for input; whereas of course VB/Windows used the Windows GUI.

        A VB/DOS-alike that ran on EFI and did the whole form-based programming thing, would use the EFI text input and output protocols, which know Unicode, waiting for events, and standardized scan codes and modifiers.

        There is no major call for it, as you say, when bootstrapping an entire operating system is so easy. But it would be interesting to see someone tackle it from the point of view of what VB/DOS would look like today if it ran directly on the firmware, spoke Unicode, and ran in protected mode

        • pjmlp 6 hours ago

          Ah sure, that could be interesting, given the ongoing nostalgia for TUI interfaces.

          A Phoenix like BIOS UI.

    • vunderba 6 hours ago

      Nice to see another VB/DOS aficionado! One of my first summer jobs that didn’t involve landscaping as a teenager was porting a CAD-based application from VB/DOS to Visual Basic 6 so it could run natively on Win9x machines.

pcdoodle1 23 hours ago

Very cool. Are line numbers required? Are there plans for OS system control like setting system volume or screen brightness?

  • analog31 23 hours ago

    I definitely want a code editor with a setting to number the lines by 10s.

  • Gorsefound 14 hours ago

    noted for future releases. :-)

  • Gorsefound 14 hours ago

    and yes, line numbers are required.

NinjaTrance 13 hours ago

If that was the future of the language, I'm glad BASIC is dead.

  • NinjaTrance 13 hours ago

    To give a bit more of context, here is a small subset of the new instructions:

      - SOUND PRELOAD
      - SOUND INFO
      - SOUNDGROUP
      - SOUNDNAME$
      - SOUNDAVAILABLE
    
      - LOADWAV
      - PLAYWAV
      - STOPWAV
      - WAITWAV
      - PAUSEWAV
      - RESUMEWAV
      - WAVCTL
      - DELWAV
      - WAVACTIVE
      - WAVPLAYING
      - WAVSTATE
      - WAVPOS
      - WAVLENGTH
      - WAVLOADED
      - WAVSLOT
      - WAVCHANNEL
    
      - LOADMID
      - PLAYMID
      - STOPMID, WAITMID, DELMID, etc.
    

    What a terribly designed language.

    • kbelder 3 hours ago

      It's designed to optimize something you're not interested in. That's fine.

  • JdeBP 10 hours ago

    It was not the future of the language. It's starting, as the blurb says, from where GW-BASIC and the old Microsoft BASIC were in the early 1980s. We know what the actual future of BASIC was after those, because that future happened. It wasn't this at all.

  • hakfoo 4 hours ago

    It tells a specific counterfactual story, but it's one that has a reasonable background for it.

    If you were a new computer user in 1980, your Appie II+ or PET 8032 booted straight into BASIC, and it was a good-enough tool that could do productive development for the entire life of the machine there.

    But if you were a new computer user in 1990, you didn't have that. They gave you GW-BASIC, and if you're lucky a separate manual rather than a vague chapter in the main DOS manual. This might be enough to give you some initial experience with programming, but you have a bunch of hard brick walls.

    Your machine might have 640k-4Mb of memory, but GW-BASIC can only meaningfully work with 64k of it. You can't access the mouse or any post-EGA graphics modes without a LOT of assembly shimming. If you had a sound card, it was outside the built-in tooling.

    Remember, this is a few years before the Internet being widely available, and stuff like the GNU project being widely accessible. This is probably the best development tool you have available

    If you wanted to go further in programming, it meant buying a boxed compiler that probably cost well in excess of USD100, and was for a completely different language than the one you had cut your teeth on.

    But if you wanted "The GW-BASIC I already understand, but more", you want this.

meelford 10 hours ago

this would be ideal for the latest version of the modern ZX Speccys, especially given the growing interest from hardware enthusiasts

SilentM68 4 hours ago

Where's the Linux/macOS version?

meelford 10 hours ago

also - is a mac version planned?

fuzzfactor 1 day ago

This looks like it's realy getting better all the time.

MiroslavPokorny 19 hours ago

Basic died because it lacks scoping, and has no locals. This makes doing anything on a large scale a pain...

  • jasomill 19 hours ago

    Structured BASIC dialects have function-local variables, BASIC dialects that support linking separately compiled modules support exported and non-exported variables, etc.

  • mdp2021 15 hours ago

    That's original Basic. Recreations are more complete.

  • pjmlp 13 hours ago

    Structured BASIC was already the way in CP/M, Vax,MS-DOS, Amiga, and even Dartmouth BASIC evolved to support structured programming.