QuestionQuestion

Gaining Experience and Familiarity with Assembly Language Programming (32-bit).
Write a single PROCedure that performs the following tasks.
Be sure to test the code by running it on several values as test cases.
1. Change the value of variable Number to -253.
2. Add the value 74 to the value in EAX.
3. Add the two numbers stored in memory at Number1 and Number2, and store the total at the memory location named Sum.
4. Subtract 1000 from the value store in memory location named Number.
5. Prompt for three (3) integer values from the user, add them, print or display the sum, as well as store it in the memory location declared as Sum.
6. Prompt for two (2) from the user. Subtract the first from the second, display and result, and also store in a variable declared as Diff.
7. Use MOVe based instructions to swap values stored at Value1, Value2 and Value3.
8. Use XCHG based instructions to swap values stored at Value1, Value2 and Value3
9. Evaluate, and display the result, for the expression: X - 2Y + 4Z, (assumming MULtiplication and DIVision instructions are not available). The values for X can be from 1-31, Y can be 1-12, Z can be any 4-digit year value.
10. Prompt the use for the Length, Width and Height values of a cuboid, and compute and display the value of the expression 4*Length + 4*Width + 2*Height. Also store the result in the variable Perimeter. Assume the MULtiply instruction is unavailable.
11. Declare 8-bit variables, BVar1, BVar2, BVar3 and BVar4, as well as 32-bit variables, DVar1, DVar2, DVar3 and DVar4. Prompt the user for the values to store in BVar1, Bvar2, BVar3 and BVar4. Then store these values in the corresponding DVar1, DVar2, DVar3 and DVar4, a) using Zero-Extension and b) Sign-Extension instructions.
12. Prompt the user for values to store in Var1 and Var2. Then evaluate and display the result for (Var2 - Var1) + (Var1 - Var2), using only INCrement and DECrement instructions.
13. Declare and organize memory space to store a list of 100 integer values. Write the code to display the values stored in the list (Hint: Use the LOOP instruction).
14. Declare and organize memory space to store the LastName, FirstName and MiddleName of a Patient. Prompt the user to input the names for a patient and store them inputs in the declared variables.
15. Declare and organize memory space to store the LastName, FirstName, MiddleName and Id for 100 students in a University department. Write the code to prompt the user to input the actual number of students registered in a particular semester, and then display the records for these students. (Hint: use the LOOP instruction).

Gaining Experience and Familiarity with Assembly Language Programming (64-bit).
Convert the code written in Part (I) into code for 64-bit programming.

Document and present your design as a Technical Report in the following form:
Title
Author
Date, Revision Number
Introduction: Problem to Solve
Solution. (Provide details in an Appendix)
Discussion of Results
Summary & Conclusions
Acknowledgments, (if any)
References, (if any)
Appendix:
Details of Design (Pseudo-code)
Details of Implementation (Source code)
Details of Test Cases (Test plan and Screenshots)

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

Program 64
;*********PROCEDURES***********

proc1 proc
;--------------------------------
;This procedure changes the value
;of variable Number to -253
;--------------------------------
mov ax,-253
mov Number,ax
ret
proc1 endp

proc2 proc
;--------------------------------
;This procedure adds the value 74
;to the value in register EAX
;--------------------------------
add eax,74
ret
proc2 endp

proc3 proc
;---------------------------------
;This procedure calculates the sum
;of variables Number1 and Number2
;and stores it in the variable Sum
;---------------------------------
mov eax,0
mov ax,Number1
movsx edx,Number2
add eax,edx
mov Sum,eax
ret
proc3 endp

proc4 proc
;----------------------------------
;This procedure subtracts the value
;of variable Number by 1000
;----------------------------------
mov ax,Number
sub ax,1000
mov Number,ax
ret
proc4 endp

proc5 proc
;---------------------------------
;This procedure prompts the user
;to enter three values, calculates
;the sum and displays it
;---------------------------------
mov rdx,LENGTHOF val1_string
mov rbx, OFFSET val1_string
call print_string
call load_number
mov Value1,dx
mov rdx,LENGTHOF val2_string
mov rbx, OFFSET val2_string
call print_string
call load_number
mov Value2,dx
mov rdx,LENGTHOF val3_string
mov rbx, OFFSET val3_string
call print_string
call load_number
mov Value3,dx
mov eax,0
mov ax,Value1
movsx edx,Value2
add eax,edx
movsx edx,Value3
add eax,edx
mov Sum,eax

mov rdx,LENGTHOF sum_string
mov rbx, OFFSET sum_string
call print_string

mov edx,Sum
call print_snumber
ret
proc5 endp...

By purchasing this solution you'll be able to access the following files:
Solution.zip.

$50.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Assembly Language Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats