Question
Calculate Checksums Write a MIPS/MARS program that will ... Take strings as input and calculate + print a simple checksum for each string. Make the
Calculate Checksums
Write a MIPS/MARS program that will ...
Take strings as input and calculate + print a simple checksum for each string.
Make the string long enough to hold 50 characters.
Also, leave space for the null byte.
If the checksum is transmitted/stored with the block of data, then it can be compared with a recalculated checksum to determine whether an error has occurred.
The checksum algorithm will produce a value which can print with the syscall for printing a character.
Stop reading strings when the user enters ".".
The syscall to read a string (syscall code 8) adds a newline to the string (before the null byte) if the string is shorter than the maximum length specified.
If there is a newline in the string that read and replace it with a null byte. Do not use the newline when calculating the checksum.
To calculate our checksum, add up the ASCII codes for the characters in the string, then find the remainder after dividing by 64.
Finally, add the ASCII code for blank to the remainder. This gives the checksum.
Please include comments, Thank You
Sample Output
Enter a string (. to end): Error Correction! The checksum is: C Enter a string (. to end): Java C C++ The checksum is: > Enter a string (. to end): UNIX Linux The checksum is: T Enter a string (. to end): macOS 10.12.2 The checksum is: % Enter a string (. to end): .
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