Write an assembly language program to perform the following


Project Description: In this assignment, you will write an assembly language program to perform the following operation: Input a positive integer N, then compute the sum of the integers equal to N.

SUM=1+4+9+?+N

The user input will ALWAYS be a two-digit number (between 01 and 10). You do NOT need to check the correctness of the input. For example, if the user input is "10", then your program will output "385". 

SUM=1+4+9+16+25+36+49+64+81+100=385

Design Document Specifications

To process the input, I will read the first input as an ASCII symbol and store in Register A.  I will then convert the ASCII in Register A to a number using the formula; Register B = Register A - '0'.  I will then read the second ASCII symbol and store it in Register A.  The ASCII in Register A will be converted to a number by the formula; Register A = Register A - '0'.  Multiply the value in Register B and add it with the value that is stored in Register A as follows; Register B = (Register B * 10) + Register A.  After these steps, we have converted a two digit ASCII input into a two digit number and stored it in Register B.

For computing the sum, we will need to handle a loop.  To handle the loop, we use a separate register as a counter.  i.e. Register C, and Register D are used to maintain the sum.  After each loop, the value in register C is increased by 1 until it equals the value in Register B and the loop will stop.  In each loop, we will use Register E to calculate the square of register C, then add the current value of Register D and Register E.  The resulting sum is stored in Register D.  Finally, the value in register D is the sum we need to calculate; Sum = 1 + 4 + 9 + ... + N.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Write an assembly language program to perform the following
Reference No:- TGS02532681

Expected delivery within 24 Hours