[HN Gopher] KnightOS was an interesting operating system ___________________________________________________________________ KnightOS was an interesting operating system Author : akalin Score : 227 points Date : 2020-01-27 23:47 UTC (23 hours ago) (HTM) web link (drewdevault.com) (TXT) w3m dump (drewdevault.com) | geek_at wrote: | At first I confused it with Temple OS. That was also very | interesting but maybe less useful | SirLotsaLocks wrote: | honestly impressive, but yeah not very useful. | coolreader18 wrote: | Relevant: Ndless[1], a jailbreak for TI-Nspire calculators | (Nspire {CX ,}{CAS,}). I've played around with the source code[2] | as well as compiling Rust[3], Nim[4], and Zig[5] to target it. | It's all pretty neat, there's a gba emulator for the TI-Nspire | floating around somewhere as well. | | [1]: https://ndless.me | | [2]: https://github.com/ndless-nspire/Ndless | | [3]: https://github.com/coolreader18/rsspire | | [4]: https://github.com/coolreader18/Nim/tree/tinspire | | [5]: https://github.com/coolreader18/zigspire | unlimitedbacon wrote: | When I was in high school, I always wanted to build a better OS | for the TI-84, but I did not have the skills or attention span to | do it on my own. When KnightOS came along, I got involved and was | able to take on individual features or issues as bite size | chunks. I was able to make real contributions to a project that | resonated with me on a fundamental level. In the process, I | learned z80 assembly, how OSs work, but also most importantly how | to contribute to a real open source project. | | Thanks, Drew. | ddevault wrote: | Hey, I remember you :) thanks for all of your help back in the | day. I was just thinking to myself earlier that your | improvements to the file manager added a lot of much needed | polish. | cjbprime wrote: | Neat. Would be interested to see a quick video/GIF tour. | ddevault wrote: | Here you are: | | https://yukari.sr.ht/knightos.webm | mintplant wrote: | What's yukari.sr.ht? Personal file dump? | ddevault wrote: | Aye. It has a sr.ht subdomain for historical reasons, but | it's a personal server. | dmix wrote: | > In fact, the "userspace" task switching GUI would read the | kernel's process table directly to make a list of running | programs. | | This is great. A perfect learning project is trying to build | something yourself, then learning how other developers solved the | problems or larger OSes handle it (or working backwards from that | point and simplifying). | | I noticed some "#ifdef FLASH4MB" in the linked source code, was | it difficult to update it for 4mb or were similar constraints in | place where it was basically the same with more memory? | cesarb wrote: | Interestingly, "read the kernel's process table directly to | make a list of running programs" is exactly how the "ps" | command worked in the distant past. It's a bit hard to find | information about this nowadays, but I could find a couple of | SE answers (https://unix.stackexchange.com/a/340893 and | https://unix.stackexchange.com/a/511530) which mention this | fact. | ddevault wrote: | Nah, it was reasonably easy. The main issue with 4MB calcs is | that it used a secondary hardware port to add two extra bits to | the page address. Until then we were able to page with only one | port, so everywhere was hardcoded to use it. We had to replace | all of that with a marcro, and update a few places manually. | There's a comment in that code which speaks to this: | ; we can't use getBankA because it behaves differently on the | 84+CSE, and we don't want that | | getBankA was the name of the macro we used to interrogate which | Flash page was swapped into bank A (address space | 0x4000-0x7FFF). | | The real pain with that port was the new color screen. | papito wrote: | Obstacles and difficulty make us better at things. Lack of | obstacles makes us complacent. This is a known phenomenon. | | https://www.ted.com/talks/tim_harford_how_frustration_can_ma... | kragen wrote: | KnightOS is a system I've been wanting to try for years, although | I don't have the hardware for it. It's an admirable achievement. | | How hard would it be to get KnightOS to be able to self-host? | Something like an 8080 or Z80 is probably the wimpiest processor | that it makes sense to try to build a self-hosted development | environment on; although there were compilers that could run on | the PDP-8 (address space: 4096 12-bit words), John Cowan tells me | that in practice people did most software development for the -8 | on bigger machines like a PDP-10. | | CP/Mish is the other free-software operating system for the Z80 | (and also runs on the 8080), but it's pretty far from self- | hosting. There's a free-software C compiler for CP/M which can | run under CP/Mish (BDS C) but its dialect of C is not the one | CP/Mish is written in. | | A really small bootstrapping environment like this could go a | long way to making computers comprehensible and making the | Karger-Thompson attack infeasible. | ddevault wrote: | Last time I checked, the source code can't even fit on the | calculator's Flash chip. | Koshkin wrote: | There goes my day. | zozbot234 wrote: | With no MMU or hardware supervisor mode, this would be more of a | simple task executor than an OS in any reasonably-modern sense. | Still impressive though. | dTal wrote: | Also interesting: PunixOS, a sadly-dead project to port 4.4BSD to | Motorola 68k calculators like the TI-89. Not just a Unix-alike, | but a Real Unix (tm), with pre-emptive multitasking and | everything. | | http://punix-os.blogspot.com/ | fsiefken wrote: | interesting, seems similar to fuzix http://www.fuzix.org/ | cr0sh wrote: | I was about to post about the TI-92+ not getting any love, saw | this, got happy, then saw it dead...sad again. Oh well. :) | msla wrote: | > Not just a Unix-alike, but a Real Unix (tm), | | Not unless they paid The Open Group to use the very real Unix | trademark. | | There's a part of zOS that's Real Unix (tm) and FreeBSD is not, | so can we give it a rest? | boring_twenties wrote: | No one gives a shit about the Open Group's trademark. | Seriously. | | 4.4BSD (unlike FreeBSD, or 4.4BSD-Lite(2)) contains | proprietary code from AT&T Unix, therefore it's Unix in most | people's eyes. | msla wrote: | > 4.4BSD (unlike FreeBSD, or 4.4BSD-Lite(2)) contains | proprietary code from AT&T Unix | | Only three files had to be removed. | | https://en.wikipedia.org/wiki/UNIX_System_Laboratories,_Inc | ..... | kick wrote: | FreeBSD and 4.4 BSD are not the same thing. You seem bitter. | Why are you bitter about something like that? | msla wrote: | FreeBSD is the modern 4.4BSD descendant. | dang wrote: | Can you email hn@ycombinator.com so we can send you an invite | to post that? Invited posts go into in the second-chance pool | (described at https://news.ycombinator.com/item?id=11662380). | jacobush wrote: | Also, Lunix (C64) | sixothree wrote: | I feel like constraints are where developers get to shine. On a | system with (relative) unlimited resources, many developers seem | to be able to complete the same tasks. But when there is scale | involved or some constraint (like 4 mb of storage) you get to | find out who is willing to learn what they need to learn to get | the job done. | reaperducer wrote: | _I feel like constraints are where developers get to shine._ | | Absolutely. And I think that's one of the ways you can tell | that there is an art to programming. It's not just pushing | buttons in the right order. (Something my boss doesn't | understand because she took a computer class in high school and | thinks she can do my job. "I know code.") | | Computer science is a thing. Programming is a thing. They're | not the same thing. And as we get into more abstractions, I | feel like the programming side is becoming more an art form | than the science it is presumed to be. | dec0dedab0de wrote: | I always liked how rms says that programming is a craft. | 0x445442 wrote: | > Computer science is a thing. Programming is a thing. | | Engineering is also a thing but that's vanishing too. | 1-6 wrote: | Google Sheets is my constraint. Utilities.sleep() | thedanbob wrote: | My day job is web development but I love hacking on | microcontrollers in my spare time. One project involved serving | a static webpage from an ESP-8266. But how do you server an | HTML file without a filesystem? There's probably a better way, | but my solution was to gzip the file and embed it as an array | of raw bytes within the program. | Koshkin wrote: | As far as program resources go, on DOS, at least, it used to | be possible to simply append a file to the executable, and | the loader would put everything in RAM. (On the other hand, | you do not need a generic web server to serve a single static | page; then you don't need a file system to store one file.) | ronsor wrote: | You can do that with most executable formats: MZ/NE/PE | (DOS, Windows), ELF (Linux, BSD). Not sure about mach-o | (macOS) though. | emily-c wrote: | This is still pretty common for things like self extracting | archives on Windows. copy /b | "%windir%\system32\extrac32.exe"+inputarchive.cab | selfextract.exe | wolf550e wrote: | Do you mean like Apache mod_asis [0] which will serve a pre- | formatted HTTP response, including the headers, directly from | disk? | | Then your HTTP server can speak very little HTTP (compare | request line to preformatted "GET /file HTTP/", return 404 on | mismatch, return preformtted response on match). Maybe also | return nice error if request does not have accept-encoding: | gzip. | | 0 - https://httpd.apache.org/docs/2.4/mod/mod_asis.html | GTP wrote: | ESP8266 has basic filesystem support, have a look at this: | https://arduino- | esp8266.readthedocs.io/en/latest/filesystem..... You define | the filesystem's size when you flash the ESP and there's a | tool to upload files there. You should also be able to find | example projects that serve a webpage read from SPIFFS. Edit: | this is a fake AP for esp8266 that I wrote some time ago that | has a captive portal that loads pages from SPIFFS if they're | there, otherwise sends some default pages directly from code | https://github.com/GTP95/CaptivePortalMatematico?files=1 | thedanbob wrote: | Cool! I ended up switching to a raspberry pi for that | particular project but I'll keep that in mind. | deckard1 wrote: | https://github.com/me-no-dev/ESPAsyncWebServer#respond- | with-... | | That whole ESPAsyncWebServer github project has a lot of | great examples on ways to use the esp8266. | | Also, if you want to connect to your esp8266 externally, you | can setup nginx (maybe on a raspberry pi?) as a reverse proxy | with TLS enabled: https://jjssoftware.github.io/secure-your- | esp8266/. Probably a bit pointless if you only have one | esp8266 to connect to, since the RPi could probably do it | all. But if you have multiple IoT devices to connect to, | might be worth it. | invalidOrTaken wrote: | The nice thing about constraints is that they know what they | want. | quotemstr wrote: | That's a very pithy way of putting it | jlg23 wrote: | It's the litmus test: How much of taught abstractions do you | really understand (can you adhere to the underlying coding | practice without spelling it out in (costly) code? Do you | really understand a runtime environment and can you make your | basic tool, the compiler, optimize for your use-case? | | Back then, when I was young and stupid, I agreed to develop a | Command & Conquer like game in j2me with a deliverable size of | max 120k. I did, but that required lot of all-nighters and a | severely bruised and corrected ego.. | | And, as the senior dev, I got to listen to very smart recently | graduated devs who did not know shit (as I did when I started). | Best management lesson ever... | Someone wrote: | As Goethe wrote: _"In der Beschrankung zeigt sich erst der | Meister"_ ("the master shows himself through self-limitation"). | | One can see this as a form of constrained writing | (https://en.wikipedia.org/wiki/Constrained_writing) | | Demos (https://en.wikipedia.org/wiki/Demoscene) and The | submissions to the International Obfuscated C Code Contest | (http://ioccc.org/) also are examples of this. | SkyMarshal wrote: | There are a bunch of styles of X-Driven-Development, and I | honestly think we should add the notion of Constraint-Driven- | Development as a first-class citizen to that mix. CDD. | | Start by specifying the constraints, including hardware, | software, formal specification, and business rules. Put them | all into a Constraints Document. Then tell the engineering and | design teams to work together to make the coolest, most | creative product they can, without violating the specified | constraints. Use Agile, rapid-iteration methodologies if you | like, within that framework. | | Then evaluate the outcome, and decide whether to iterate by | updating the constraints document and repeating the process. Or | maybe you're happy with v1.0 and no iteration necessary. | | Constraints drive both innovation and quality. I wonder if the | process can be viably formalized in such a manner. ___________________________________________________________________ (page generated 2020-01-28 23:00 UTC)