Operating System Design :: Projects :: Operating System
The files for this project are in the projects directory under 12 when you downloaded the class software.
You will need two tools: the Jack programming language and the supplied VM Emulator utility (available in your tools directory) for testing your operating system. The Jack OS error codes will also be helpful.
The OS is implemented as a collection of 8 Jack classes. Each class can be implemented and unit-tested in isolation, and in any desired order. To develop, compile, and test each OSClass.jack class in isolation, follow this procedure:
- Put the OSClass.jack that you are developing in the same directory that includes the supplied test program designed to test it;
- Compile the directory using the supplied Jack compiler. This will result in compiling your OSClass.jack as well as the supplied test class files. In the process, a new OSClass.vm file will be created;
- Load the directory into the supplied VM Emulator;
- Execute the code and check if the OS services are working properly, according to the guidelines given below.
Recall that the supplied VM Emulator features a built-in implementation of the entire Jack OS. With that in mind, the rationale of the above procedure is as follows. Normally, when the supplied VM Emulator encounters a call to an OS function, it fields the call by invoking a built-in implementation of that function. However, if the compiled directory contains a .VM file that includes a VM implementation of the function, this implementation will be executed, short-cutting the built-in implementation. This practice follows the reverse engineering spirit of GNU Unix and Linux: it allows you to build and test different OS modules in isolation, as if all the other OS modules are implemented properly and operating side-by-side with the currently-developed module. That's important, since the OS class that you are presently developing may well include calls to the services of other OS classes.
The Jack OS comprises eight classes: Memory, Array, Math, String, Screen, Keyboard and Sys. Each OS class named Xxx should be implemented in a Jack file named Xxx.jack. For each one of the eight class implementations, we supply a skeletal Xxx.jack class file with all the required subroutine signatures. In addition, we supply a set of test files designed to test this particular OS class implementation.
After testing successfully each OS class in isolation, test your entire OS implementation using the Pong game, whose source code is available in your projects/11/Pong directory. Put all your OS .jack files in this directory, compile it, and execute the game in the supplied VM Emulator. If the game works, then congratulations: you are the proud owner of an operating system written entirely by you. And, by the way, you've just completed the construction of a complete, general-purpose, computer system. Go celebrate!