Question: In the .bss section, the program reserves space for 20 integers, you will treat it as an integer array. First, the program checks if the

In the .bss section, the program reserves space for 20 integers, you will treat it as an integer array.

First, the program checks if the number of command line arguments is 2 (i.e. the program followed by a single argument), if not, an error message is displayed and the program terminates.

In a loop it traverses the first command line argument (i.e. argv[1]) byte by byte, and converts the digit in the byte into the corresponding number which it stores in the integer array in .bss .

While doing 3, the traversed bytes are counted. If there are more than 20, make sure that only 20 integers have been stored in the memory, an error message is issued and the program terminates.

If the array is of length up to 20, the array is displayed in a loop using print_string and print_nl and print_char subroutines with commas separating the numbers in the array.

If the program is executed with 12345678901234567890 command line argument, the array displayed should be 1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0 .

If the program is executed with 23456789012345678901 command line argument, the program should display the error message and terminate.

this is assembly language

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!