Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

There are a total two questions and you have 2 hours to attempt them. Do read both the questions before attempting. Try not to spend

There are a total two questions and you have 2 hours to attempt them.

Do read both the questions before attempting.

Try not to spend all your time trying to solve one question. Please bear in the mind that your calculated value for both programs should be in rax register.

Youve probably heard of factorial of a number. The factorial of the number 6 is 1x2x3x4x5x6 or 6x5x4x3x2x1. In this problem we are going to change is method slightly to our need. In odd factorial, we would multiply just the odd numbers. For example, the odd factorial of 5 would be 1x3x5. Odd factorial of 6 would be 1x3x5 too. Write an assembly program to calculate the odd factorial of a given number stored in a Data Section variable [var1] and store the final value it into rax.

Use double-word multiplication statement for this problem. Below is a template you can use to write your code

; template program

EXIT_SUCCESS equ 0

SYS_exit equ 60

var1 dd 7 ; odd factorial to be calculated

section .text

global _start

_start:

mov rcx, dword [var1] ;

_bye:

mov rax, SYS_exit

mov rdi, EXIT_SUCCESS

syscall

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

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

=+2 Why are so many countries bothered by their brain drains?

Answered: 1 week ago