[HN Gopher] Show HN: QBasic 4.5 on Android
___________________________________________________________________
Show HN: QBasic 4.5 on Android
My father, who hung up his coding hat in the '80s, recently entered
the golden years of retirement. 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 'Baba', 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.
Author : thatha7777
Score : 186 points
Date : 2023-11-09 09:10 UTC (13 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| kramerger wrote:
| Looks interesting :)
|
| My 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.
| genericlogic wrote:
| Same here. I wrote a lot of code in my life but barely remember
| any of it. I do remember writing a 'madlibs' program as a kid
| and showing my family and being so proud. 100% the reason I'm
| doing what I do today is because of that day.
| thatha7777 wrote:
| My analogue is writing a thing that could draw numbers and
| print them (I think it was just using the PRINT SCREEN
| button?), but it would make every line squiggly to emulate my
| (very bad) handwriting.
|
| 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
| thatha7777 wrote:
| Thank you!
|
| 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.
| pixelpoet wrote:
| QB45, those were the days :D
| thatha7777 wrote:
| i've been searching for an appropriately nostalgic, yet 8-bit,
| soundtrack to go along with this feeling. suggestions welcome
| alyandon wrote:
| I continued to use qb45.exe for years to write utilities for
| dos/windows because it would produce an exe with no external
| dependencies.
| stuaxo wrote:
| This is nice, I'd like to know the changes you made.
|
| 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.
| thatha7777 wrote:
| Ohhhh yes, you're absolutely right.
|
| 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!
| thatha7777 wrote:
| Ah, and I almost forgot, in re the changes:
|
| 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.)
| stuaxo wrote:
| QB64 has taken on the mantel of modern reimplementation, its
| worth seeing if there are any extensions from there that are
| worth implementing.
| knome wrote:
| >I think the killer feature of QBasic and even more so
| QuickBasic was the help and reference
|
| 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.
| jamon51 wrote:
| I had the same experience as a kid. Probably built over a
| hundred QBasic-powered games with no internet to help me.
|
| I missed it, so last year when I rebuilt my website I built
| it in QBasic:
|
| jamon.dev
| rlawson wrote:
| 100%. Heck I coded up a system that printed footage marks
| along the side of industrial coated material using qbasic
| interfacing to an industrial printer via the joystick port on
| a 386! No internet so I used the help system constantly.
| Eventually the company kept a pile of 386's stacked as spares
| because the system ran too fast on a 486.
| donatj wrote:
| > the killer feature ... was the help and reference
|
| 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.
| thatha7777 wrote:
| I'm actively working on some kind of "live docs" feature for
| BabaBASIC.
|
| Though ... I have to wonder (and I'm only half-joking) --
| should it just be a ChatGPT integration that can answer
| questions?
| speps wrote:
| No, plain old docs
| thatha7777 wrote:
| 'twas just a joke
| stuaxo wrote:
| Definitely not ChatGPT, even if you put in a thing that any
| code it ran would be tested somehow for correctness.
| thisisauserid wrote:
| Game of Life but no Gorillas?
| thatha7777 wrote:
| C'mon, that's clearly over the top within the context of an
| all-nighter for a gift for my father :P
| thisisauserid wrote:
| I kid. But QBasic Gorillas was the first time I ever edited
| code. When the the banana takes out half a city block the
| pressure really amps up.
| londons_explore wrote:
| Worth noting that you can also run the original qbasic in dosbox.
|
| 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).
| thatha7777 wrote:
| Thank you! I use DOSBox to run QuickBASIC 4.5 on my Mac to
| check my implementation :)
|
| 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?
| londons_explore wrote:
| 'peek' and 'poke' were the commands for messing about with
| low level stuff if I remember correctly.
|
| With those two you could do anything.
| thatha7777 wrote:
| Ah, yes, you're 100% right.
|
| 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.
| Dwedit wrote:
| There were also IN and OUT commands. Used by programs to
| directly set the palette on VGA, among other things
| (entering tweaked VGA modes, etc)
| marttt wrote:
| Yep, me and my son are currently daily users of QB1.1 in
| DOSBox. Works nicely, but you might need trial and error to
| figure out the [Break] key when you're on a laptop.
|
| 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...
| davexunit wrote:
| Awesome! QBasic was my first programming language, long obsolete
| by the time I discovered it but I had no idea. Had a lot of fun.
| Fond memories of browsing Pete's QB site.
|
| 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
| thatha7777 wrote:
| That's an awesome resource! Thank you for sharing. Hopefully
| BabaBASIC will be able to run any of these games at some point
| of time.
|
| 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 -\\_(tsu)_/-.
| mrozbarry wrote:
| qbasic news, petesqbsite, among other good places. Good
| memories, thanks :D
| malermeister wrote:
| This isn't as much about the project itself, but I just wanted to
| say that it sounds like you have a very special relationship with
| your dad. Cherish it!
| thatha7777 wrote:
| Considering this is the first thing I have made in decades that
| he liked/didn't say anything negative about it... it's all very
| special.
| flykespice wrote:
| Does it supports graphics?
| thatha7777 wrote:
| No, not at the moment, it only supports the default "text mode"
| (VT100). Graphics modes are my next milestone.
| flykespice wrote:
| Nice, to be honest I never lived during the QBasic days, but
| one of the channels where I got inspired into programming as
| young(Bisqwit) commonly used QBasic to showcase their
| creations in live coding.
|
| My favorite one from him:
| https://www.youtube.com/watch?v=VL0oGct1S4Q
| cies wrote:
| > This is the first thing I have ever made of which he approves.
|
| So sad. People from this kind of upbringings are usually very
| good at "intrinsic motivation".
| thatha7777 wrote:
| Thought so too . . .until earlier today when I noticed how
| chipper all the upvotes are making me.
| cies wrote:
| I learned with but hated QB, GW-B and MSX-B. Why? Because I could
| not make an "fast" executable (.exe) and the compilers those days
| (on those platforms) we're al costly and impossible for me to
| come by as a kid.
|
| 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/
| PretzelPirate wrote:
| When I was a kid and found out that QBasic couldn't make an
| exe, I pirated QuickBasic which could do it just fine.
| thatha7777 wrote:
| I am still so very confused by all the xBASICs, and I wonder
| if that was a big part of its decline...
|
| 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 ARKhE_EPANALEPsES 20 GRAPsE "HELLO WORLD" 30 MEKhRIS_OTOU
| 0
|
| [1]: https://alkisg.mysch.gr/
| sumtechguy wrote:
| the decline of basic is the story of .NET and c#. MS
| stopped meaningful support for it and went all in on .NET.
| cies wrote:
| And for good reasons. F# and C# are superior to Visual
| Basic -- for a language perspective -- in every way. Also
| dotnetcore is MIT licensed!
| sumtechguy wrote:
| I do not disagree. The problem was the visual basic
| ecosystem was basically abandoned. I personally did not
| use it and thought it kinda of janky. But thousands of
| people for some reason really connected to it and could
| make interesting things. MS threw out all of that
| goodwill and forced Visual Studio 2002 which was utter
| junk compared to visual studio 6 and not really fixed
| until 2010. Yeah now c# is better. But at first it was a
| real head scratcher and the IDE made it seem terrible.
| cies wrote:
| I knew it existed, but by the time I had access to warez CDs
| and found a QuickBasic version I also knew about the open
| source movement and GCC. :)
| k1ns wrote:
| > I couldn't find anything that I felt comfortable recommending
| to him, so I pulled an all-nighter and made this.
|
| 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.
| jamon51 wrote:
| I love this so much. I got my start on QBasic and made hundreds
| of games between 12 and 19 years old. I eventually left it
| behind, but always had a fond spot in my heart for it.
|
| 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.
| knewter wrote:
| You could serve your qbasic website from an old Android phone
| in a drawer my dude.
| thatha7777 wrote:
| Not with BabaBASIC (for now?). No networking support
| whatsoever :P
| knewter wrote:
| Fairly certain jamon can wire in some io, let me nerd snipe
| in peace plz
| thatha7777 wrote:
| My apologies. BabaBASIC is here to make any Android-
| related anachronistic dream come true (> w <).
| thatha7777 wrote:
| I think I have a general idea on how to implement basic
| TCP/IP sockets while staying true to QBasic 4.5's spirit
| (i.e. not introducing functions like
| _OpenConnection/_ConnectionAddress etc.)
|
| 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 REM ... respond to request PRINT
| #2, "200 OK" CLOSE #2
|
| END IF
|
| ```
| jamon51 wrote:
| Don't tempt me.
| thatha7777 wrote:
| Ugh, jamon51, I think we slashdotted your website
| thatha7777 wrote:
| This is awesome! Kudos!
|
| I wish there was some kind of "computing archeology" discipline
| qup wrote:
| The folks who built this stuff are still alive. Historian
| would be a better fit, and we can archive the actual first-
| hand accounts if we don't waste the chance.
| thom wrote:
| Ha, I once created a web framework in classic ASP that was
| inspired by QBasic - you'd use pure HTML templates but in
| handlers you'd write LOCATE statements using XPath selectors
| instead of screen coordinates, followed by PRINT statements to
| actually fill in the content of an element. Never tried to
| actually write it in QBasic itself though. Nice work!
| thatha7777 wrote:
| Thank you!
|
| XPATH in LOCATE stmts sounds like asking a disco dancer to
| moonwalk -- out of its era, but oddly fascinating to watch
| thom wrote:
| It honestly wasn't a bad approach in practice, many years
| later there was a similar library called Enlive in Clojure
| which I genuinely enjoyed. Forces you to use nice semantic
| IDs and classes for everything. I suppose if you wanted the
| real BASIC experience you'd actually just PEEK and POKE
| with character offsets into the templates or something
| ungodly like that.
| kristopolous wrote:
| I was confused for a few seconds. This is to help others. The
| user didn't build their website, they built the web server, a
| more difficult task.
|
| 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
| e12e wrote:
| Impressive project! I remember a friend showed how to render some
| "demo" style graphics (not a fractal, I believe it was some kind
| of line-based art) on our pentium. First time I thought the PCs
| might be the bane of the Amiga (we had an Amiga 2000).
|
| 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?
| thatha7777 wrote:
| There's a few apps on the Play Store for specific languages:
| cl-repl (for LISP) and Micro REPL (for MicroPython).
|
| 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
| mrozbarry wrote:
| I'm a huge fan. I used to volunteer on allexperts.com to help
| people with QBasic stuff, before the dawn of stackoverflow and
| other probably more searchable places.
|
| This is wonderful, and i'll have to check it out!
| thatha7777 wrote:
| wow-- it's been very impressive and heartwarming to learn today
| that so many folks have fond QBasic memories and it evokes such
| a sense of community.
| mrozbarry wrote:
| I think it's because QBasic was, among many things, a bit of
| a bridging language.
|
| - 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.
| warrenm wrote:
| I learned on BASIC for the Tandy 102
|
| 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 :)
| thatha7777 wrote:
| Very similar journey :)
|
| 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.
| aleken wrote:
| Awesome! A blast from the past!
|
| Feature request: could you make SOUND and/or PLAY work? :-)
| thatha7777 wrote:
| Absolutely! Thank you for brining this up! Tracking it as
| https://github.com/ianatha/bababasic/issues/77
| randombits0 wrote:
| >This is the first thing I have ever made of which he approves.
|
| So no grandkids yet?
| thatha7777 wrote:
| Grandpa is obviously paying you to inject this here. Hi
| grandpa!
| mholt wrote:
| What a wonderful and heartwarming story! Until that last
| sentence... I'm so sorry. At the risk of sounding too personal, I
| imagine many of us here can relate to that with someone in our
| family.
|
| Coming from someone of a similar age who also started with
| QBASIC, I hope your dad realizes soon what a talented kid he has.
| thatha7777 wrote:
| Thank you for your kind words. I think this app pushed him over
| the edge.
|
| -\\_(tsu)_/-
| baudaux wrote:
| For this reason I put bwbasic in https://www.exaequos.com
| StuGoss wrote:
| My first game was a version of Space Zap by Midway on a Timex
| Sinclair 1000 in Sinclair Basic. Recreated in on a Commodore 64
| and then in QBasic on an early IBM at work. I still use the Model
| M keyboard from the IBM to this day.
| barbazoo wrote:
| > My father, who hung up his coding hat in the '80s, recently
| entered the golden years of retirement.
|
| 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!
| jkonline wrote:
| Yeah, but... Can it gorillas.bas?
| thatha7777 wrote:
| 2nd time this comes up -- I'll have to reconsider my project
| priorities!
| j4yav wrote:
| So cool! When I was at GitLab I modified a CI runner to execute
| the script section of the CI YAML in VICE, a Commodore BASIC
| emulator. No particular reason and it wasn't useful for anything,
| but it was pretty fun. https://gitlab.com/jyavorska/c64exec
| ryanisnan wrote:
| Great post, congrats on the release.
| thatha7777 wrote:
| Thank you!
| thehias wrote:
| Very cool! Check out this software and games archive:
| http://qbasic.de/
| thatha7777 wrote:
| Never would've found this myself -- appreciate it
| ronyeh wrote:
| Mid 90s qbasic was how I learned to program!
|
| My friend and I extended the nibbles / snake game ... I wonder if
| I can get it to run on your qbasic implementation:
|
| https://github.com/ronyeh/nibbles
| thatha7777 wrote:
| This is cool :)
|
| I'll also give it a try, and if it works as-is on QBasic 4.5,
| I'll try to live up to my promise and make BabaBASIC more
| compatible with QBasic 4.5 :).
| pc2g4d wrote:
| I learned programming on QBASIC in the 90's, aged 11 or so. My
| brother and I had dabbled with GW-BASIC, which a more
| knowledgeable friend used to draw cool-looking rainbows and
| whatnot on the screen. That same friend taught me the "IF...
| THEN..." construct and a new world opened up to me. QBASIC's
| built-in help manual was a key resource in getting up-to-speed.
| gabrielsroka wrote:
| I made a super cheesy version of BASIC you can run in a browser.
| It just does a search and replace from BASIC to JavaScript.
|
| https://gabrielsroka.github.io/webpages/BASIC.html
|
| Src
|
| https://github.com/gabrielsroka/gabrielsroka.github.io/blob/...
___________________________________________________________________
(page generated 2023-11-09 23:00 UTC)