Show HN: QBasic 4.5 on Android (github.com)
One day, he mused about the simplicity and educational value of BASIC and wondered if there was a way to share its charm using today's technology.
Specifically, he was looking for an Android application that could run BASIC so he could "teach programming while drinking coffee with [his] friends".
Thus, BabaBASIC was born—a hat tip to 'Babá', the Greek term for "dad", and a reminder of who sparked this journey.
The first iteration of this was made over a 10-hour all-nighter using existing open-source libraries.
I ended up forking the BASIC-like implementation to make it more byte-for-byte compatible with QBasic 4.5, which is what my father used back in the 90s to teach me programming.
This is the first thing I have ever made of which he approves.
96 comments
[ 5.6 ms ] story [ 184 ms ] threadMy first introduction to programming was BASIC on some 8-bit home computer. Sometimes I wonder what had happened if I had started with Pascal or Scheme instead.
I think a lot of developers own their carrier to BASIC being so accessible.
I think my goal was to make it write my homework, so that it would still look like my very bad handwriting, but more legible?
Family didn't care, but a classmate was very impressed :P
I've never thought of owing my career to BASIC being so accessible, but you're right, and it's a very beautiful thought.
I also wrote my first lines of code on QBasic 4.5 -- though my big teenage-years programming love was Turbo Pascal.
I started a discussion on GitHub, I think the killer feature of QBasic and even more so QuickBasic was the help and reference.
Even the ASCII table was fun to look at and go grab characters, you could imagine something analogous for Unicode.
Similarly for all the stuff in there working out modern equivilents.
The annoying stuff was how much hassle it was to do extra things like handle the mouse pointer via assembly, it would be good if this has extensions for touch etc all documented.
Frankly, this is my first Android/mobile application, so I'm still trying to wrap my head around the limited screen space and whatnot.
I'd be awesome to get some syntax hints, or some form of better autocompletion (it only recognizes some basic statements/lang-delcared functions right now).
I'll follow up on GitHub -- thank you for contributing the discussion there, this is very exciting!
the commit log is the definitive (and painstakingly accurate) log of changes: https://github.com/ianatha/bababasic/commits/main
To clarify my slightly obtuse original post, I started this by using PuffinBASIC, but I ended up forking it because there were a few things implemented differently than my reference QuickBASIC 4.5 installation (running on DOSBox):
* label syntax / case-insensitive labels * forward function declarations * flexible array indexing (i.e. in QBasic your arrays could start at 0, or at 1, and it somehow figured it out, and it still had bound checks) -- haven't implemented this yet * various functions (VAL, INKEY$, SLEEP)
Lastly, and more importantly, PuffinBASIC required Java AWT support (which made it necessitate a desktop), but I have refactored BabaBASIC to abstract the HCI portions (audio/video/keyboard).
Another interesting technical point is that the "Run View", which displays a terminal through which you interact with your script is also a (very small) fork of Termux.
(I needed something to efficiently draw a text buffer while handling all the VT100-related functionality.)
without any internet access in the 90s, I taught myself QBasic largely out of that help reference in order to write little games and simulations. it really was something fantastic.
I missed it, so last year when I rebuilt my website I built it in QBasic:
jamon.dev
So much this. The help in QBasic is how I learned to program at ten years old in a pre-internet world.
A couple years later my friend was trying to push me to learn C and I was sorely disappointed that there was no help, at all.
Though ... I have to wonder (and I'm only half-joking) -- should it just be a ChatGPT integration that can answer questions?
That's handy if you want to run old qbasic code, since typically that code expects to be able to poke hardware registers to do anything beyond what the built in bits of basic can do (for example, adding mouse support or playing sounds beyond beeps).
Unfortunately, Magic Dosbox for Android doesn't seem to work very well with QB45.exe...
Aside from linking with assembler, what QuickBASIC 4.5 funcs give you the ability to interface with the hardware directly in the fashion you're describing?
With those two you could do anything.
Writing a full-on IBM PC/DOS emulator is beyond the scope of this project -- the project's goal is my dad's request to "show off programming while drinking coffee" :P.
Haven't tested, but QB1.1 or 4.5 should also work with vDosPlus [1]. The original vDos apparently has issues with keyboard input in QB, but, arguably [2], this has been fixed in vDosPlus.
There's also that bootable USB stick with FreeDOS or SvarDOS or smth on bare metal + native QBasic within it. I imagine this would actually make a really nice, responsive and distraction free environment for a child. DOS could also boot straight into QBasic via autoexec.bat, or present some fancy personalized menu.bat for the child, which is, yknow, cool. Or... it sure used to be in 1995. :)
As a non-native English speaker, I must also say that QBasic's simple syntax is incredibly good for teaching programming to children. Not too many footguns with weird (#$ymb0ls{}) either. It really is a great teaching language, even in 2023.
1: http://www.vdosplus.org/
2: List of additional features as compared to original vDos: "Keyboard IRQ1/INT9 handling for running programs such as MS-DOS EDIT, QBASIC, Visual Basic and XyWrite": http://individual.utoronto.ca/wengier/vDosPlus/featurelist.h...
My favorite programs from those days are both games. Mysterious Song[0], a JRPG, and Monospace[1], a horizontally scrolling shmup.
[0] http://www.petesqbsite.com/sections/zines/qbgamer/issue1/re_...
[1] http://www.petesqbsite.com/reviews/action/mono.html
My first explorations as a child were more around math/algorithms/graphic functions. Not sure why I was never particularly drawn to games as a child ¯\_(ツ)_/¯.
My favorite one from him: https://www.youtube.com/watch?v=VL0oGct1S4Q
So sad. People from this kind of upbringings are usually very good at "intrinsic motivation".
Man you should have seen my eyes light up when someone should me a full opensource, Linux, computer boot up! I CAN STUDY/MODIFY EVERYTHING! Muahuahaha.
It was a good learning tool, but not as good as LOGO (with the Turtle), of which I later made a clone (KTurtle, part of nearly all Linux distros).
https://apps.kde.org/nl/kturtle/
I hope some mid-level Microsoft marketing manager is enjoying his retirement knowing we're still discussing this decades later.
Fun fact: for a while, Greek public schools taught a language that was called "LANGUAGE", and it was some BASIC-variant written in Greek. It came with it's own IDE called "The Interpreter for LANGUAGE" [1].
10 ΑΡΧΗ_ΕΠΑΝΑΛΗΨΗΣ 20 ΓΡΑΨΕ "HELLO WORLD" 30 ΜΕΧΡΙΣ_ΟΤΟΥ 0
[1]: https://alkisg.mysch.gr/
All-nighters for an employer are one thing, but I have fond memories of exploration and discovery in computing while burning the midnight oil. There is something about programming that just excites the mind in a way that causes time to fly.
I hope your dad enjoys his new BASIC app! Really cool of you.
Last year, when I was going to rebuild my personal website, someone on Twitter challenged me: “Build it in QBasic, you coward”. I was like “haha…wait, can I?”
And I did! It runs on QB64 on a DigitalOcean droplet.
Here’s the source:
https://github.com/jamonholmgren/jamon.dev
Check app.bas for the QBasic code.
I may eventually release a CLI and library that lets people spin up a QB64 website in little time.
The "API" I have in mind would look something like
```
OPEN "TCP:\127.0.0.1\80\LISTEN" FOR INPUT AS #1 INPUT #1, CONN$ IF CONN$ <> "" REM CONN$ contains something like "TCP:\127.0.0.1\80\REMOTE_HOST\REMOTE_PORT" OPEN CONN$ AS #2
END IF```
I wish there was some kind of "computing archeology" discipline
XPATH in LOCATE stmts sounds like asking a disco dancer to moonwalk -- out of its era, but oddly fascinating to watch
I was expecting a classic CGI gateway approach with some templating support and maybe a data source (not necessarily sql but perhaps INI).
Instead it's an HTTP server
On the subject of Android - is it just me, or are there no good, FOSS, off-line capable repls for Android? Ideally I'd want ruby - but anything in the python/js/lisp vein that feels like a repl and is FOSS would be of interest?
https://play.google.com/store/apps/details?id=micro.repl.ma7... // https://github.com/Ma7moud3ly/micro-repl
https://play.google.com/store/apps/details?id=org.eql5.andro... // https://gitlab.com/eql/EQL5-Android
This is wonderful, and i'll have to check it out!
- Basic had existed even before displays and keyboards were popular, so many software developers from that era could appreciate it.
- Microsoft included QBasic 1.1 for free with some of their operating systems.
- All things considered, it was fairly compatible (depending on what the code did) with GWBasic and even basic/basica from old IBM terminals.
- The language was also easy to understand which made it ideal for education
Probably among other points, this brought a pretty large and diverse group of people who loved programming together.
Then moved to QuickBASIC for the Mac
Then TurboPascal
Then C (via C++, taught by a FORTRAN programmer)
BASIC will always hold a sweet spot in my heart :)
Some form of BASIC on an XT8086 -- maybe QuickBASIC? Can't be sure. I remember getting my hands on a ISO-B5-sized burgundy booklet with printed source code annotated with "REM" comments.
Then Turbo Pascal. Then Delphi. Then X86 ASM (influenced by some dude I met at a programming competition).
Then Dr. Scheme for years on end.
<3 BASIC.
Feature request: could you make SOUND and/or PLAY work? :-)
So no grandkids yet?
Coming from someone of a similar age who also started with QBASIC, I hope your dad realizes soon what a talented kid he has.
¯\_(ツ)_/¯
Totally off topic but what I would give for (a) my father being the kind of father I want to maintain contact with and (b) to share a common interest with me, someone that I could talk to about tech. You're a lucky person!