Question: Write a program using MIPS assembly language to do the following The compression function implements the RLE algorithm and stores the compressed data in the

Write a program using MIPS assembly language to do the following

The compression function implements the RLE algorithm and stores the compressed data in the heap. Before the function call, set $a0 to the address of the input buffer (read in from a file), set $a1 to the address of the compression buffer, set $a2 to the size of the original file. The function should “return” the size of the compressed data in $v0.

The print function will repeat characters as indicated in the compressed file. For example, if the compressed file is ‘A2B3C1’ it will print ‘AABBBC’.

The uncompression function does the reverse of the compression function, saving the result to an uncompressed buffer in static memory.

EXAMPLE INPUT/OUTPUT


Please enter the filename to compress or <enter> to exit: hello_art.txt Original data: 1Y V-VIII A / -<>) WIII (>7 IV Nii



Please enter the filename to compress or to exit: hello_art.txt Original data: Delle Werld'! Y ) | V Compressed data: 2_3 1_3 9.1 2 2.1 2 12_2 6_2 12.1 2 7.1 3.1 1.1 1 1/1 3|1 3\1 3_4 1|1 2|1 1|1 2|1 3_4 3/1 2\1 4/1 2\1_11|1 2|1 4_2|1 1_1/1|1 1|1 1/1 4-1 4\1_1/1 1_2 1\1|1 2|1 1|1 2|1 2/1 2_1 1\1 2\1 3\1/1\1/1 3/1 2_1 1\1_1 2_2 1\1 2|1 3/1 1_2 1|1 1 1\1 4Y1 4/1\1 2 3/1|1 2|1 1|1 2|1_1(1 2 1 1)1 2\1 8(1 2 1 1)1 2|1 1\1/1 2|1_2/1 1/1_1/1 1|1 2\1 1 1\1_3|1_1 2/1 2\1_3 2>1_4/1_4/1\1_4/1 4\1_2/1\1 2/1 1\1_4/1|1_2|1 2|1_4/1\1_4 1|1 2_2 1 7\1/1 7\1/1 26\1/1 25\1/1 2\1/1 Uncompressed data: Dello Werld! Y ) |V Original file size: 467 Compressed file size: 462 Please enter the filename to compress or to exit: hello.txt Original data: hello Compressed data: hlel1201 Uncompressed data: hello Original file size: 5 Compressed file size: 8 Please enter the filename to compress or to exit: program is finished running --

Step by Step Solution

3.45 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Working code implemented in MIPS Assembly and comments for better understanding Here I am attaching these 2 files mainasm macrosasm Code for mainasm RLE CompressionDecompresseion include macrosasm eqv ... View full answer

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 Accounting Questions!