The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Wednesday, November 19, 2008

Operating Systems from the Fringe

Looks like writing your own operating system isn't something that's done much nowadays (last time I mentioned a homebrew operating system was back on May 23rd, 2001) but that's not to mean the art has completely died out.

It's just mostly dead.

And a lot of these homebrew operating systems aren't much to look at or even write about (and I think I gave VS_OS more virtual ink than it really deserved, for instance), but I just came across the LoseThos IBM PC Operating System and I must say, I'm seriously impressed—a homebrew operating system written in a dialect of C (more on that in a bit) for the 64bit Intel Pentium machines. Okay, so the GUI looks like something cooked up in 1985, and the hardware support is, shall we say, limited.

I can't even say the concept is truly original. The implementation language, C+ (a bit more than C, less than C++) is also the command line. This isn't unique, heck the Symbolics machine used Lisp for the operating system as well as the command line, as well as many Forth based machines, and Smalltalk based machines.

But what is unique, it seems, is the use of a C-like language for the shell (really! That design decision really floored me). C+ is basically C with a few syntactic changes—basically, functions can have default parameters (which comes from C++), and for a function call without any parameters, the parentheses can be dropped entirely (so instead of writing something like x = foo(); you can write x = foo;).

But the shell isn't just a C+ interpreter. Nope, it's an incremental C+ compiler! Expressions typed at the command line are compiled and immediately executed. You can even define C+ functions at the command line (which I think then becomes part of the execution environment of the shell). You can also get a disassembly of any called function (or compiled function or expression) with a simple command (currently it's CTrace(ON);—I would have called it TRON myself). So for example, in one of the demo videos, you can see a pointer being defined, memory allocated and assigned to the pointer:

D:/LT/Accts/TAD>#include "DoIt";
ans0=0x0000000000000090=144
D:/LT/Accts/TAD>I1 *buf;
ans0=0x0000000000000090=144
D:/LT/Accts/TAD>buf=MAlloc(256);
ans0=0x0000000076A54990=1990543760
D:/LT/Accts/TAD>LtfD(buf,256);
00000000 20 64 69 73 70 6C 61 79 20 61 20 6E 75 6D 20 6F  display a num o
00000010 66 20 6C 69 6E 65 73 20 77 69 74 68 69 6E 20 61 f lines within a
00000020 20 72 61 6E 67 65 20 6F 66 20 61 6C 6C 20 6D 61  range of all ma
00000030 74 63 68 65 73 2E 20 20 44 6F 69 6E 67 20 74 68 tches.  Doing th
00000040 69 73 20 74 77 69 63 65 20 77 69 6C 6C 20 63 72 is twice will cr
00000050 65 61 74 65 20 61 6E 20 00 59 E5 F1 AA 31 0B 00 eate an .Y...1..
00000060 80 00 00 00 00 00 00 00 80 BB 76 76 2E 2E 2E 2E  ....... .vv....
00000070 70 75 62 6C 69 63 20 4C 54 65 78 74 65 72 6E 20 public LTextern 
00000080 43 50 5F 44 45 4C 45 54 45 5F 53 59 53 5F 48 41 CP_DELETE_SYS_HA
00000090 53 48 5F 45 4E 54 52 59 20 42 6F 6F 6C 49 38 20 SH_ENTRY BoolI8 
000000A0 44 65 6C 53 79 73 48 61 73 68 45 6E 74 72 79 28 DelSysHashEntry(
000000B0 53 79 73 48 61 73 68 45 6E 74 72 79 20 2A 74 65 SysHashEntry *te
000000C0 6D 70 68 2C 53 79 73 48 61 73 68 54 61 62 6C 65 mph,SysHashTable
000000D0 20 2A 74 61 62 6C 65 29 3B 00 29 3B 00 3B 00 00  *table);.);.;..
000000E0 80 00 00 00 00 00 00 00 70 F2 76 76 00 00 00 00  .......p.vv....
000000F0 20 20 77 68 69 6C 65 20 28 63 6C 21 3D 6C 20 26   while (cl!=l &
ans0=0x0000000000000001=1;
D:/LT/Accts/TAD>CTrace(ON);
ans0=0x0000000000000000=0
D:/LT/Accts/TAD>

Then, MemSet() is called, and not only is the code for MemSet() shown, but the data dump already on screen changes to reflect the changes!

D:/LT/Accts/TAD>#include "DoIt";
ans0=0x0000000000000090=144
D:/LT/Accts/TAD>I1 *buf;
ans0=0x0000000000000090=144
D:/LT/Accts/TAD>buf=MAlloc(256);
ans0=0x0000000076A54990=1990543760
D:/LT/Accts/TAD>LtfD(buf,256);
00000000 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000010 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000020 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000030 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000040 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000050 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000060 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000070 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000080 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
00000090 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
000000A0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
000000B0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
000000C0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
000000D0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
000000E0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
000000F0 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88 88
ans0=0x0000000000000001=1;
D:/LT/Accts/TAD>CTrace(ON);
ans0=0x0000000000000000=0
D:/LT/Accts/TAD>MemSet(buf,0x88,256);
	 RD,5C90 41B800010000 MOV	U4 R8u4,U4 00000100
	 RD,5C96 4D63C0	      MOVSXD	U8 R8,U4 R8u4
	 RD,5C99 4D33C9       XOR	U8 R9,U8 R9
	 RD,5C9C 418188	      MOV	U1 R9u1,U1 88
	 RD,5C9F 488B05BEBFFF MOV	U8 RAX,U8 [76A7F9E4]
	 RD,5CA5 FF
	 RD,5CA6 498BD1       MOV	U8 RDX,U8 R9
	 RD,5CA9 498BC8	      MOV	U8 RCX,U8 R8
	 RD,5CAC 57	      PUSH	U4 EDI
	 RD,5CAD 488BF8       MOV	U8 RDI,U8 RAX
	 RD,5CB0 488BC2       MOV	U8 RAX,U8 RDX
	 RD,5CB3 F3AA	      REP_STOSB
	 RD,5CB5 5F	      POP	U4 EDI
	 RD,5CB6 C3	      RET
ans0=0x0000000000000088=136
D:/LT/Accts/TAD>

Oh my! It's mentioned rather casually in the video that the hex dump shown on the screen is actually a hex dump widget, and the demo continues to show editing of values being done in said widget. I think that's the first GUI widget I've seen that scrolls along in a text window.

Later on in the video demonstration, code is being edited in a text editor, but this is the first text editor that I've seen where one can embed not only graphical images, but said images become part of the source code and can even be referenced in code. Not only that, but you can even edit the graphical image in the text editor.

Thinking back on this, this again isn't anything all that new. Heck, Microsoft developed and later dropped an entire technology based upon this, OLE. But, not having ever used OLE, I can't say if Microsoft's implementation was as seamless as this appears to be.

But this whole thing is even more impressive when you realize this is the work of a single programmer, playing around in his spare time writing this crazy operating system. But to me, the operating system is less impressive than the whole crazy user interface being used (since the video is a bit hard to follow, and it's obvious that the demoer (who is also the programmer) knows his system back and forth and oftentimes doesn't even explain fully what he's doing or even what's fully going on).

Even though I don't fully agree with all his design choices for an operating system (for example, everything runs in the kernel) he's done an impressive job, and some of the choices he's made in the design are worth looking at in more detail.

Just wow.


I should know better than this …

Why?

Why oh why did the PHP programmers even bother with the link option? That is the singularly most useless option on a program I've ever seen. Would it really have killed you to include a line number?

Sigh.

Obligatory Picture

[It's the most wonderful time of the year!]

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: http://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

http://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2019 by Sean Conner. All Rights Reserved.