Hacker News new | past | comments | ask | show | jobs | submit login
BootOS: Monolithic operating system in 512 bytes of x86 machine code (github.com/nanochess)
588 points by nanochess on July 30, 2019 | hide | past | favorite | 121 comments



For those not aware of the background, the author is a wizard from a secretive underground society of wizards known as the Familia Toledo; he and his family (it is a family) have been designing and building their own computers (and ancillary equipment like reflow ovens) and writing their own operating systems and web browsers for some 40 years now. Unfortunately, they live on the outskirts of Mexico City, not Sunnyvale or Boston, so the public accounts of their achievements have been mostly written by vulgar journalists without even rudimentary knowledge of programming or electronics.

And they have maintained their achievements mostly private, perhaps because whenever they've talked about their details publicly, the commentary has mostly been of the form "This isn't possible" and "This is obviously a fraud" from the sorts of ignorant people who make a living installing virus scanners and pirate copies of Windows and thus imagine themselves to be computer experts. (All of this happened entirely in Spanish, except I think for a small amount which happened in Zapotec, which I don't speak; the family counts the authorship of a Zapotec dictionary among their public achievements.) In particular, they've never published the source or even binary code of their operating systems and web browsers, as far as I know.

This changed a few years back when Óscar Toledo G., the son of the founder (Óscar Toledo E.), won the IOCCC with his Nanochess program: https://en.wikipedia.org/wiki/International_Obfuscated_C_Cod... and four more times as well. His obvious achievements put to rest — at least for me — the uncertainty about whether they were underground genius hackers or merely running some kind of con job. Clearly Óscar Toledo G. is a hacker of the first rank, and we can take his word about the abilities of the rest of his family, even if they do not want to publish their code for public criticism.

I look forward to grokking BootOS in fullness and learning the brilliant tricks contained within! Getting a full CLI and minimalist filesystem into a 512-byte floppy-disk boot sector is no small achievement.

It's unfortunate that, unlike the IOCCC entries, BootOS is not open source.


What an amazing story, thanks for sharing!

I just watched some of TV interviews with the family and saw the rest of his work, and it's pretty amazing. Check out Invaders in 512 bytes [1][2], or Aardvark game for the Atari 2600 ([3]).

Also seems he has just self-published a book (as of July 27):

Do you would like more details on the inner workings? This program is fully commented in my new book Programming Boot Sector Games and you'll also find a 8086/8088 crash course! Now available from Lulu [4]

[1] https://github.com/nanochess/Invaders

[2] https://www.youtube.com/watch?v=pC976eejfms

[3] https://www.youtube.com/watch?v=HNZfw6jShng

[4] http://www.lulu.com/shop/oscar-toledo-gutierrez/programming-...


This might interest me as someone whose job is the absolute other end of the spectrum, in databases and HLLs. Reason is that I'm concerned with CPU performance and that largely depends on caches (after you've done any algorithmic improvements).

The unqualified claim - may I say lie - that CPU time is cheaper than programmer time was never true and never will be[0] because it depends, it depends on the economics, and a surprising amount of my time has been taken up optimising for speed on multicore modern CPUs. Exactly what other people say isn't worth doing, right up until it is - and it often is.

Optimising for speed often means optimising for caches, and that means optimising for size[1], so I'm going to dive into this guy's stuff.

[0] and I'd ask people to stop repeating it unless the larger context is accounted for.

[1] and cache-friendly access patterns; another issue.


I smile on reading this. I spent well over a decade hand-optimising SQL to do things like shaving a millisecond off a query, or helping (a little) to maintain a proprietary application server in C because it runs so fast we barely needed any servers to support one of the busiest web systems in the world. When you stack up the hardware and electricity costs and general bureaucracy costs of running hundreds of servers day in day out, then these economies do make sense.


As Jeff Atwood famously puts it "performance is a feature", so as any with feature, wether you should invest in it depends on the project and the needs. Sometimes it's worth your time sometimes it's not, only your specs can tell.


I keep telling people that being able to do something in one millisecond is a lot less powerful than being able to do it in one microsecond, especially in a world with Hypothesis and afl-fuzz. There's no such thing as “fast enough.”

I'll be surprised if you learn new things about cache-oblivious algorithm design from BootOS, though.


> Also seems he has just self-published a book (as of July 27):

> Do you would like more details on the inner workings? This program is fully commented in my new book Programming Boot Sector Games and you'll also find a 8086/8088 crash course!

I created one such game [1] a few years ago and had plenty of fun. I'm pretty shocked to see an actual book published specifically about this niche topic. I haven't read it, but I hope it gets some recognition, because IMO toying with 8086 is one of the best ways to get into bare-metal coding.

[1] https://github.com/qx89l4/utris


Yeah, I was all prepared to go into a fairly standard "this isn't an OS, an OS needs to load and execute other programs" before digging into the source, but this totally does that and has a simple shell.

This is ridiculously impressive hacking up there with Woz code.


I've written a toy bootloader before — a much smaller goal/idea — and my goal with the first sector was to load the second sector!


Makes me think, are they already the first Archivists. Preserving the manufacture of usable computers when the rest of the support infrastructure for modern tech no longer exists. That might just be me projecting my own thinking onto what you've suggested about this family though.


They sounded like a made-up story until I started to look into what you were saying. Why does this family do this? What's the motivation? Pure hacking? Do they run a business in technology and they play around with fun side projects like this?


> Why does this family do this?

Why did Mozart write music? What would Mozart have done if he lived in the city of the deaf?

I mean they've written a lot of stuff on their web site about their motivations — they saw that electronics were the wave of the future, they wanted to make Mexico technologically independent and limit the damage of the neoliberal economic model, they wanted to preserve the Zapotec culture from obliteration, and so on — but I think basically it's that they like doing it, in the way Mozart liked music. I'm sympathetic to those other motivations but I don't think they would have been sufficient to maintain their progress in the face of the opposition they've faced from the Mexican government, which continues to adhere to the obsolete "progress is big factories" model mixed with the simply traitorous "progress is installing Microsoft software" model. (They've written about this stuff on their website too.)

As far as I can tell, they make a living by building some industrial control hardware and teaching electronics classes. Maybe a member of the family will comment and offer more detail.


If the OP that posted the link here is the same person that wrote it, as their username and comment history suggests, I think you are probably spot on wrt being motivated by doing it for the sake of doing it.

The HN profile of OP says: “I fight boredom by challenging myself to my limits.”

That’s the hacker spirit :)



Oh, that's wonderful news! I had assumed the lack of license was intentional.


Anecdotally, I don't think I have a license specified in any of my repos. Mostly because I forget, but partially out of laziness.


How did you learn so much about them? Asking genuinely


I read all the articles on their web site (the ones in Spanish and not Zapotec, anyway), the articles in the press about them, and the comments sections of those articles, and I talked with hacker friends of mine who live in Mexico City. I'm interested in minimalist computing systems like Oberon, Plan9, stage0, MesCC, Scheme, Forth, Squeak, OTCC, the LGP-30, and the Familia Toledo's Biyubi system; myself, I've written things like StoneKnifeForth and httpdito, a web server in under 2000 bytes: https://news.ycombinator.com/item?id=6908064

But only in my dreams do I approach achievements like Biyubi.


Good stuff.

>Probably nobody will read this comment here, but I thought it was worth mentioning.


I wondered the same thing, then I did a quick Google search and it turns out they're relatively known in Mexico They also have a web page: www.biyubi.com


Maybe "underground" was not the best description, but it is the case that much of their software remains unpublished, and so people still debate whether it really exists or not. I think it probably does, because 40 years of a family building extremely optimized software could produce a talent like Óscar Toledo G., while 40 years of running a con job would not.


"The coming war" definitely paints their view of the future as cynical, but as someone who works in robotics for military use it's hard to argue with it...


All the repos in the org looks pretty interesting: https://github.com/nanochess


Also by Óscar Toledo, chess in 1k of JS: https://js1k.com/2010-first/details/750


If you have the time, it would be a great project to translate and summarize all the relevant material about the Familia Toledo.


Hmm, I hadn't thought about that! I wonder if they'd be willing — a lot of their website is under a somewhat vague quasi-open-source license, but they might be chary of "helpful" outsiders who want to "help", as I'm inferring they've had some bad experiences in the past.

They've translated some of their pages themselves, although the translation is somewhat out of date: http://www.biyubi.com/eng_principal.html


Do you have any suggestions on where to find any english language documentation about the family? I am ravenously curious.


They have some English pages on their website, although they haven't been updated in several years: http://www.biyubi.com/eng_principal.html

If you make fun of the errors in the translation I will make fun of you mercilessly for not knowing any Spanish at all.


Update: it's open source now! As of two hours ago! He also open-sourced bootBASIC, but not fbird, pillman, or invaders. (I had assumed that the lack of any license was intentional, perhaps to keep other people from selling books based on his work, in competition with his own.)

Unfortunately I can't update my top-level comment above.


Since I first saw it posted, I've probably played thousands of games of chess on Nanochess. Impressive achievements, I'd love to learn more of what they've done


> For those not aware of the background, the author is a wizard from a secretive underground society of wizards known as the Familia Toledo

Wow. None of this is plausible.


I wonder how few bytes he'd need for a brainfuck implementation


I absolutely love that this is not some parody of cyberpunk fiction, but instead reality.


Great upsight. This could totally be a Neal Stephenson character.


Or Jorge Luis Borges.


It is cyberpunk reality now. I totally see this tech being sold for premium price to all sorts of security minded people, good and bad.


> It's unfortunate that, unlike the IOCCC entries, BootOS is not open source.

It's not? What's that asm file in there? It looks like it's the full source code for the image. Or do you mean there's no license file, so it's not free-software/copyright?


Presumably GP means the latter. Without a license file, the author retains all copyright, you can’t reuse or redistribute any of the code. So it’s source available, not open source.


You mean open source yes, free software no.


No, it's not "open source" unless it has a license that meets the open source definition [1]. "Source-available" is the right term for this sort of thing.

[1] https://opensource.org/osd


The obvious common sense definition of "open source" is "I can see the source." This is probably what everyone in this thread automatically thought of, except those to whom the agenda of the Open Source Initiative is of extreme importance and who thus have memorized their definition.


I don't think anyone has memorized it, but everyone who was around when "open source" was first introduced and we debated it to death (compared to "free software") knows that the source being available isn't enough.


So it's not Open Source™, as defined by The Open Source Initiative. I'll still call it open source as there is source in the open that doesn't seem leaked maliciously.


Calling it that could be parsed in a way that would be technically true, but it would be intentionally obtuse, in the same way that a cowboy who rides off on a horse named Tuesday could be described as having "left on Tuesday," or a malware author fond of white fedoras might be described as a "white hat hacker."

"Open source" has been understood to mean "freely redistributable and modifiable" source for a couple of decades now, and if you used it to mean something else without clarifying, you should expect that they will misunderstand you.


> "Open source" has been understood to mean "freely redistributable and modifiable" source for a couple of decades now

I don't know if this is true universally, or only in certain communities.


Only certain communities. Such as... the general open source community. And maybe even software developers in general. I can definitely see this being misunderstood by end users or others because licensing and the related terminology is just plain confusing, but as long as I can remember it was very clear that there's a difference between shared source, 'available' source, and open source.

The same exact arguments can be made about free software, only worse because colloquially users have traditionally confused it with the term freeware.


Right, one of the strong arguments in favor of the term was that “open source” had no pre-existing meaning to constantly struggle against. Thus my frustration with the persistent confusion, where by “confusion” I mean “con men falsely claiming that their software is open-source in order to free-ride on the goodwill the open-source community has earned through decades of hard work and persistence against impossible odds in order to guarantee basic human rights to everyone in an increasingly computer-mediated world.”


>source in the open

That's not a normal sentence construction though, it sounds tortured.

You may be able to see through my windows into my home: that doesn't mean my home is open to you.


No, it is “source available”.

It’s the difference between UFC and MMA, or declaring that addition == subtraction (if only you negate all the terms).

If you don’t use the term correctly, then you’re muddying the waters.

Source Available - unknown license

Free Software - no cost, may or may not have source available

Open Source - OSI approved, there exists an automatic license to at least use or redistribute the code unmodified


Free Software doesn't mean no cost, it means software where "the users have the freedom to run, copy, distribute, study, change and improve the software".

Two commonly used definitions are the Debian Free Sotware Guidelines (https://www.debian.org/social_contract#guidelines) and the FSF's Free Software Definition (https://www.gnu.org/philosophy/free-sw.en.html).


Nicely demonstrating that just as "open source" is open to multiple interpretations, so is "free software". Within certain communities, there are widely-accepted definitions (from OSI, FSF, Debian, etc) but not everyone automatically understands the terms according to these definitions.


> Nicely demonstrating that just as "open source" is open to multiple interpretations, so is "free software".

Not really, no. The FSF definition of 'free software' is accepted by the technical community as the definition of the term. Same goes for the OSI's definition of Open Source.

> not everyone automatically understands the terms according to these definitions

Not really, no. No-one knowledgeable about these topics is going to insist upon non-standard definitions of the terms. Marketing drones may abuse the terms, and ignorant people don't know any better than to be imprecise, but they are not the same thing as what you are suggesting.

Debian do not make up their own definitions. They explicitly mention both the FSF and OSI in their article on licensing. They certainly have their own ideas on intellectual property (their famous objections to Mozilla's rules about the Firefox trademark), but I don't see them redefining any terms. They are careful to use Debian Free Software Guidelines (DFSG) when referring to their own rules. [0]

Aside: it can be helpful to capitalise to emphasise that you mean the proper definitions of the terms, e.g. The software is neither Free Software nor Open Source. Clunky, sure enough, but people do occasionally make up their own definitions and run with them, often enough that it's a problem for clear communication.

I'm not really sure why. Making up your own personal definitions for terms already in common parlance, is usually treated as an exercise in obtuse silliness, for obvious reasons.

Usually, no exception is made for when an accepted technical term is misused in common parlance, e.g. using 'theory' for any explanation that pops into your head, or referring to an automatic rifle as a 'machine gun'. In those instances we separate the popular use of the term from the technical one, and still insist on correct terminology in technical circles.

[0] Point 31 of https://people.debian.org/~bap/dfsg-faq.html


> Nicely demonstrating that just as "open source" is open to multiple interpretations, so is "free software". Within certain communities, there are widely-accepted definitions (from OSI, FSF, Debian, etc) but not everyone automatically understands the terms according to these definitions.

At least for "free", it (used to be?) very common to add an "as in" after, like "free as in beer" (you don't have to pay) or "free as in speech" (you can do what you want with it).


Yes, it's true that some people misunderstand them, but it's a good thing that these terms have clear and widely understood meanings (compared to something completely vague like, say, "agile") and so we should promote correct usage rather than letting them drift.

Who benefits from watering them down? People who want to take advantage of confusion to release their software under weaker licenses while taking advantage of the "open source" or "free software" names.


Those three definitions are so similar that when they disagree it's usually because someone is misinterpreting something. The key disagreements between Debian and the FSF are about invariant sections in documentation and the mere existence of Debian’s non-free category, which it explicitly doesn't claim is free software.


Generally, software like this is called "source available", not "Open source".


Where are these people coming from? We were perfectly clear when we invented the term "open source" that we meant "free software", to the point of adapting the Debian Free Software Guidelines into the explicit and detailed Open Source Definition, and we've been using the term consistently for over 20 years. Where is the roach nest that keeps sending forth these would-be free-riders on the goodwill attached to the term "open source", who keep trying to falsely pass off their proprietary crud as "open source", and how can we exterminate them?

(Not, of course, BootOS; it never claims to be open-source.)

https://en.wikipedia.org/wiki/Open-source_software


> Where are these people coming from? We were perfectly clear when we invented the term "open source" that we meant "free software", to the point of adapting the Debian Free Software Guidelines into the explicit and detailed Open Source Definition, and we've been using the term consistently for over 20 years.

Well, language is open, and confusing terminology will cause misunderstandings. Besides, there is not one definition of open source, and the most common definition has 10 criteria. You're not exactly doing anyone a service by calling someone who is not aware of all this background and understandably uses a rational interpretation of "open source" a roach. In fact, you come across as a douchebag.

(Now, I agree that intentionally abusing the term is reprehensible, but that does not seem to be the case here)


In fact, you come across as a douchebag.

Whatever problems you may have with my ethnicity hardly seem relevant here! We're talking about con men falsely claiming that their software is open-source in order to free-ride on the goodwill the open-source community has earned through decades of hard work and persistence against impossible odds in order to guarantee basic human rights to everyone in an increasingly computer-mediated world. If it takes douchebags to show the falsity of their false claims, then let's have more douchebags! (But actually I think people of any ethnicity are equally capable of standing up for what is right; it doesn't have to be a douchebag like me.)

I don't know why you think the error was unintentional in this case. The poster in question wrote, "You mean open source yes, free software no." They are implying that they not only have knowledge of the nuances of the definitions in question, but are so certain of it that they correct other people for misusing the terms — they aren't just guessing. Presumably such a person will at least have read the introductory paragraph on the Wikipedia page for "Open-source software"!


I'm not saying you're wrong. I'm just saying the mistake is understandable, and that you can correct someone in a polite way. Probably everyone has used terminology the wrong way, and I don't think overreacting helps your case in any way.

(I don't understand your remarks about ethnicity. As far as I know 'douchebag' is not a racial slur.)


I assume it's mostly due to misunderstanding. It's been a long time since the open source definition was adopted and we're seeing more and more people now who don't know the history.

People who have been using a term their whole lives might not have any idea where it came from, or that it even has an official definition.


But where does the misunderstanding come from? Where are they getting the fraudster definition from? Do they see threads like this and think “I should be like that guy who has all those people yelling at him that he's wrong,” or is there some reservoir of memetic infection out there where this kind of thing goes unchallenged?


It's right there in the words of the term - it's not an unreasonable guess to think that 'open source' just means that the source code is 'open' in the sense of 'available', especially since proprietary software doesn't normally provide source code.

Compound this by the fact that many people are jumping into this field where English is not their first (or even second) language.


When you open a container, you can see inside of it.

When you open source, you can see the source.


I'm sure some of the misunderstanding comes from the phrase itself, which has a sensible meaning even in a universe where OSI didn't trademark it.


Update: BootOS is open source now!


Update: it's open source now! He's added a BSD license.


You might want to update this one: Mexico City isn't a backwater anymore. Try... somewhere in Afghanistan, maybe, or South Sudan.


Listen, UNAM is one of Latin America's greatest universities, and Mexico City is highly industrialized, but Mexico City is like Milwaukee or Houston or Albuquerque or Buenos Aires, not like Sunnyvale or Boston or Singapore or Shenzhen. If you're a hacker in Mexico City, you're gonna be pretty isolated by comparison to a hacker in a tech hub, and you're swimming against the tide of a corrupt and technically incompetent government in the same way you would be in Houston, a way that you won't be in Sunnyvale or Boston.

I'm well aware that people in Mexico City aren't illiterate paupers. That's not what I was saying, man. But you're going to have a hell of a time launching a new kind of laptop in Mexico City, and that's what they were trying to do.


Stop playing around. Nobody believes your insane story.


Oscar Toledo is very talented to write minimal code, but it does mean either his entire family is a society of wizards or they can build a computer or develop browsers, these "achievements" are urban legends without any proof.

> Unfortunately, they live on the outskirts of Mexico City, not Sunnyvale or Boston, so the public accounts of their achievements have been mostly written by vulgar journalists without even rudimentary knowledge of programming or electronics. It would be a valid reason in '80s


One of the first web browsers in the 90s was written by one dude in four days, with the whole GUI. A browser doesn't necessarily mean CSS and JS.

Sometime in the past couple months, there was a link on HN to a project also by one dude, who's implementing a CPU on breadboards, with wires. (Can probably be found by the score filter from the ‘undocumented features’ of HN: the post got >2000 points.)

Computers aren't necessarily gigantic corporate undertakings.


Also, implementing browsers (or operating systems, or cpus) isn't about needing to write amounts of code that would take a long time write - it's about whether you know the subject area and do you already have a plan/architecture in your head that you are going to create.


>Computers aren't necessarily gigantic corporate undertakings.

I'm not saying it's not possible, there are much stories in HN about guys creating VGA cards or self-made computers, I'm asking for evidence.


I think this code constitutes significant evidence about the background of its author.


> Sometime in the past couple months, there was a link on HN to a project also by one dude, who's implementing a CPU on breadboards, with wires.

Maybe you mean Ben Eater. He has a great Youtube Channel: https://www.youtube.com/channel/UCS0N5baNlQWJCUrhCEo8WlA


Not him, but pretty similar, yes. Here it is: https://news.ycombinator.com/item?id=19393279.

I was mistaken, the CPU is a stock Z80 but the guy implements other parts of a bespoke game console, in microcontrollers.


The Toledo browser Biyubi is claimed to support JS, but I suspect its support may be rather outdated.


Or you could do a two second google search and find photographic evidence: http://www.biyubi.com/tecnologia.html


> Or you could do a two second google search and find photographic evidence: http://www.biyubi.com/tecnologia.html

All of that sounds very interesting, but as edgarvm points out, it's not exactly evidence. Reads more like a product brochure than a research paper detailing how their claims are possible.


Well, if they didn't build their own computers, they certainly went to a lot of trouble to fake up photos of the family members doing electronic prototypes. And I think some of those photos may be older than PhotoShop, so faking them would have been more work than just building a home computer, though validating the photos’ apparent age might require digging up 1980s Mexican computer hobbyist magazines. (There's a convenient list of computer-magazine articles stretching back to 1981 on the Biyubi website; if you're in Mexico, maybe you could try to find them in a library or a used bookstore.)

Also they offer a course in building your own electronics that you can sign up for if you go to their workshop. I can't go to Mexico so I haven't signed up for it; it's at least theoretically possible that the course doesn't really exist and will be canceled if you do sign up for it. But if that doesn't happen you can go there and take the course and see the G11V3 and presumably Fénix and Biyubi in person. I've seen comments in news-website comment threads from people who claim to have done so and claim that it's real, and no comments from people who claim to have done so and then been rejected, so it seems most likely that the course is for real.

Together with Óscar Toledo G.’s amply demonstrated skills at programming under extreme resource constraints, skills which require a great deal of practice to acquire, I think the evidence strongly favors the hypothesis that Fénix, Biyubi, the G11V3, the electronics courses, and the rest of it is real, if maybe a bit oversold.


Many people go to a lot of trouble to perpetrate fraud, look at that guy claiming to have invented bitcoin for example. That is not to say that I believe this site to be fraudulent.

I could not find any information on a course available, could you point me in the right direction? It is a bit odd to me that none of their products are available for purchase from their website (I saw the $99 computer with minimum order of 1000 units but when clicking through I was redirected back to the home page).


http://biyubi.com/educacion.html

I think their G11V3 computer design is pretty out of date now.


I believe most of it, but one thing that's got to be "oversold" is this:

> No defects present, thanks to the constant improvement. http://www.biyubi.com/eng_ventajas.html

> without vulnerabilities http://www.biyubi.com/eng_ciencia.html


Yeah, ......._ (what a strange nickname!), they might have a good-faith belief that the software is bug-free and without security holes, but such a belief is likely mistaken. It's not absolutely guaranteed to be mistaken — earlier in the thread, someone compared BootOS to some Woz code, and as far as I know nobody has ever found a bug in Woz's Apple Integer BASIC — but it's very likely to be mistaken.


Not sure if I'm not catching the joke or everybody here got naive.


I have also developed a very small kernel in 512 bytes, it's a fun exercise [1] (this is a really old project that was uploaded to BitBucket long after it initially started). I quite like this BootOS project, you can of course see the compromises that any OS this size has to make.

I would make a recommendation to the BootOS project which is to squeeze a function table as I have done in order to allow programs to call functions in the kernel. If not, you either end up re-writing these functions for each of your programs, you have to recompile your programs any time you change your kernel or you end up trying to maintain jump positions.

For those still reading, I'm working on a large overhaul of saxos which includes very simple multi-tasking (currently working). The intention will be to have the kernel load a 512 byte GUI on top and then for the programs to have access to a terminal within the GUI. Once that's working I then want to move towards also allowing programs to draw to the Window, but that also brings its own issues.

[1] https://bitbucket.org/danielbarry/saxoperatingsystem/src/mas...


Oh awesome! This one also has a tiny filesystem and prompt, but no UI for typing machine code in, is that right? But the filesystem supports more than one sector per file? Saxos is open-source, unlike BootOS, even if maybe that would be clearer if you used a widely-recognized license.

I don't think BootOS tries to export its filesystem API to user programs. BootBASIC in particular doesn't seem to have a way to save and load programs.

Brilliant work!

(Apparently I heard about this before and never looked at it? Because I have a clone of it on my laptop dating from September 14th.)


> Oh awesome! This one also has a tiny filesystem and prompt, but no UI for typing machine code in, is that right?

Yes, but it offers more to the programs that it loads. There's a trade-off when you go this low on disk space!

> But the filesystem supports more than one sector per file?

SaxOS supports half the disk, but each file has to be 512 bytes [1]. There are potentially work arounds for this limitation of one sector per file, but it's just hacky. (For example, you could name your files txt0, txt1, ... - or you could leave some header information in your program's file for more data.) I will fix this in a future version though, the plan is to keep loading sectors by the same name in the file table.

> Saxos is open-source, unlike BootOS, even if maybe that would be clearer if you used a widely-recognized license.

When I wrote this I had no idea about licenses :) I will look to update this, but the project is mostly just archived for now.

> I don't think BootOS tries to export its filesystem API to user programs. BootBASIC in particular doesn't seem to have a way to save and load programs.

It takes very little to extend the functionality of your kernel to your implementing programs, hopefully BootOS will do this in the future. At some point I want to write a simple self-writing documentation (using the comments structure) so that I can always produce up-to-date documentation for the OS.

> Brilliant work!

Thanks!

I was trying to build a very small low end compression algorithm for it to, but unfortunately I came hard up against entropy. The idea worked (as I envisioned it) but it had the effect of just transforming the dimension the data was stored in and adding unthinkable amounts of computational power and memory being required to get it back.

> (Apparently I heard about this before and never looked at it? Because I have a clone of it on my laptop dating from September 14th.)

Awesome! My plan for quite a while has been to write a small book and guide people through building their own very simple OS. I think people building their own 512 byte boot-able kernel is a nice intro into OSes whilst also having enough limitations that at some point you can say "this is complete". Anyway, it's what I wish had existed when I first set out may years ago!

Speaking of which, I must give a shout out to MikeOS which is where I learned about assembly and OSes [2].

[1] https://bitbucket.org/danielbarry/saxoperatingsystem/src/96c...

[2] http://mikeos.sourceforge.net/


That would be amazing! There's a lot of exciting bootstrapping work going on right now, largely aimed at plugging the Karger–Thompson hole; unfortunately we don't have a viable kernel to compile things on, so while we are close to being safe from Karger–Thompson attacks on GCC, we're still somewhat vulnerable to Linux, and of course Intel. My own interest is largely from other objectives.

I strongly encourage you to stick an explicit license on it if you want people to study it! Otherwise there's the risk of a Numerical Recipes or SCO lawsuit nightmare. (While we were writing this thread, Óscar Toledo G. added a BSD license to BootOS!)

I wonder—and maybe it's presumptuous to offer suggestions like this without working code, so feel free to ignore it—if it might be more flexible to go the BootOS route of including at least some kind of hex or octal† input in the initial boot monitor, and relegate the filesystem to a loadable device driver in a second sector? It would be less convenient for running apps that want to use the firesystem, since you'd need to run two commands instead of one, but it also means those 512 bytes are sufficient by themselves to bootstrap anything else you wanted. With enough work.

…holy shit, you have a scrolling full-screen editor in one sector? This is amazing.

† I like octal because (sorry, rdl) the 8086 instruction set is way easier to read in octal. Also octal input takes less code than hexadecimal input, unless there's something I'm not seeing, or you're willing to count 0123456789jklmno.


I had to look up “Karger-Thompson” to make sure, and came upon this: https://www.teamten.com/lawrence/writings/coding-machines/

Dunno yet how it ends, but I'm just happy that someone writes fiction involving assembly instructions.


> I strongly encourage you to stick an explicit license on it if you want people to study it!

I'm not concerned with lawsuits but allowing people to work with it is a good enough reason to add one.

> (While we were writing this thread, Óscar Toledo G. added a BSD license to BootOS!)

Very cool :)

> t might be more flexible to go the BootOS route of including at least some kind of hex or octal

I think that really depends on the goal of the OS, if it's to be self contained then fair enough, but it kind of limits out of the box usability for a normal user. I think most people would bork at having to type any program they want to use into the terminal each time they boot/test the system.

> …holy shit, you have a scrolling full-screen editor in one sector? This is amazing.

Thanks :) I will at some point improve upon it too, there's definitely some parts that could be better done.

> Also octal input takes less code than hexadecimal input

In terms of amount of code required, I'm not sure. Maybe there is some way to utilize AAA, AAS, DAA or DAS for converting hex to a value with minimal commands. The documentation appears to be quite crappy for these op-codes though, apparently Intel even managed to confuse themselves (which doesn't bode well for their reliable implementation) [1].

The other problem is that re-packing octal input back into raw bytes (for running) will be non-trival, the reason hex is generally used is because it represents a nibble (4 bits) and you can get away with pairs (i.e. OF 3A B7). Octal on the other hand is gonna be messy, you either have 3 octal characters per byte and lose packing density (even more) or you have cases where an octal character contains information for two neighboring bytes.

[1] https://stackoverflow.com/questions/51710279/assembly-instru...


Right, you aren't the one at risk of lawsuits! You shouldn't be concerned!

I didn't mean to leave out firesystem functionality entirely. Clearly you still need a way to load programs from the disk without typing in a bootstrap program!

I agree that octal is less dense. But it's a lot more readable, because operand fields are isolated in a single digit (usually) and not split across digits and mixed with opcode bits.


> I didn't mean to leave out firesystem functionality entirely. Clearly you still need a way to load programs from the disk without typing in a bootstrap program!

In my mind, if you're going to make assumptions such as having a valid file table, making the assumption you have some basic programs ready to be loaded is not too much of a leap?

By the way, once I've got a filesystem up and running that can load in files greater than 512 bytes, it makes sense then to build a very basic assembly compiler. There's a bunch of tricks one could pull in order to make compiling a single parse deal for relatively large files at the sacrifice of efficiency. I think I could quite easily drop support for half of the 8086 instruction set and still end up with something very usable.

> I agree that octal is less dense. But it's a lot more readable, because operand fields are isolated in a single digit (usually) and not split across digits and mixed with opcode bits.

Are you able to give a small example, I'm not sure I follow the thinking? From what I understand, for each octal character you're representing 3 bits of binary. With two characters you have 6, but you're still short 2 bits for a byte.


As for the filesystem, probably I should explain what I mean in assembly rather than English :)

You definitely don't need half of the 8086 instruction set for a usable programming system. 20 instructions and a few addressing modes is plenty. On the rare occasion you need DAA or ROL you can just use a DB. RPN syntax may simplify parsing.

As for octal, yeah, you need three decimal or octal digits to represent a byte, and the most significant digit can only be 0, 1, 2, or in octal, 3. Detailed notes are in http://www.dabo.de/ccc99/www.camp.ccc.de/radio/help.txt


Cool! I didn't knew of your work. I've been working in the service table, just that it isn't ready yet because I want DS to handle filenames and ES the buffer but currently the segment mangling still is destroying the directory. Almost ready ;)


bootOS now has a service table and an example program counter.asm to demonstrate it :)


Awesome! I thought about also using interrupts, how much did it affect timing and code size for you?


Code size suffered because the need to sanitize the ES register to access the directories (PUSH CS + POP ES) but balanced because I made bootOS to call its own services (3-byte CALL is now 2-byte INT) and fortunately IRET is same size as RET. The most difficult thing was to return the carry flag, but the RCL instruction saved me, I'm glad the 8088 processor auto-uses SS when using BP addressing. At some point I was closer to write in paper the segment dependancies along code paths because it's pretty hard to track. Timing I think isn't so important at this moment.


Haha this is one of the reasons I stuck with the simple jump table :) I will have to check whether I have enough space left to implement interrupts though, hopefully because I already do so many internal calls I will save bytes by reducing from a 3 byte call to a 2 byte interrupt.

Thanks for sharing by the way!


The significance of 512 bytes is that it is the standard sector size for a PC storage device (the size seen by software; newer hard drives have 4KB physical sectors, but can still be addressed as if they had 512B "logical" sectors), and a traditional BIOS reads the first sector of the boot device into memory and jumps to it in order to begin the OS part of the boot process. A normal OS bootsector would then find and load the next part of the OS, which may involve things like understanding FAT or NTFS filesystems; here's a (rather enthusiastic) analysis of many boot sectors from different versions of DOS and Windows:

https://thestarman.pcministry.com/asm/mbr/index.html

Writing a tiny program that lets you modify memory, and more importantly execute it, is the first step in the "bootstrap pilgrimage" to creating your own environment and eventually OS, but this one seems deliberately limited; nonetheless, starting with this, one can use it to create the next stage of the bootstrap, 512 bytes at a time.


It seems that this more than a OS is a minimal file system with a obvious limited feature set that relay on the https://en.wikipedia.org/wiki/INT_13H - It assumes that a BIOS that contains a lot more machine code is available.

For the new generations this will seem not to have any real applications beyond code golfing.

But from a nostalgic point of view, it brings me back to the demoscene era. I still fell a wistful longing for the old days thinking to fr-041:debris ( https://www.youtube.com/watch?v=tq2llbP52Zo ) 7:20 minutes of awesomeness in less than 199 Kb.

BTW, I just google it and apparently there is plenty of events going on... Coming very soon: https://www.assembly.org/summer19/


A filesystem, a shell, a program loader, and a hex editor! Well, maybe "editor" is overselling it. But from my point of view, it's as much an "OS" as MS-DOS was. MS-DOS also depended on the ROM BIOS.

I agree that it's probably not practically useful. But it's a brilliant hack!


Yes, BootOS very much in the same space as MS-DOS, although leaning even further on the "less-is-more" axis. It does the same basic things (though I suppose it doesn't do the BASIC thing).

Interestingly, there is modern OS in the same space. That's UEFI. Unti I played with it a few months ago, I thought it was some mysterious firmware-adjacent black-box. But actually it's just an OS, very similar to DOS (though it runs in protected mode).

It has a shell and some basic built-in commands including text editors and such. And most importantly it lets you run executables that a stored on a FAT (well, FAT32) filesystem.

The name BootOS could very well describe UEFI. And equally, a slightly more capable version of BootOS could serve as (very underpowered) UEFI replacement.


> though I suppose it doesn't do the BASIC thing

What's this then?

   bootOS programs: (Oh yes! we have software support)

   fbird         https://github.com/nanochess/fbird
   Pillman       https://github.com/nanochess/pillman
   invaders      https://github.com/nanochess/invaders
   bootBASIC     https://github.com/nanochess/bootBASIC
And one can test the image:

"find a pre-designed disk image along this Git with the name osall.img"


Yeah, PC-DOS was able to invoke the BASIC interpreter included in the IBM PC ROM, but MS-DOS had to rely on GW-BASIC loaded as a separate executable, which might or might not be present. BootOS is the same, except that its BASIC is only 512 bytes and somewhat more limited than GW-BASIC, but astoundingly it is documented to include a full arithmetic precedence parser with parentheses. No string variables or floating point, but still, unbelievable.


The Basic in BootOS has also REPL, line editing of the Basic source and the backspace also works.

Also note the "system" command which returns you to the "shell" of BootOS. It works!


I meant that UEFI doesn't have a BASIC interpreter (though probably someone has written one).

I did not know that bootOS had one, but it does not surprise me given everything else I read on this thread.


> I meant that UEFI doesn't have a BASIC interpreter (though probably someone has written one).

You wrote something else:

> Yes, BootOS very much in the same space as MS-DOS, although leaning even further on the "less-is-more" axis. It does the same basic things (though I suppose it doesn't do the BASIC thing).


Yah, sorry about that. I replied before checking my memory of what I had written.

I thought I caught the error and deleted the erroneous response in time. But I didn't.


Well, bootBASIC isn't included in the boot sector; it's a separate 512-byte program that can be loaded from the boot sector or by BootOS.


I may be confused here, but I don't think UEFI includes a shell — although there's a shell called UEFI-Shell which you can install on your hard disk and run under UEFI — and I think UEFI doesn't have any way to enter machine code from the keyboard. In fact, I think even UEFI-Shell doesn't have any way to enter machine code from the keyboard; is that true? Also, am I mistaken about the status of UEFI-Shell?

So, although I am not planning to switch my laptop to running BootOS, I think there are some significant things BootOS can do that UEFI can't.


For me the nostalgia this brought back was a memory of boot sector viruses, particularly the way the 'format' command propagates itself onto the new disk.


What I am still looking for, is for a boot os that can boot a normal .iso/.img file from its own device. This will be the perfect usb boot stick.

1. Flash boot os on the boot sector, place any iso/img file on the stick.

2. Boot from the stick

3. select the iso you want to boot

Don't know it this is possible though... (I know that there is a emulation mode for virtual cd drives in the bios but thats about it...)


I've seen various software that does this with multiple installer/liveCD ISOs for Linux distributions but none that could actually boot all arbitrary ISOs (Windows installers, DOS rescue disks) which need to be on a logical device partition.

I used to have a 2.5 enclosure that supports this in hardware (Zalman ZM-VE300) but selection of ISO is done on-device before booting. I don't see any reason you couldn't build a hardware/software combo where selection on-screen made the USB hardware mount the selected ISO as a new logical device and then booted it.

[1]: http://www.zalman.com/contents/products/view.html?no=212


You're looking for YUMI: https://www.pendrivelinux.com/yumi-multiboot-usb-creator/

It's not 100% compatible with every ISO, but it's definitely possible to boot more than one thing from a single USB drive.


It is possible with EFI based boot loaders from what I've seen. I was looking for something similar and ended up discovering rEFIt and rEFInd. Although it isn't technically an OS it can autodetect entries from the MBR. http://www.rodsbooks.com/refind/


EasyBCD can give you that, but you must run it to update the boot code each time you add an ISO (ie no dynamic detection).


Pretty cool!


Wow this is really cool. I honestly expected this to be just a program that would boot to some text output and maybe a very simple shell, but it looks like this more than that.


BootOS developed by a 10x Rockstar Ninja google dev! Oh no, wait...it's a mexican who works with his family at "Familia Toledo"... Guys, i think perhaps we got it all wrong.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: