Question

In: Computer Science

Assembly language - please post with output Question: Using the AddTwo program from class lecture as...

Assembly language - please post with output

Question:
Using the AddTwo program from class lecture as a reference, write a program that calculates the following expression, using registers: A = (A + B) - (C + D). Assign integer values to the EAX, EBX, ECX, and EDX registers.

Solutions

Expert Solution

Program:

INCLUDE Irvine32.inc
.386
.stack 10
.data
A byte 12                                                                     ; declaration and initialization of the variables
B byte 6
C byte 2
D byte 7
.code                                                                          ; code part
main PROC                                                                ; begin of main
mov eax,00000000                                                     ; replace the eax register with all zeroes
mov al,C                                                                     ; move the value of C to al
add D                                                                          ; performing (C + D)
call dumpregs                                                             ; printing the values of the registers
mov ebx, 0                                                                  ; replace the ebx register with all zeroes
mov bl,A                                                                      ; move the value of A to al register
add bl,B                                                                       ; performing (A + B)
call dumpregs                                                              ; printing the values of the registers
mov ecx,00000000                                                      ; replace the ecx register value with all zeroes
mov cl,bl                                                                       ; move the value of (A+B) to cl
sub cl,al                                                                        ; perform content of (cl) - (C + D) and store the result in cl register
call dumpregs                                                               ; printing the values of the registers
main endp                                                                     ; end of main
end main

Hope this helps.



Related Solutions

Hi this is Assembly Language MASM x86 program. Please write it in the language and please...
Hi this is Assembly Language MASM x86 program. Please write it in the language and please explain it with comments thank you Please answer it I really need help this question was refunded before so please answer. Thank you so much also these are two separate programs thank you. 1) Write a procedure to read in decimal or hex number (byte-sized) Then write a procedure using shifts and ANDS to convert the string to a binary number (if is backward,...
This program has to be written in assembly language using emu8086. Please choose the .EXE template....
This program has to be written in assembly language using emu8086. Please choose the .EXE template. The requirements and the action is contained in the docx file. You’ve been hired by Spacely Sprockets and they need to be able to write order information out to a file. Using all of the knowledge that we’ve gained in the last few sections on structures and files, you need to write a program that does the following: Design a structure that can hold...
Please code the program showing the output below. using C language 1. Using 'if' or 'while'...
Please code the program showing the output below. using C language 1. Using 'if' or 'while' or 'for' and 'break' statement / only using <stdio.h> A bC dEf GhIj KlMnO 2. a program that identifies the largest number that can be expressed in short. Using only loop (ex.for,if,while) and break statement only using <stdio.h>
Convert the following pep/9 machine language program into an assembly code. Determine the output of this...
Convert the following pep/9 machine language program into an assembly code. Determine the output of this program if the input is ‘tab’. The left column is the memory address of the first byte on the line: 0000 D1FC15 0003 F1001F 0006 D1FC15 0009 F10020 000C D1FC15 000F F10021 0012 D10020 0015 F1FC16 0018 D1001F 001B F1FC16 001E 00
Take the following program from C++ and translate it into Pep/9 assembly language: #include <iostream> using...
Take the following program from C++ and translate it into Pep/9 assembly language: #include <iostream> using namespace std; int theArray[] = { 5, 11, -29, 45, 9, -1}; void sumPos(int ary[], int len, int &sum) {    sum = 0;    for (int i = 0; i < len; i++)            if (ary[i] > 0)                sum = sum + ary[i]; } int main() {    int total;    sumPos(theArray, 6, total);    for (int k=0; k < 6; k++)...
Write an assembly language program that prints your first name in the output. Use immediate addressing...
Write an assembly language program that prints your first name in the output. Use immediate addressing with a hexadecimal constant to designate the operand of CHARO for each letter of your name. Comment each line except STOP and END. Cut and paste the Assembler Listing into your document and paste a screen shot of the Output area of the Pep8. Use the name "Kevin" as example Assembler Listing Screen Shot of Output area of the Pep8 program
Write an assembly language program that corresponds to the following C program ****Please give correct answer...
Write an assembly language program that corresponds to the following C program ****Please give correct answer using Pep/9 machine**** int num1; int num2; ;int main () { scanf("%d", &num1); num2 = -num1; printf("num1 = %d\n", num1); printf("num2 = %d\n", num2); return 0; }
In MPLAB write and compile (using the simulator) an assembly language program with the following functionality:...
In MPLAB write and compile (using the simulator) an assembly language program with the following functionality: Configures pin RA2 of the PIC24to be an output to control an attached LED. Configures pin RB13 of the PIC24 to be an input to read the value on an attached switch (this switch will connect to ground when pressed). Configures pin RB13 to use the internal pull-up resistor. After configuration, the LED will be "off" when the push-button is pressed, and "on" when...
Using the windows 32 framework , write an assembly language program ; write a procedure to...
Using the windows 32 framework , write an assembly language program ; write a procedure to read a string and shift each character of the string by one. As an example, if your input string is Abcz, your output should be Bcda. Note that you must test your string for non-alphabetic characters (such as numbers and special characters). If there are non-alphabetic characters, you should terminate your program with an appropriate message. You should display your converted string using the...
Post-Lecture Question 01 Adjusting entries
Post-Lecture Question 01Adjusting entriesare external events involving a transfer or exchange between two or more entities.reduce the nominal accounts to zero and transfer net income or loss to an owners’ equity account.are made at the end of an accounting period to bring all accounts up to date on an accrual basis.all of these answer choices are correct.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT