HW 2
due October 4
Last modified 9/24/99--PR
Class home page
This assignment must be completed individually. You may discuss the
LMC with other students (e.g., why the example LMC programs in the readings
work the way they do), but it's very important that you work on writing
the LMC program yourself.
Reading
Chapter 4, section 1 only, plus the sidebar about operating systems on
page 96.
Handout about the Little Man Computer (LMC), by Stuart Madnick.
PC Magazine article on Operating Systems, available
online.
Notes on representation,
architecture,
and programming languages
Lab Exercise
First, you'll need to install a copy of the Little Man Computer Simulator.
You'll need to run it on a Windows machine. Click here
to download it. It's an executable file: once you've saved it, just
double-click to install the software. Thanks to Jim Longfellow, who wrote
this version of the simulator while he was a TA for a class at MIT, and
thanks to Chris Dellarocas for permission to use it for our class.
Your goal is to create an LMC program that finds the maximum value of
all inputs on the input conveyor belt, ending when it finds the value 000
on the input conveyor belt. Use figures 17 and 18 (from the LMC handout)
as examples to work from in doing this exercise.
-
First draw a flowchart for your program, similar to the one in figure 17.
-
Next write a program, similar to the one in Figure18. Be sure to test it
using the LMC simulator. Save the program as a file and also print the
LMC screen after a sample run of the program. Send your program as a file
attachment, and hand in on paper your flow chart and the printout of the
sample run.
Explanation
(Find someone who is not taking this class, and who knows less about computers
than you do. It could be a fellow SI student, or a roommate or a friend
or relative). Explain to this person what an operating system is. In
your homework writeup, say who received your explanation, and include a
few sentences about what made it easy or hard to do the explanation.
Questions for Class
Some questions to think about for class (don't hand in answers to these,
but be prepared to discuss in class):
-
Is it possible to create a compiler that would take C++ source programs
and create Java bytecode?
-
Is it possible to create an interpreter for program for Java source code
(not Java bytecode)?
-
Is it possible to create a decompiler program that generates COBOL source
code from machine code? How helpful would such a decompiler program be
in solving Y2K problems?