Two Pip programs

This is a pair assignment worth 60 points.

The objective of this assignment is to write Pip programs that use jumps to approximate a Python if-else statement and a while statement.

The program should begin with comments (starting with ';') including your names, a brief description of what the program does and information on any help you received on the project.  If it is entirely your own work, say so.  If anyone helped either of you, identify them by name and describe how they helped. 

Remember to turn in your work on Sakai.  Have one member turn in the files for the work and each turn in log.txt files, as for the last assignment. 

You are to write two separate chunks of Pip code.  Call the files pipa.asm and pipb.asm, and test each separately in pipGUI.py.  Include the initial required comments at the top of the first file.  Remember, in assember comment lines start with a semicolon.  

Do not have initial statements to set values for the variables.  Instead set memory values in the simulator before each test of your chunk of code.  (This saves time.)

Part A  An if-else construction (pipa.asm) (25 points)

Write Pip assembler code equivalent to the Python below. The easiest way and most encouraged way is using symbolic code labels as needed (followed by a colon) and symbolic data names, as understood by pipGUI.py.  You may do it with numeric data addresses and/or numeric jump addresses as in the book or the book's applet, but in that case, do make a comment as to what memory locations represent the x, y, and z of the Python version!

if x < 0:
    y = y + 2
else:
    y = x
z = y + z

You are encouraged to

Part B:  Remainder by subtraction (pipb.asm) (35 points)

Pip does not have a remainder operation as in Python.  One way to simulate y = y % x with positive x and y is

while y >= 0:  
    y = y - x
y = y + x  

After the loop, y < 0 for the first time.  After the last line it is back to the proper range for the remainder: 0 <= y < x.   Play computer to see that this works!
Convert that code to Pip assembler file pipb.asm and test as in part A.  The while loop condition translation is trickier here than in the earliest while translation example.

Same instructions as before for log.txt:  Every individual should separately submit a personal file log.txt.  This should be a plain text file with exactly this name.  (You can create it in Idle if you like.) Your homework grade will not be recorded without this file!  Include in the file
  1. Roughly how long you worked on the Pip Programs beyond class time.
  2. Briefly, how it went for you, for instance what was the hardest part to get ...
  3. Who your partner was if you had one, or "No partner"  If you changed partners, indicate which files were produced with which partner, if possible.
  4. If you had a partner, give an indication of how things went with your partner.  Was working together a good thing?  Did you work together remotely online?  How did it go?

If you worked with a consistent partner through the whole chapter, only one of you needs to submit the archive, but make sure each partner has their own copy! Each student should separately submit an independently written log.txt file.