Creating and programming your own virtual machine, exactly as discussed in class. stage 1 Your program should accept any assembly language file, just like the examples posted on our web page. The name of the file should be provided by the user on the command line (argc and argv). Any errors must be reported. If there are errors your program should not continue to the next stage. You will need to take two passes as explained before. In the second pass your program must convert the instructions into their numeric form and store them appropriately in the program code memory area. stage 2 Execute the program that stage 1 read and translated. Start with instruction 0, perform its actions and move onto the next instruction. Of course in the case of a skip or jump instruction the next will be in a different place than usual. All input and output instructions should of course perform the right input or output operations. Execution of the program should continue until either a halt instruction is reached or an error occurs. In the case of error make sure the user knows all about it and stop the program immediately. In the case of a halt instruction report the halt, along wiht its exit code, to the user and stop. stage 3 This will help you to get things working. Give your program two debug options that the user can turn on and off as desired. How that is done is your decision, it could be an extra word on the command line, or an extra non-instruction line (like label string or data in the program itself. If the first debugging option is turned on, then during phase 1 your program will print every line that it reads followed by what happened as a result (i.e. what got put where in the memory areas) If the second debugging option is turned on, then during phase 2 your program will print, in a conveniently human readable form, every instruction it executes as well as where that instruction came from in the program code memory area. It should also print a report of what happened. This is very easy to do: before each instruction does its job, print the current values of both the register regs[i.reg] and the data memory location that it references memD[i.n] then print the program code memory location that the instruction came from, the instruction's name, the register it uses and its numeric operand then actually obey the instruction then repeat the "before ..." part, this time showing the new values of its register and memory location Short example: reg 1 = 75, mem 23 = 9768 16 ldc 1 23 reg 1 = 23, mem 23 = 9768 reg 1 = 23, mem 41 = 0 17 stm 1 41 reg 1 = 23, mem 41 = 23 The link on our class web site for class 9 contains what you saw in class with all the details. Follow the pattern shown there as closely as possible. I have added extra information, but that is not required for this assignment (the extras are clearly marked). It would be good to do those things, just not required. I had originally thought that supporting functions with local variables and even recursion would be too much, but managed to simplify it a lot. There is time to get this right, but if you have questions or problems you must ask quickly. Waiting until the last moment is almost certain to mean your program just won't work. Don't just go with my examples, make up your own. That will help a lot in getting used to how things work and give you better test cases for the submission.