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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started