[HN Gopher] BootBASIC Interpreter in 512 Bytes
___________________________________________________________________
BootBASIC Interpreter in 512 Bytes
Author : AlexeyBrin
Score : 88 points
Date : 2022-07-03 11:09 UTC (11 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| whitten wrote:
| I wonder if a form of BootLisp would be possible in such a
| limited number of bytes?
|
| In exploring this, I see BootBasic has no subroutine call and
| return. So there is no model in this code for such.
| jim_lawless wrote:
| Please see SectorLisp
|
| https://justine.lol/sectorlisp/
| marcodiego wrote:
| Something I liked about home computers was the fact that you
| turned it on and, if there was just no media attached to it, you
| were instantly dropped into a BASIC console. If you had no
| software, no OS, no cartridge, no tape, no floppy, no disk... the
| machine was still useful. I missed that when I started using a
| PC.
|
| Later I got to know that the original PC, IBM 5150, had such
| feature and the skill was simply removed as the "standard"
| evolved.
|
| I think motherboard vendors should have kept this option on the
| BIOS. Being able to turn on the computer and have the instant
| possibility of writing and running code when every other software
| brakes is very powerful. Recovering a DOS based system was
| relatively easy if you had other computer available: simply put a
| floppy and type "sys a:" and you had a new boot disk, but you
| still needed other computer to do a recovery. Getting your
| computer to a usable or useful state without the help of another
| machine is something that we shouldn't have lost.
| yjftsjthsd-h wrote:
| Some thoughts:
|
| As sibling notes, macs can install themselves over the internet
| from firmware, which sounds like exactly what you want.
|
| Macs can also boot in target disk mode, which does need another
| computer but also trivializes certain recovery tasks.
|
| Several systems (Android, at least some PCs, I _think_
| Chromebooks) have either 2 root filesystems or a recovery
| system on their disk that can reinstall the main OS. This is
| weaker but still useful.
|
| You can flash iPXE to a network card and use that to boot a PC
| over the internet kind of like a mac with more steps.
|
| Coreboot can take arbitrary payloads; if your device has enough
| flash you could easily include GRUB, FreeDOS, and a
| BASIC/LISP/etc.
| hakfoo wrote:
| A traditional BIOS can also boot an arbitrary payload. You
| can hijack INT 0x18 (boot to BASIC) to do whatever you want.
|
| A lot of clone BIOSes just had to branch to a "please insert
| bootable media" or "No ROM BASIC - System Halted" message,
| but you could fairly easily inject something much like this.
|
| I've modified the old "Anonymous XT clone" BIOS to support a
| stub that copies a chunk of ROM into RAM and then executes
| it.
|
| This works reasonably well with some of the 512-byte "boot
| sector" tools I've tried, or with some minimal DOS .COM
| executables (i. e. an old Tiny Basic.) The copying step is a
| conservative approach because I suspect a lot of off the
| shelf software doesn't expect to be running inside ROM, and
| if it tries self-modifying code or simply writing to the same
| segment, all hell breaks loose.
|
| For me, the limits were that, with an XT, you probably didn't
| want much more than 32-64k of ROM consuming precious address
| space, so unless you wanted to get gimmicky with banking in
| more memory or decompression, you're limited to maybe 20-40k
| of payload, which is a little small for "current" embeddable
| DOS products.
| fuzzfactor wrote:
| What's needed now is a much more extensive BASIC in the
| form of an EFI executable.
| WesolyKubeczek wrote:
| > macs can install themselves over the internet from firmware
|
| But not M* macs. Their firmware is only capable of
| initializing the most basic hardware and boot from the
| internal SSD, like good ol' times.
|
| Heck, their boot picker is now a fullscreen application
| running on a stripped down macOS, which is started from the
| internal SSD.
|
| This also means that if your internal SSD is hosed, so is
| your Mac. Enjoy!
| Gordonjcp wrote:
| > you were instantly dropped into a BASIC console
|
| Or Forth, if you were lucky enough to have a Jupiter Ace.
| Lex-2008 wrote:
| > Getting your computer to a usable or useful state without the
| help of another machine is something that we shouldn't have
| lost.
|
| I once saw (and used) a similar feature on Mac: pressing some
| key combination during boot allowed you to wipe and reinstall
| OS from Internet. Not sure how exactly it was implemented,
| though, but I agree it would be cool if BIOS had a feature
| where you could type an URL to ISO and it would download and
| boot it.
| password4321 wrote:
| Check out netboot.xyz
|
| https://news.ycombinator.com/item?id=31814288
| musicale wrote:
| > pressing some key combination during boot allowed you to
| wipe and reinstall OS from Internet
|
| option-command-r (on an intel mac at least) boots it into
| internet recovery mode
| AlbertoGP wrote:
| Maybe you mean Open Firmware:
| https://en.wikipedia.org/wiki/Open_Firmware
|
| > " _It originated at Sun Microsystems, where it was known as
| OpenBoot, and has been used by vendors including Sun, Apple,
| IBM and ARM._ "
|
| > " _Open Firmware allows the system to load platform-
| independent drivers directly from a PCI device, improving
| compatibility._ "
|
| > " _Open Firmware may be accessed through its command line
| interface, which uses the Forth programming language._ "
|
| As I had written a few Forth programs on the Commodore 64,
| when I got an aluminium PowerBook G4 years ago (2003) I tried
| it out, and yes, it was Forth.
|
| More recently, I used it for real when setting up a Sun Blade
| 150.
|
| Here is a quick reference page listing the commands
| available: http://firmworks.com/QuickRef.html
| yjftsjthsd-h wrote:
| No, they mean internet recovery mode:
| https://mackeeper.com/blog/mac-internet-recovery-mode/
|
| Although yes, the fact that open firmware let you boot to a
| FORTH prompt is very relevant to this general discussion:)
| drallison wrote:
| This interpreter for a BASIC subset very much like Tiny BASIC,
| which was done for the Altair as a project at PCC (The People's
| Computer Company) in the mid-1970's. I am looking forward to
| reading the code.
| rudolfwinestock wrote:
| As jim_lawless has noted, elsewhere in this thread, SectorLisp
| (by Justine Tunney) is 436 bytes.
|
| https://justine.lol/sectorlisp/
| indymike wrote:
| The author, Oscar Toledo is a five time winner of the
| International Obfuscated C Code Contest. If you've never worked
| with assembly, take a look at basic.asm. It's not nearly as
| unapproachable or complex as many would believe (and in this
| case, Oscar's comments make it easy to understand). Understanding
| how a simple interpreter is built from scratch is eye opening.
| jhallenworld wrote:
| Well check out VTL for the Altair 680. BASIC-like in 768 bytes.
|
| https://youtu.be/GJ02QLHRVOw
|
| It's interesting because instead of GOTO, you assigned the target
| line number to a special variable. Instead of IF, you multiplied
| the result of a test with the line number and assigned the result
| to the special variable. An assignment of 0 is ignored.
___________________________________________________________________
(page generated 2022-07-03 23:01 UTC)