====== Forward Into The Past ====== Over the last three months, I have built, installed, cajoled, and crowbarred a pile of junk hardware in my office into a PC capable of running Jnode, a 0.2.x revision all-Java operating system, as its native OS. The time has come to put my new Jnode PC to work*. * Work: (v.) Playing games in an emulator. ===== Getting From 0 to 1 ===== After power-up, and the inescapable BIOS, our first stop is the **GR**and **U**nified **B**ootloader, known as GRUB((GRUB: [[http://www.gnu.org/software/grub/grub.html]])). GRUB's mission is to find out what operating system you want, and start it. GRUB comes with a nice, clean menu system, but I wanted more for my new Jnode PC. I wanted eye-candy. Why not show the GRUB logo? I contributed the story((GRUB Splash Image How-(Not)-To For My Jnode PC: [[http://www.jnode.org/node/2357]])) and steps to build that image, and the splash-enabled GRUB to show it, to the Jnode((Java New Operating System Development Effort (Jnode): [[http://Jnode.org]])) community site. The first entry of my GRUB menu is simply the OS, version, and build time: Jnode 0.2.6.3821 compiled 2008/02/29. Drop one line and press enter to start Jnode with its full set of plugins. ^ GRUB with Splash Screen Ready To Boot Jnode Full ^ | {{user:robert_murphey:dscn0133.jpg?320|Click to enlarge}} | ===== The Shell ===== The interesting thing about Jnode is this: Jnode is a 99.999+% pure Java operating system. GRUB loads the Jnode kernel which contains a tiny x86 "nano-kernel" (to connect Jnode to the bare metal) and Jnode's Java(tm) Virtual Machine. You read it correctly, from BIOS, to bootloader, to JVM, without an intervening general-purpose operating system. Once the Jnode VM starts, it begins loading Java versions of the kinds of software you expect your OS to provide, such as hardware drivers, filesystem modules, and networking stacks. With Jnode, all of those pieces are written in Java. Here you can see the end of the boot process where Jnode has found my hard drive and CDROM, mounted the EXT2 filesystem on the drive, brought up the loopback interface for networking, and started some pseudo-filesystems in RAM. Total boot time from GRUB to ready-to-work is 34 seconds, for the full plugin set, on a Pentium III 550MHz (Katmai). The last line is the Jnode Shell prompt: JNode /> _ Jnode is ready to work. ^ Booted Into The Jnode Shell ^ | {{user:robert_murphey:dscn0136.jpg?320|Click to enlarge}} | ===== Where Did I Leave That Work? ===== For those old enough to remember 16-bit PC operating systems, Jnode's work environment feels a lot like that. You have a capable command-line interface to run more than 100 command line tools, all written in Java, which are loaded as plugins to the Shell and operating system. In Jnode, everything except the nano-kernel and the JVM itself comes as a plugin. Jnode's command line interface comes with a ton of features, including the ability to hit TAB at any point within a command line to see what the next argument should be. Jnode's shell takes you one step deeper than any other shell I have seen. Not sure what the fourth thing to type in the command was? Press a dash and hit the TAB key, and Jnode commands will tell you what they expect next. Jnode's shell includes path completion and history like any modern shell would. I want to do something useful with my Jnode PC, so why not a game of Spacewar?(([[wp>Spacewar%21]])) The folks at OverSigma.com ((OverSigma.com: [[http://space.oversigma.com/readme.html]])) provide complete Spacewar kit in the sources directory: PDP1 assembly source code, a PERL macro assembler and tape converter, a Java PDP1b emulator (which works standalone or as an applet, yeah!), and even the user docs to tell you how to play. Kudos! Yes, I think that I will start with that. It took some fiddling (convert text files to UNIX source, fix paths to perl interpreter in scripts) but I was able to build Spacewar from PDP1 source on my dev box. I saved the steps in a build.sh script, and you can see the full work directory in all of its command line glory. ^ Jnode Shell Lists My Spacewar Build Directory ^ | {{user:robert_murphey:dscn0137.jpg?320|Click to enlarge}} | ===== Going Graphical ===== Even though it was written in 1961, Spacewar is a **video** game. In fact, its one of the earliest video games, ever, perhaps among the first three. This means our command line interface just cannot do this job. I need to step out of one-dimensional command line land, and into two-dimensional flatland. I need a desktop graphical interface, and Jnode has one. I have two choices, start a graphical program, which causes Jnode to launch the desktop first, or I can launch the desktop on its own, and go from there. JNode /devices/hda0/Java/PDP1B-Spacewar> **startawt** When I finally figured out how to boot Jnode on live hardware((Success! Jnode 0.2.5 Booting from Harddisk and EXT2: [[http://www.jnode.org/node/2350]])), the first thing I tried was the graphical desktop. The default desktop image shows M.C. Escher's famous 1948 illustration //Drawing Hands//((M.C. Escher at Wikipedia: [[wp>M._C._Escher]])). I liked that quite bit, until I ran across a cartoon of Duke((Duke: [[https://duke.dev.java.net/]])), the Java Mascot, that instantly made me think it should be my desktop background. With GIMP((GNU Image Manipulation Program (GIMP): [[http://www.gimp.org/]])), I eventually constructed((New desktop background, "Time To Hack JNode": [[http://www.jnode.org/node/2379]])) my new desktop background. Once the desktop is up, Start -> Tools -> Console will get me a Jnode Shell within the desktop. ^ The Jnode Desktop ^ | {{user:robert_murphey:dscn0138.jpg?320|Click to enlarge}} | ===== 3-2-1 Launch ===== Once the console starts, I find I am still in the directory I started the Desktop from. I could build a menu item to launch Spacewar directly from the Start tool, but I tend not to use the Start tool in these graphical desktops. Jnode is an operating system built on a Java Virtual Machine. Naturally, Jnode lets you run Java class files as the native executable format. Jnode also includes an editor and the full suite of Java development tools, such as the compiler to turn your source into runnable class files. I like an operating system that comes with its source code, a programming language, and the tools you need to develop it. But first, how about a game of Spacewar? JNode /devices/hda0/Java/PDP1B-SpaceWar> **java pdp1b** ^ Ready For Liftoff ^ | {{user:robert_murphey:dscn0142.jpg?320|Click to enlarge}} | ===== Facing Off ===== Spacewar pits two players in torpedo-armed spaceships again each other, and the forces of nature, simultaneously. Rendered against a real star map (check the source for the real stellar names and positions) the central star's gravity relentless tries to haul you in while a friend tries to do you in. First orders to the loyal crew of the U.S.S.S. Phlogiston? Hard to starboard! Have to "turn and burn" to avoid a fall straight into that star! Then, we deal with a traitorous scum! ^ The Battle Begins ^ Hard To Starboard! ^ | {{user:robert_murphey:dscn0146.jpg?320|Click to enlarge}} | {{user:robert_murphey:dscn0148.jpg?320|Click to enlarge}} | ===== Closing Thoughts ===== Once you get your hands on the controls, it becomes clear why this classic endures, even after 47 years, while most modern games disappear in a year. For me, Spacewar now also holds the honor of the first game installed and running on my Jnode desktop PC. I do not know quite how to express the feeling of compiling and running an operating system from a current daily snapshot, to run an emulator, to play game more than a decade older than myself which I compiled from source as well. ===== About Me ===== Yes, this //is// the sort of thing I do for fun. ^ Robert, At The Altar Of Madness ^ | {{user:robert_murphey:dscn0039.jpg?320|Click to enlarge}} | ~~DISCUSSION~~