Project 11 | ||
In this part of the course you will have to read chapter 11 of the book (The Operating System), after reading the chapter you will have to read the following instructions to be able to implement project 11. Sack is a simple operating system, similar to early versions of DOS. Instructions: Objectives: Develop the Sack “kernel”, which includes key parts of its Memory, Math, Screen, Array, String, and System libraries. The contract: Implement (in the Jack programming language) the level-0, level-1, and level-2 services of the operating system libraries, as defined in the Sack OS API (Section 11.2). Test your OS implementation by compiling and running the test programs supplied below. Guidelines The source code of the Sack operating system is written in Jack (just like Unix is written in C). The executable OS is a collection of .vm files (just like Windows is a collection of .exe and .dll files). The OS routines are implemented as VM functions, stored in these files. One of these functions is Sys.init(), stored in Sys.vm. In a similar fashion, a Jack application is also a collection of .vm files (just like Word is a collection of .exe and .dll files). One of these files must be Main.vm., and this file must contain a VM function called Main.main. This function is invoked automatically by Sys.int() when the computer is reset. Thus, a natural way to test a newly developed OS routine is to compile and execute an application that uses this routine. For example, to test the OS's multiplication method, we can write a Jack program that includes commands like "let b=5; let x=b*12;". If the OS is implemented properly, this code should put the number 60 in the memory location that was allocated for x. Hence, to complete the testing, we can compile both the OS and the application, run the resulting (overall) code, and inspect the memory. Incremental testing: The following strategy can help you manage your tests. Recall that an executable version of the OS is already available in the book software suite. This OS is a collection of several VM files, one for each OS library (e.g. Memory.vm, Screen.vm, etc., each being the compiled version of corresponding Memory.jack, Screen.jack, etc. classes -- these are the classes that you have to develop and test in this project). Now, in each part of the present project you have to develop routines in one of these libraries. For example, let us assume that you are now working on the Memory.jack class. To help "localize" your testing, you can put all the supplied OS .vm files in your working directory, and then replace the supplied Memory.vm file with your own version of this library, i.e. the Memory.vm file that you obtained by compiling your version of Memory.jack. This strategy makes sense, since the test programs that we supply below call other OS routines that you have not yet developed, and if these routines will not be present in the working directory you will get run-time errors. Implementing the OS level-0 and level-1 services This part of the project deals with implementing all the OS routines labeled as level-0 and level-1 in the Sack OS API (Section 11.2). The test program consists of three classes:
Guidelines: Implement all the level-0 and level-1 routines of the operating system. Use the Jack compiler to compile your OS .jack files. The result will be a set of “OS .vm files.” Compile the supplied test program (3 classes above). The result will be a set of “application .vm files.” Put both sets of .vm files in the same directory. Use the VM Emulator to execute the resulting code. Important: before you do so, disable the emulator's animation. If the OS was implemented correctly, RAM locations 10000…100011 should contain the following values memory dump.txt
Implementing the OS level-2 services This part of the project deals with implementing all the OS routines labeled as level-0 and level-1 in the Sack OS API (Section 11.2). The test program is a simple game consisting of three classes:
Guidelines: Same as in “Implementing the OS level-0 and level-1” section. If the OS was implemented correctly, a square should appear on the screen, as follows: The user should then be able to control the square movement by pressing the following keyboard keys:
To control the animation speed, you can change the delay constant in the moveSquare method in SquareGame class. Resources
|
||