HW2BasicAssembly

HW2BasicAssembly - out the sum ON THE SAME LINE A sample run of this program would look like What are the first 3 digits of your phone number 805

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 64 HW2 - First Assembly Program Goal: Perform user input / output with assembly Perform mathematical calculations Your assignment this week is to write an assembly program that takes some user input, performs various mathematical manipulations, and outputs the result. Here are the instructions: PhoneAFriend: Write a program that performs the following numeric transformations. Write your code in a file name PhoneAFriend.asm. You may <b>not</b> use pseudoinstructions other than la. 1) What are the first 3 digits of your phone number? (do NOT include the area code) 2) Multiply by 80 3) Add 1 4) Multiply by 250 5) What are the last four digits of phone number? 6) Add in the last four digits of phone number 7) Add in the last four digits of phone number again 8) Subtract 250 9) Divide by 2. For your output: Display the result after every step. You do not need to check for valid input each time. For the final answer, start the line with "Final Answer: " then print
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: out the sum ON THE SAME LINE. A sample run of this program would look like: What are the first 3 digits of your phone number? 805 Multiply by 80 64400 Add 1 64401 Multiply by 250 16100250 What are the last four digitals of phone number? 5555 Add in the last four digits of phone number 16105805 Add in the last four digits of phone number again 16111360 Subtract 250 16111110 Divide by 2 Final Answer: 8055555 Place your code in a file named PhoneAFriend.asm in a directory named hw2. Do not forget to put your name after "Name:" in the comments at the top of your code. You will be graded on the accuracy of the output, adherance to the UI in the example above, and the commenting of the code. For commenting, you need to have a header that describes what the program does as well as line comments that tell what each assembly instruction or short set of instructions does....
View Full Document

This note was uploaded on 12/27/2011 for the course CMPSC 30 taught by Professor Franklin during the Fall '09 term at UCSB.

Ask a homework question - tutors are online