Question: 3B. Complete save_dist_list function that saves N distances' values into a file For example, Note: the NEWLINE character (at the end of every line) is

3B. Complete save_dist_list function that saves N distances' values into a file For example, Note: the NEWLINE character (at the end of every line) is not visible. The above example shows that save_dist_list function takes 4 distances from the distance array, converts integers into ASCII characters, as a result of " 1 1 7 23" in the data_buffer, then makes syscall to write 9 characters from this string into lab3_dist.dat file. Thought before starting to code: How to convert 23 into '2', '3'? other examples, 123> '1', '2', '3'? NOTE: you can safely assume I. The distances to save are guaranteed positive/valid, e.g. N=4, the first four numbers in the array must be positive. Arguments and Given parameters: >> \$a0: the address of the string that represents the output file name, "lab3_dist.dat". >> \$a1: the base address of an integer array that stores distances >>$a2: the number of distances to save from an integer array >> data_buffer: the buffer that you use to hold data for file read/write (MAXIMUM: 300 bytes) Side Note: If you have finished part3A, you may un-comment the code block (line 233-234 in lab3_test.asm) to forward part3A result to be part3B input. Therefore, by orchestrating with part3A, part3B can save found distances, originally from a points file, lab3_pts.dat, into a distance file, lab3_dist.dat. 3B. Complete save_dist_list function that saves N distances' values into a file For example, Note: the NEWLINE character (at the end of every line) is not visible. The above example shows that save_dist_list function takes 4 distances from the distance array, converts integers into ASCII characters, as a result of " 1 1 7 23" in the data_buffer, then makes syscall to write 9 characters from this string into lab3_dist.dat file. Thought before starting to code: How to convert 23 into '2', '3'? other examples, 123> '1', '2', '3'? NOTE: you can safely assume I. The distances to save are guaranteed positive/valid, e.g. N=4, the first four numbers in the array must be positive. Arguments and Given parameters: >> \$a0: the address of the string that represents the output file name, "lab3_dist.dat". >> \$a1: the base address of an integer array that stores distances >>$a2: the number of distances to save from an integer array >> data_buffer: the buffer that you use to hold data for file read/write (MAXIMUM: 300 bytes) Side Note: If you have finished part3A, you may un-comment the code block (line 233-234 in lab3_test.asm) to forward part3A result to be part3B input. Therefore, by orchestrating with part3A, part3B can save found distances, originally from a points file, lab3_pts.dat, into a distance file, lab3_dist.dat
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
