Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 2 ; Write code to take the sum of all the elements of array1 and array2. ; Print the sum. 4 j ; Recommendation:

image text in transcribed

1 2 ; Write code to take the sum of all the elements of array1 and array2. ; Print the sum. 4 j ; Recommendation: First print off all the values so you know you are retrieving them correctly. 5 6 3 7 ; nasm-felf64 lab02.asm && gcc -no-pie - FPIC lab02.0 && ./a.out 8 BITS 64; 19 11 global main 12 extern printf 13 14 section .text 15 main: 16 push rbx ; This is called by the C library startup code ; required to make printf 16-byte aligned. ; For now we only do this once! 17 18 19 mov 20 mov 21 movsX rdi, iformat rax, (array2 + 0] rsi, al rax, rax printf ; set 1st parameter (format) ; load rax to beginning of array ; set 2nd parameter (low byte) ; because printf is varargs we must clear rax ; printf(format, current_number) 22 xor 23 call 24 25 pop rbx must restore rbx for Linux ; Return from main back into C library wrapper 26 ret iformat: 27 28 db "Sum is %ld", 10, 0 29 array1: 30 dw 0, 1, 1024, -1, 31 array2: 32 db 0, 1, -55, -100

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

What is Real property, also called real estate?

Answered: 1 week ago

Question

How do books become world of wonder?

Answered: 1 week ago

Question

2. How were various roles filled?

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago