Now that the os has a keyboard driver it is possible to


Systems Programming Assignment

Task 1

Now that the OS has a keyboard driver, it is possible to produce a simple command processor. You should expand the Run() method in command.c to produce a simple command processor that implements the following commands:

cls- Clear the screen.

exit- Shutdown the operating system (for now it should just output a message stating that the operating system is shutting down and then return from the Run() method).

prompt- Change the prompt output by the command processor. It should take one argument - the

new prompt. For example:

Prompt Hello>

should set the set the prompt to be 'Hello>' (the default prompt should be 'Command>'

Use the function KeyboardGetCharacter() in keyboard.c to retrieve the key code for a character (keyboard.h contains a list of the key codes). The routine KeyboardConvertKeyToASCII() will also be useful to you. You will need to write routines to read a string from the keyboard and then act on that string. When writing the routine to read a string from the keyboard, do not forget about handling backspace correctly.

Task 2

Exercise 1. Add a command 'readdisk' to your command processor that displays the contents of sector 0 of the disk to the screen. You should display the contents of each byte in the sector as hexadecimal value. Because the contents of the first bytes might scroll off the screen, you may need to implement some sort of paging mechanism, i.e. display 16 or 32 bytes at a time and then wait for the user to press a key before displaying the next 16 or 32 bytes and so on,

Use the function FloppyDriveReadSector to read the contents of the specified sector.

Exercise 2. Extend your solution to exercise 1 to enable you to specify which sector to read, e.g. implement 'readdisk n' where n is a sector number.

Exercise 3. Add some command-line options to your solution to exercise 2 to control how the data is displayed. For example, you might implement '/c' to display as characters, '/d' to display as decimal values, etc.

Task 3

So far, we have been adding all our code to our kernel, but we are getting to the point where we need to start to separate out the kernel from other parts of the operating system. This means that we need to be able to load other components from the disk, as well as being able to load user applications.

Now we need code to read and navigate the file system. There are two parts to this task:

a) Implement routines to open, read and close files using the FAT 12 file system.

b) Implement some basic utilities to navigate around a disk formatted using the FAT 12 file system.

Part A

A commercial operating system will usually support multiple file systems and multiple devices. However, for UODos, you only need to support the boot device that is formatted using the FAT12 file system (i.e. the. Img file you have been using so far).Of course, in a real operating system, you would also need to implement routines to write to the disk. However, since we are only interested in loading files at this stage, we will ignore the functionality needed to write to the disk.

Full details of the functions you need to write are provided in Appendix 1.

Part B

When you have implemented Part A, you need to implement the following utility commands that will use the functions from Part A and demonstrate that your implementation of Part A works. These should all be implemented as part of the command processor you have been working on Task 1 and 2.

READ filename

This function should read a text file from disk and display the contents of the file on the screen. You must be able to specify a normal DOS-style file path for the filename, including sub-directories, e.g.

READ \subdir\testdoc.txt

would display the contents of testdoc.txt that resides in the sub-directory subdir.

CD dir

Change to a particular directory on the disk image and make it the current directory for future disk operations. The CD command should accept any valid path, including . and ..

PWD

Display the current directory (as navigated to using CD). If the current directory is the root directory, then PWD should just display '\'.

DIR

Display the names of all of the files and directories in the current directory.

Testing

With your submission, you should submit a document in .doc, .docx or .pdf format that details the testing that you have done on your solutions to Parts A and B. You should clearly state your rationale behind the approach you have taken to your testing. In particular, if part of your submission is not completely functional, you should detail the problems you have encountered and the progress you have made towards solving them.

In order to test your submission, you will need to write test files to the disk image. A batch file (copytestfiles.bat) has been provided to you that will mount and unmount the disk image. You can edit this file to copy test files to the disk image.

Attachment:- Assignment.rar

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Now that the os has a keyboard driver it is possible to
Reference No:- TGS01707217

Expected delivery within 24 Hours