Question

In: Computer Science

in assemby, please share code and output - thanks 1. First clear all your general purpose...

in assemby, please share code and output - thanks

1. First clear all your general purpose registers by moving the value “0” into them. Initialize a variable for a BYTE, WORD, DWORD storage size each with any desired value in the data segment. Initialize another variable called Result with the size of a DWORD and make the value as an uninitialized value. In the code segment, create a label called L1 that moves the variables in the appropriate sized register and making sure NOT to overwrite them in the process. After, create another label L2 that adds all these values together and at the end of your program make sure your ECX register contains the final value. Call the DUMPREGS instruction to display your register values and move the final result into the Result variable.

2. Use the following code below as a template and follow the instructions written in the comments ;Assume I have the following data segment written: .data val1 BYTE 10h val2 WORD 8000h val3 DWORD 0FFFFh val4 WORD 7FFFh ;1. Write an instruction that increments val2. ;2. Write an instruction that subtracts val3 from EAX. ;3. Write instructions that subtract val4 from val2. .code ;Write your instructions here

Solutions

Expert Solution

Here is the solution to the above question. For your convienience I have attached the code.

.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword

INCLUDE Irvine32.inc

.data

MOV EAX, 0
MOV EBX, 0
MOV ECX, 0
MOV EDX, 0

val1 BYTE 10h
val2 WORD 8000h
val3 DWORD 0FFFFh
val4 DWORD 7FFFFh
result DWORD FFFFFh

.code
main PROC

   MOV EAX, 10

  L1:
   INC val2                            // Incrementing val2
   SUB EAX,val3                   //Subtracting val3 from EAX and storing it in EAX
   MOV EBX,val4                  
   SUB val2,EBX                   // No registers are over-written at the end of L1
   MOV EDX,val2                  // Subtracting val4 from val2 and the result is moved into EDX register
  L2:
   ADD EDX,EAX
   ADD EDX,EBX                     // Adding all the values
   MOV ECX,EDX                   // At the end of L2 the result is being moved to ECX register 

   call DumpRegs ;Check registers via output
   MOV result,ECX                 // Moving the final result from ECX register to the result variable

   invoke ExitProcess,0

main ENDP
end main

If you find this solution helpful please do UPVOTE this answer as your upvote motivates me to help students like you who are eager to learn.

HAPPY LEARNING!!!!!!!!!!!!


Related Solutions

PLEASE INCLUDE THE SOURCE CODE AND OUTPUT PLEASE AND THANKS!!This assignment covers recursion and linked list...
PLEASE INCLUDE THE SOURCE CODE AND OUTPUT PLEASE AND THANKS!!This assignment covers recursion and linked list which include the following tasks: 2. a. Using C/C++, construct a single linked list of 8 nodes and assign random numbers as the nodes’ values. Then print the list from the first node to the last. Finally, free all memories of the linked list. b. Using C/C++, construct a single linked list of 8 nodes and assign random numbers as the nodes’ values. Then...
1. Please use Python 3 programing. 2. Please share your code. 3. Please show all outputs....
1. Please use Python 3 programing. 2. Please share your code. 3. Please show all outputs. Create a GUI Calculator with the following: Title : Calculator Label and Entry box for 1st Number Label and Entry box for 2nd Number Buttons for *, /, +, - Label for result and Displaying the result
1. Please program the following in Python 3 code. 2. Please share your code. 3. Please...
1. Please program the following in Python 3 code. 2. Please share your code. 3. Please show all outputs. Instructions: Run Python code  List as Stack  and verify the following calculations; submit screen shots in a single file. Postfix Expression                Result 4 5 7 2 + - * = -16 3 4 + 2  * 7 / = 2 5 7 + 6 2 -  * = 48 4 2 3 5 1 - + * + = 18   List as Stack Code: """...
Please answer all with clear explanation, Thanks. Question 6.In addition to giving information, according to the...
Please answer all with clear explanation, Thanks. Question 6.In addition to giving information, according to the principles of teaching and learning, allnurses should be prepared to (Points : 5) 1. assess learning needs, readiness, and styles. 2. determine whether the information has been received and understood. 3. revise the approach to teaching if the client does not comprehend the information. 4. All of the above Question 8.Which are two ways to decrease a behavior or response? (Points : 5) 1.Avoidance...
All QUESTIONS, PLEASE 5.    What is the output of the following code: int product = 1,...
All QUESTIONS, PLEASE 5.    What is the output of the following code: int product = 1, i = 6; while (i < 9) {       product = product * i;       i++; } cout << “i is : ” << i << endl; cout << “product is : ” << product << endl; 6.    What is the output of the following code: int product = 1, i = 6;      do {       product = product * i;       i++;...
PLEASE WRITE CLEAR AND CONCISE CODE Subject is Unix system programming Write code that downloads all...
PLEASE WRITE CLEAR AND CONCISE CODE Subject is Unix system programming Write code that downloads all of the log files ending in `.log` in an S3 bucket and counts the total number of HTTP errors in those logs. Log lines are in the format `{"path": "/", status: 200}` or `{"path": "/", status: 404}`, for example. (This is JSON, and you can process it as such if you choose.) Use the bucket `class6-logs`, the access key ID "AKIASUMBPHIPY6DLZ4C5", and the secret...
please write the java code so it can run on jGRASP Thanks! CODE 1 1 /**...
please write the java code so it can run on jGRASP Thanks! CODE 1 1 /** 2 * SameArray2.java 3 * @author Sherri Vaseashta4 * @version1 5 * @see 6 */ 7 import java.util.Scanner;8 public class SameArray29{ 10 public static void main(String[] args) 11 { 12 int[] array1 = {2, 4, 6, 8, 10}; 13 int[] array2 = new int[5]; //initializing array2 14 15 //copies the content of array1 and array2 16 for (int arrayCounter = 0; arrayCounter < 5;...
first of all thankuu and please i dont need theory just clear my concept very clear...
first of all thankuu and please i dont need theory just clear my concept very clear so that i never have problems insolving such questions give me a very brief explanation about volume of solid rotated about a line, x axis ,y axis using shell method washer method and disk method using visual representation of how to choose element area and then limits how we decide i dont need this for any assignments or anything submission type its for my...
C++ program. Please explain how the code resulted in the output. The code and output is...
C++ program. Please explain how the code resulted in the output. The code and output is listed below. Code: #include <iostream> #include <string> using namespace std; int f(int& a, int b) {    int tmp = a;    a = b;    if (tmp == 0) { cout << tmp << ' ' << a << ' ' << b << endl; }    b = tmp;    return b;    return a; } int main() {    int a...
Please do this in C++ only. Please Show your code and your output too. Would you...
Please do this in C++ only. Please Show your code and your output too. Would you focus on number 2 in the Required functions:? Please use all the variables in the program. The assignment problem: You are asked to develop an application that prints a bank’s customers' names, IDs, and accounts balances in different ways. In this program, you need to read a file of customer’s data into different arrays, pass these arrays to functions as (array parameter), calculate the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT