CS 70

Assembler

What You’re Given…

You have a sequence of instructions from the compiler written in the “CS70 Classroom Language”. This simple language encodes instructions for the Prof to do various things with the props in the classroom!

What You’ll Do…

As the assembler, your job is to translate the “CS 70 Classroom Language” instructions to a language that the CPU can understand. In this case, our CPU is the Prof, short instructions in plain English!

In your group's directory, make a file called objectfile-01.txt (or -02.txt, etc. for subsequent attempts).

You will need to write down a series of instructions in English that tell the Prof what to do. You can feel free to exercise your creativity in how you write these instructions! But to help you out, here’s some quick definitions of what each “CS 70 Classroom Language” instruction means:

Instruction Definition
put (value) in (boxN) Write down the value on a piece of paper and put it in the box numbered N
add (boxN) to (boxM) Take the values inside boxes N and M, add them together, and place the result into box M, replacing what was already there
subtract (boxN) from (boxM) Like the add command, but with subtraction
multiply (boxM) by (boxN) Like the add command, but with multiplication
divide (boxM) by (boxN) Like the add command, but with division

Importantly, note that there is one specific kind of “CS 70 Classroom Language” command that you should not translate! That command is the “call” command. If you see a “call” command, you should leave it exactly as is as part of your final instructions. (So, there may be a few “call” commands scattered in the middle of what is otherwise a bunch of plain English sentences).

When You've Finished

  • If you successfully created the object file, you can move on to the next stage, linking.
  • If however there was an error, you need to fix just that error in the source file and create a new copy of that source file in your group directory, number that too, so it becomes prog-01.cpp (or whatever the next number is).

(When logged in, completion status appears here.)