Operating Systems Homework #01 CPU Emulation and Simple OS Solution




  1. Download and Install Vmware Player from official site.


  1. Download and install our virtual machine from https://drive.google.com/open?id=1YppX3lNkyTsHV_lvA4w9TomNCUkpLeEg
  2. Carefully examine 8080 cookbook and instruction set.


  1. Use the assembler at http://sensi.org/~svo/i8080/ to develop your assembly code.


You    can download the output .com file directly using this assembler.


Your homework template includes several code and sample files. Here is a description for them. Do not change Emulator Files and do not send these files with your homework. Study these files to understand the 8080 assembly code and the emulator.


8080emu.cpp : Emulator implementation for 8080. You will not change this file


8080emuCPP.h: Emulator interface for 8080. You will not change this file


Memory.h and memoryBase.h : You will not change these files

gtuos.h : sample header for GTUOS. You will rewrite this file


gtuos.cpp : sample implementation for GTUOS. You will rewrite this file


main.cpp : sample main function for this HW. You will rewrite this file


sum.asm: Adds numbers from 0 to 10 and prints the results on screen.


sum2.asm : Adds numbers from 0 to 10 and prints the results on screen using a different system call.


printstr.asm : 8080 Assembly file that prints “Hello world” on screen.


Homework Tasks


There are two main tasks for you to do in this homework. First, you need to implement a number of GTUOS systems calls as described below


Call Params Function Cycle
PRINT_B REGISTER A Prints the contents of Reg B the screen as decimal. 10
PRINT_MEM REGISTER A Prints the of contents of memory pointed by Reg B and C as 10
=3 decimal
READ_B REGISTER A Reads an integer from the keyboard and puts it in to Reg B 10
READ_MEM REGISTER A Reads an integer from the keyboard and puts it in to address 10
=2 Reg BC
PRINT_STR REGISTER A Prints the null terminated string at the address pointed by B 10 per
=1 and C char
READ_STR REGISTER A Reads the null terminated string from the keyboard and puts it 10 per
=8 at the memory location pointed by B and C char


You will rewrite the two files (gtuos.h, gtuos.cpp) to implement the above system calls and you will write another file (main.cpp) to use your OS with the 8080 CPU. Use the sample main file as a guide. Do not touch original emulator code files.


You will also write and test the following assembly files. Use the provided sample assembly files to learn about how to use the assembler and how we call the OS.



  1. asm: file that prints all integer from 0 to 1000 on the screen if the


number is prime than it will print “prime” next to number. Each number will be printed on a new line.


  1. asm: Given an integer, your code will find and show integer factors of it.


For      example: factors of 20 is 1,2,4,5,10,20


  1. asm: Show whether a string given from keyboard is a palindrome by


printing the “string” semicolon: “Palindrome” or “Not Palindrome” Ex:

ada: Palindrome


arthas: Not Palindrome


  1. Expected Files: h, gtuos.cpp ,main.cpp and Assembly files above


  1. Please carefully inspect the guidelines!!



General Homework Guidelines




  1. No cheating, No copying, No peaking to other people homeworks


  1. Follow the instructions very carefully.


  1. Send required files only. Do not share your whole file system with us.


  1. If you fail to implement one of the requirements, leave it be. Do not send an empty




  1. When homework mentions about reading from keyboard it means that we are


reading from afile called “input.txt”.


  1. All you outputs should be written into a file called “output.txt. Whenever we talk about printing to screen we are referring to writing to “output.txt
  2. Respect the file names! Our HW grading is case-sensitive.


  1. Failing to comply any of the warnings above will result in getting a 0 for your current homework.
  2. You should use the shared virtual machine to build your code in order to achieve


consistent behavior. Since we will grade your assignments on top of this virtual machine

  1. You can get in touch with TA for any misunderstandings or confusions about assignments.

error: Content is protected !!