CS 3503 Computer Organization and ArchitectureSIMPLE SINGLE DIGIT CALCULATOR FOR MARIE ASSEMBLY LANGUAGE If you could PLEASE help me I really would appreciate it. I have been at this for 4 days straight and cant get it. If what i have so far isn’t right then I dont mind it being scrapped for something better. Please answer fully. This is the last time ill be able to take this class or I flunk out as a senior in College which i desperately dont want. The requirements are in the document above the dotted line. ———————————DOCUMENT——————————– This is for MARIE ASSEMBLY LANGUAGE . You will need to implement a simple calculator using assembly programming with the MARIE architecture model. Please make sure you read through and follow EXACTLY the requirements given below. Requirements: 1. The calculator can perform any of the following operations between two integers: addition subtraction multiplication and division. 2. To reduce the complexity assume that both integers are positive and of single digit. So you are only using 1-9 for the calculations. 3. At the beginning your program should wait for inputs to be provided through the input window/register of the simulator. To do so you need to use the instruction “Input”. To provide the input values you need to first set your input data format (or input mode) to “Dec” (i.e. decimal) by using the drop-down menu associated with the input window of the simulator. The input should follow the format below: a. Addition: 10 num1 num2 Here “10” tells the program to perform addition “num1” and “num2” will be the two numbers to be added. The three numbers will be provided through the input window to the program one by one. b. Subtraction: 11 num1 num2 c. Multiplication: 12 num1 num2 d. Division: 13 num1 num2 The calculator program always shows immediately the input value it receives in the output window of the simulator. To do so you need to set your output data format to “Dec” (i.e. decimal) by using the drop-down menu associated with the output window of the simulator. If an input number is invalid in addition to showing the invalid input number the program should also show a specific number 100 in the output to indicate the invalidity. example: 14 100 When this happens the program will continue to check the next provided number till a valid number is identified. To be valid the first input should be a number in the range of 10-13 and num1 and num2 have to be a number in the range of 1-9. //—–Sample of the beginning of the Code—-// ORG 100 INPUT STORE OPERATOR OUTPUT IF LOAD OPERATOR SUBT FOURTEEN SKIPCOND 000 JUMP ENDIF1 LOAD OPERATOR SUBT NINE SKIPCOND 000 JUMP ENDIF1 THEN INPUT ……………………. ///——–End of Sample of the Beginning of Code—//// 4. Once the three inputs have all been accepted the program will perform the specified operation on the provided integers. You need to implement four different SUBROUTINES each for one of the four operations. For a particular operation your program will need to call the corresponding subroutine to perform the operation. You can use “Ex4_4.mas” in the MARIE simulation package as your reference for implementing a subroutine. //——Ex4_4.mas———// ORG 100 Load X / Load the first number to be doubled. Store Temp / Use Temp as a parameter to pass value to Subr. JnS Subr / Store the return address and jump to the procedure. Store X / Store the first number doubled Load Y / Load the second number to be doubled. Store Temp JnS Subr / Store the return address and jump to the procedure. Loop Store Y / Store the second number doubled. Halt / End program. X DEC 20 Y DEC 48 Temp DEC 0 Subr HEX 0 / Store return address here. Load Temp / Actual subroutine to double numbers. Add Temp / AC now holds double the value of Temp. JumpI Subr / Return to calling code. END //——End of Ex4_4.mas———// 5. You can implement a multiplication using addition. For example 5 x 3 is equivalent to 5 + 5 + 5. 6. You can implement a division using subtraction. The results should include both the quotient and the remainder. There are three different cases here: a. Case 1: the dividend is smaller than the divisor where the quotient is 0 and the remainder is the dividend. E.g. 4 / 7 yields: quotient = 0 remainder = 4. b. Case 2: the dividend can be divided exactly by the divisor where the remainder is 0. E.g. 8 / 4 (which can be implemented as 8 – 4 – 4) yields: quotient = 2 remainder = 0. c. Case 3: the dividend is greater than the divisor and the dividend cannot be divided exactly by the divisor where the remainder is non-zero. E.g. 8 / 5 (which can be implemented as 8 – 5) yields: quotient = 1 remainder = 3. 7. Once the calculation is complete show the result in the output window. For division show the quotient first followed by the remainder (even if the remainder is zero). Then the program should go back to its initial state waiting for inputs for the next round of calculation. 8. The calculator wont stop by itself. You can exit the program by stopping running the program in the simulator or closing the simulator. ——————————————————————-END OF DOCUMENT——————————————————– This is what I have so far BELOW but dont know how to join the subr with loops and jumps or if the code for the math is right at all for the quotient and remainder. If what i have so far isn’t right then I dont mind it being scrapped for something better. Please answer fully. What I have so far ORG 100 INPUT STORE a IF LOAD a subt fourteen SKIPCOND 000 // skip next line if a < 0 JUMP ENDIF1 Input STORE b Input STORE loc // location JUMPI loc //----addition----- JNS add LOAD a ADD b OUTPUT HALT //---subtraction--- JNS Subr LOAD a SUBT b OUTPUT HALT //----multiplication--- JNS Multi INPUT STORE a INPUT STORE b loop LOAD a ADD multiply STORE multiply LOAD b SUBT one STORE b SKIPCOND 400 JUMP loop LOAD multiply OUTPUT HALT //---Division--- JnS Divide LoopD Load 0 Store sum Num1 Load a Subt b SkipCond 000 Jump Num2 Add b Load a JnS Divide Num2 Store a Load sum Add one Store sum Jump Num1 /repeat iteration Halt ///variables a DEC 0 b DEC 0 x DEC 100 // error code for input a > 13 one DEC 1 sum DEC 0 multiply Dec 0 loc DEC 0 add DEC 10 Subr DEC 11 Divide DEC 12 Multi DEC 13 fourteen DEC 14
- Free title page and bibliography
- Unlimited revisions
- Plagiarism-free guarantee
- Money-back guarantee
- 24/7 support
- Writer’s samples
- Part-by-part delivery
- Overnight delivery
- Copies of used sources
- Expert Proofreading
- 275 words per page
- 12 pt Arial/Times New Roman
- Double line spacing
- Any citation style (APA, MLA, Chicago/Turabian, Harvard)
We value our customers and so we ensure that what we do is 100% original..
With us you are guaranteed of quality work done by our qualified experts.Your information and everything that you do with us is kept completely confidential.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
The Product ordered is guaranteed to be original. Orders are checked by the most advanced anti-plagiarism software in the market to assure that the Product is 100% original. The Company has a zero tolerance policy for plagiarism.
The Free Revision policy is a courtesy service that the Company provides to help ensure Customer’s total satisfaction with the completed Order. To receive free revision the Company requires that the Customer provide the request within fourteen (14) days from the first completion date and within a period of thirty (30) days for dissertations.
The Company is committed to protect the privacy of the Customer and it will never resell or share any of Customer’s personal information, including credit card data, with any third party. All the online transactions are processed through the secure and reliable online payment systems.
By placing an order with us, you agree to the service we provide. We will endear to do all that it takes to deliver a comprehensive paper as per your requirements. We also count on your cooperation to ensure that we deliver on this mandate.
Calculate the price of your order
The price is based on these factors:
Order your paper today and save 30% with the discount code HAPPY
error: Content is protected !!