Question

In: Computer Science

Assembly language: please comment on every line of code explaining each part. include head comments describing...

Assembly language: please comment on every line of code explaining each part. include head comments describing what your program does.

Assignment 3A - A program that adds and subtracts 32-bit numbers
After installing the assembler on the computer, enter the following program, save it, assemble it and run it. Do not forget to add a comment with your name in it.
You will hand in a listing (e.g., addsum.asm) that should include your name
________________________________________

TITLE Add and Subtract (AddSum.asm)
;This program adds and subtracts 32-bit integers

; Jonathan Borda
INCLUDE Irvine32.inc
.code
main   PROC
   mov   eax, 10000h   ; EAX = 10000h
   add   eax, 40000h   ; EAX = 50000h
   sub   eax, 20000h   ; EAX = 30000h
   call   DumpRegs   ; display registers

   exit
main   ENDP
   END   main

Solutions

Expert Solution

I hope this what you want. I have explained everything. if you still have any doubt please let me know.

--------------------------------------------------------------------------------------------------------CODE----------------------------------------------------

TITLE Add and Subtract (AddSum.asm)
;This program adds and subtracts 32-bit integer

;------------------your Name-----------------------

INCLUDE Irvine32.inc ; include directives brings the necessary definition and macros into program for execution of program, from Irvine32.inc

.code ; This is code Segment. There are 3 segment 1)code 2) data 3) stack. Code segment contains instructions that are to be executed.

main PROC ; beginning of a main procedure

   MOV EAX,10000H ;EAX=10000H This statements moves the 10000h into EAX register over here EAX is destination register and 10000h is source operand

   ADD EAX,40000H ;EAX=50000H This add instructions add the content of EAX register with 40000h source operand and result is stored in EAX register which is 50000H

   SUB EAX,20000H ;EAX=30000H This subtract instruction subtract the value of Source operand from EAX register and stores the value in EAX register

   CALL DumpRegs ; This instruction calls a procedure (defines in Irvine32) DumpRegs which displays the value of CPU Register
  
   exit ; It is a macro defined in Irvine32. That represents an end of a program.

main ENDP ; This ENDP represents end of procedure over here it is main
  
END main ;END represents End of Program After word the main represent a procedure name Entry point in the program from where execution of program begins. This is optional part.


Related Solutions

Can someone please write clear and concise comments explaining what each line of code is doing...
Can someone please write clear and concise comments explaining what each line of code is doing for this program in C. I just need help tracing the program and understand what its doing. Thanks #include <stdio.h> #include<stdlib.h> #include<unistd.h> #include<sys/wait.h> int join(char *com1[], char *com2[]) {    int p[2], status;    switch (fork()) {        case -1:            perror("1st fork call in join");            exit(3);        case 0:            break;        default:...
Can someone please add clear and concise comments thoroughly explaining each line of code below. Just...
Can someone please add clear and concise comments thoroughly explaining each line of code below. Just need help understanding the code, don't need to modify it. The purpose of the code is to count the frequency of words in a text file, and return the most frequent word with its count. It uses two algorithms: Algorithm 1 is based on the data structure LinkedList. It maintains a list for word frequencies. The algorithm runs by scanning every token in the...
Comment the code explaining what each line is doing. The first line has been done for...
Comment the code explaining what each line is doing. The first line has been done for you. x=[0 0 -1 2 3 -2 0 1 0 0]; %input discrete-time signal x dtx= -2:7; y=[1 -1 2 4]; dty=8:11; z=conv(x,y); dtz=6:18; subplot(1,3,1), stem(dtx,x) subplot(1,3,2), stem(dty,y) subplot(1,3,3), stem(dtz,z)
Using MIPS (MARS) - Assembly Language Assignment ( PLEASE USE COMMENTS TO DESCRIBE EACH STEP )...
Using MIPS (MARS) - Assembly Language Assignment ( PLEASE USE COMMENTS TO DESCRIBE EACH STEP ) Take input of name, the input of hours worked, and input of hourly wage, and use input of hourly wage and hours worked to calculate total paycheck and print Name, and paycheck.
Menu Writing - Python - Please include #Comments in each line for explanation (a) A common...
Menu Writing - Python - Please include #Comments in each line for explanation (a) A common task while writing any software is to display a menu and ask the user for a choice. One such example is the menu on your cellphone. It has messaging, contacts, games, settings, media, and web (and possibly others) as options. Write a function called display menu that displays the menu to the user and allows the user to make a choice (using input). (b)...
Please do it in C++. Please comment on the code, and comments detail the run time...
Please do it in C++. Please comment on the code, and comments detail the run time in terms of total operations and Big O complexities. 1. Implement a class, SubstitutionCipher, with a constructor that takes a string with the 26 uppercase letters in an arbitrary order and uses that as the encoder for a cipher (that is, A is mapped to the first character of the parameter, B is mapped to the second, and so on.) Please derive the decoding...
Assembly langugage , please do comment each line or step if possible . Question 2 of...
Assembly langugage , please do comment each line or step if possible . Question 2 of 2. Element wise vector multiplication: [30 marks] Write an assembly language program that performs element wise multiplication of two arrays of size 4 and stores the resultant array back into memory. For Arrays A = [Aw, Ax, Ay, Az] and B = [Bw, Bx, By, Bz], the resultant array C = [Aw*Bw, Ax*Bx, Ay*By, Az*Bz] 1. Reserve and initialize memory for both input arrays...
JAVA PROGRAM: INCLUDE COMMENTS EXPLAINING THE CODE PLEASE Given the following information: 13-inch MacBook Air, 1.6GHz...
JAVA PROGRAM: INCLUDE COMMENTS EXPLAINING THE CODE PLEASE Given the following information: 13-inch MacBook Air, 1.6GHz dual-core Intel Core i5 processor, Turbo Boost up to 2.7GHz, Intel HD Graphics 6000, 8GB memory, 128GB PCIe-based flash storage 13-inch MacBook Air, 1.6GHz dual-core Intel Core i5 processor, Turbo Boost up to 2.7GHz, Intel HD Graphics 6000, 8GB memory, 256GB PCIe-based flash storage 15.6-inch Dell i3552, 1.6GHz Processor, Intel Pentium N3700, HD Laptop, 4 GB memory, DDR3L SDRAM, Windows 10, Black Drive 3...
Please Complete this C Code using the gcc compiler. Please include comments to explain each added...
Please Complete this C Code using the gcc compiler. Please include comments to explain each added line. /*This program computes the Intersection over Union of two rectangles as a percent: IoU = [Area(Intersection of R1 and R2) * 100 ] / [Area(R1) + Area(R2) - Area(Intersection of R1 and R2)] The answer will be specified as a percent: a number between 0 and 100. For example, if the rectangles do not overlap, IoU = 0%. If they are at the...
Language: C and comment code please PThreads The goal of this homework is to show an...
Language: C and comment code please PThreads The goal of this homework is to show an understanding of pthreads and C. Assignment: Write a C program to use the bitwise operations with each bitwise operation contained within its own thread. Each thread should take 1 parameter and will only modify global values. First, create global integers x and y, then, in the main function you will read in values for x and y from the user and then create the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT