Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question is from computer org. Please give a single complete program which compi

ID: 3890533 • Letter: Q

Question

Question is from computer org. Please give a single complete program which compiles and runs. all the requirements in the questions should be completed in a single program, not multiple ones.

Need help with this contru nom Compdo ong hhute an assembly la arithmetic operations advandbla&alled; let'= 344 rquage progrom dhds perl oms a Colculate Tne Sum ol tuo voriables lelt ard siaid ond storeln total mesage shoP contains uloRD called 'Atray thod is Deine a charader stzung called messoge thar contains the chanadrn Melo World! Deline an anrau d atatype wlo?b called 1ni intialiaed to ho llas values 1, 2,,, 32and cada to determine lerath Asho lrite assembly bagige d Store this vdue in. variahle callod 'Arrayerth Move the contents dhe varioHe lelt into the EAX Cl CX 0) rraul Call the authonis dumpReg haudioe to display contents

Explanation / Answer

; code as per ARM, first four parts only

left   DW   844; define a 16-bit variable and store 844 in it

right   DW   3150;

result   DW   ?; define an empty word for storing the sum

diff   DW   ?; this will store the difference

   MOV r0, left; move one value into register r0
  
   MOV A, right; move the other value to accumulator
  
   ADD A, r0; add the two values and store the result in accumulator
  
   MOV result, A; move the sum stored in accumulator to the defined variable result
  
   CMP left, right; compare the values left and right to find the greater number, to compute the positive difference

   JGE greaterLeft; if left is greater, jump to label greaterLeft
  
   MOV A, right; if the jump did not happen, implies right is greater than left, move right to accumulator
  
   SUB A, left; subtract left from right that was stored in A

   MOV diff, A; store the result in the variable

greaterL:
  
   MOV A, left; move the number in left to accumulator
  
   SUB A, right; subtract right from A
  
   MOV diff, A; store into the defined variable
  

message   DB   "Hello World!"; define a string

array   DW   1,2,4,8,16,32,64; defining a multi-byte datastructure


   

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote