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

This program need to write in Assembly language, Can someone help me on this pro

ID: 3790318 • Letter: T

Question

This program need to write in Assembly language, Can someone help me on this problem?

Part 1:           

1) Write a single statement that computes the product , i is an integer.

Specifications:

a) Place the results in a register of the appropriate size, remember to consider efficient use of available resources.

b) To compute the product, you must use one or more constant expressions that computes the value. No loops or use of anything beyond Chapter 3 in the book should be used.

c) The register must be zeroed out before the result is stored.

Part 2:

1) Write a short block of computational statements that causes the BX register to overflow.

2) Write a short block of computational statements that causes the CX register to set the carry flag.

Specifications:

a)   Use variables as opposed to immediate values.

b)   Make sure no other computations affect the outcome of this register.

c)   The register must be zeroed out before it is used.

Part 3:

Using directives for creating symbolics, write a single statement that computes the number of seconds in a day.

Specifications:

a) Place the result in the EDX register.

b) The statement that is placed in the program and expanded should be SECONDS_IN_DAY.

c) The EDX register should be zeroed out before it is used.

d) Make sure the statement uses the symbolics to the fullest extent; that is, SECONDS_IN_DAY should be the only expression on the instruction line.

Additional information:

A program template is provided below.

DO NOT COPY PASTE THE TEMPLATE! You must type it.

TITLE pa2.asm

; Header comment block as shown in lecture notes

INCLUDE Irvine32.inc

.data

{ your variables should be defined here}

.data?

{used as necessary}

.code     

main PROC         

{executable code here}

call DumpRegs  

exit

main ENDP               ; end of main procedure

END main                   ; end of source code

Explanation / Answer

//to compute multiplication of 2 numbers


section   .text
   global _start    ;must be declared for using gcc
  
_start:             ;tell linker entry point

   mov   eax,'3'
   sub     eax, '0'
  
   mov    ebx, '4'
   sub     ebx, '0'
   mul    ebx
   add   eax, '0'
  
   mov    [res], eax
   mov   ecx,msg  
   mov   edx, len
   mov   ebx,1   ;file descriptor (stdout)
   mov   eax,4   ;system call number (sys_write)
   int   0x80   ;call kernel
  
   mov   ecx,res
   mov   edx, 1
   mov   ebx,1   ;file descriptor (stdout)
   mov   eax,4   ;system call number (sys_write)
   int   0x80   ;call kernel
  
   mov   eax,1   ;system call number (sys_exit)
   int   0x80   ;call kernel

end

section .data
msg db "The result is:", 0xA,0xD
len equ $- msg
segment .bss
res resb 1

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