Question

In: Computer Science

Create a 32-bit Linux-based assembler language program (nasm) which: 1. Defines these variables: A: A single...

Create a 32-bit Linux-based assembler language program (nasm) which:

1. Defines these variables:

A: A single byte

B: A word

C: A double word

D: A double word

2. Using the eax register (and its sub-registers), process the following equations (ONLY using the mov, add and sub assembly keywords):

I. A + (B + C) = D

II. (A + C) - B = D

3. Using the linux function library, print a string describing each equation, then values in each variable, and then the answer in the resulting variable

4.Use the following values in your equation:

I. 10h

II. 2000h

III. 30000

Sample Output: The Result of A + (B + C) = D is: 32010

When printing out a string in NASM, use the linux function library call PrintString. Make sure your string is 00h terminated. • When printing out a Hexadecimal value in NASM, use the linux function library call Print32bitNumHex

Solutions

Expert Solution

section .data
   msg db "The Result of A + (B + C) = D is :%d",10,0
   msg1 db "The Result of (A + C)-B = D is :%d",0


    A dd 10
    B dd 2000
    C dd 30000
section .bss
    D resd 1
section .text
   global main
   extern printf
main:
    
        ;A+(B+C)=D
   mov eax,dword[B]
   add eax,dword[C]
   add eax,dword[A]
   mov dword[D],eax
  
   push eax
   push msg
   call printf
   add esp,8
  
  
   mov eax,dword[A]
   add eax,dword[C]
   sub eax,dword[B]
   mov dword[D],eax
   push eax
   push msg1
   call printf
   add esp,8
  

  
      

   


Related Solutions

Give an example of the pair of assembler instructions equivalent to a push using 32 bit...
Give an example of the pair of assembler instructions equivalent to a push using 32 bit ISA.
using Windows 32 bit framework , Write an assembly language program to find the second minimum...
using Windows 32 bit framework , Write an assembly language program to find the second minimum element (formally, second minimum is larger than the minimum but smaller than all the other elements in the array) of an array of size 100. Note: You can define the array as nbrArray DWORD 23 45 21 67 78 95 dup(?) and show that your program works for the first five elements. Display the second minimum in a message box using Input output macro
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit...
Using MARS write a MIPS assembly language program to prompt the user to input two 32-bit integers X and Y (X and Y can be prompted separately or at the same time), get them from the user then store them in memory locations labeled X and Y respectively. The program then loads X and Y from the main memory to registers, calculates the sum of them (i.e. X + Y) and store the sum into a memory location labeled S....
Using C++ language, create a program that uses a struct with array variables that will loop...
Using C++ language, create a program that uses a struct with array variables that will loop at least 3 times and get the below information: First Name Last Name Job Title Employee Number Hours Worked Hourly Wage Number of Deductions Claimed Then, determine if the person is entitled to overtime and gross pay. Afterwards, determine the tax and net pay. Output everything to the screen. Use functions wherever possible. Bonus Points: Use an input file to read in an unknown...
Write a MIPS assembly language program that inputs a floating-point number and shows its internal 32-bit...
Write a MIPS assembly language program that inputs a floating-point number and shows its internal 32-bit representation as a 8-digit hexadecimal representation. For example: 2.5 decimal is 10.1 binary, which normalized is 1.01x21 and would be stored in the IEEE format as 0100 0000 0010 0000 0000 0000 0000 0000 which is 0x40200000
Design a 32 bit after using a single 4 bit using verilog code
Design a 32 bit after using a single 4 bit using verilog code
Design a 32 bit adder using a single 4 bit adder using verilog code
Design a 32 bit adder using a single 4 bit adder using verilog code
(JAVA) Create a program that prompts the user for an age input. The program defines the...
(JAVA) Create a program that prompts the user for an age input. The program defines the age group of the user. Follow the table below to construct the output for your program. Age Age Group 0 Baby 1-3 Toddler 4-11 Child 12-17 Teenager 18-21 Young Adult 22-64 Adult 65+ Senior Negative Number Invalid Input Sample Input Enter an age: 18 Sample Output: You are a young adult. Sample Input Enter an age: 29 Sample Output: You are an adult. Sample...
Computer Science (C and Assembly Languages)    •   Assume there are two 32-bit variables in RAM...
Computer Science (C and Assembly Languages)    •   Assume there are two 32-bit variables in RAM memory called In and Out. Write C code that sets Out equal to In plus 2.    •   Assume there are two 32-bit variables in RAM memory called In and Out. Write assembly code that sets Out equal to In plus 2.    •   What are the three stack rules?    •   Assume B1 is a 32-bit unsigned global variable. We wish to write...
1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables:...
1. Create a console program in C#, * Create a class: "Student.cs" * Add 3 variables: StudentName (string), SchoolYear (int), YearsUntilGraduation(int) * Method YTK() = 12 - SchoolYear; 2. Main *Enter name *Enter age *You will attend school:____ years before graduating.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT