Search for question
Question

6.

→→→

105

= CS2323-01 > Assignments > Bit count

Bit count

2023 Fall Full Term

Home

Announcements

Grades

People

Panopto Video

Zoom

SoC Tools

Due Tuesday by 11:59pm Points 50

Bit count

The goal of this assignment is to understand flow control instructions in 32-bit x86 assembly language.

To simplify this assignment, a global variable is used instead of a function parameter. Create the C program below.

#include

#include

int n;

int bits():

int main(int arge, char *argv[])

(

}

if (arge 1-2)

return 0;

natoi (argv[1]);

printf("bits (d) = \d\n",n,bits());

return 0;

Create an assembly source file that computes the number of bits in the global variable n.

Additional requirements:

• Use the fewest number of instructions possible.

• Use secx and sedx registers. If you modify any other registers, you must save and restore them using the stack.

• The result (return value) should be left in the teax register.

Submit your assembly source file.

Submit

Submitting an external tool

Assembly: Choose File No file chosen

Submit

* Previous

BLO

auf

m

Next

Fig: 1