Write a loop in assembly that converts hexadecimal numbers into UTF-8 binary sequences.
Hexadecimal numbers into UTF-8 binary sequences
This question uses the MARS MIPS simulator. The goal is to write a loop in assembly that converts hexadecimal numbers into UTF-8 binary sequences. The details are as follows:
You should copy-and-paste the file lab2.txt [which is pasted below] into the MARS editor, and then save the file as your own, for editing. Spend some time trying to see what it does. The parts that need to be changed in main are between the comment lines Your part starts here and Your part ends here. You should also add more lines to the register assignment table, to describe what you did. Additional comments will probably be helpful. There are also two character strings that need to be changed, to put your names in the output.
Here are the Mars Messages and Run I/O panels, after assembling and running the starter program:
Assemble: assembling /…/lab2.asm
Assemble: operation completed successfully.
Go: running lab2.asm
Go: execution completed successfully.
0 0x00000000 0x00000003 00000000000000000000000000000000 00000000000000000000000000000011
1 0x00000024 0x00000003 00000000000000000000000000100100 00000000000000000000000000000011
2 0x0000007e 0x00000003 00000000000000000000000001111110 00000000000000000000000000000011
3 0x0000007f 0x00000003 00000000000000000000000001111111 00000000000000000000000000000011
4 0x00000080 0x00000003 00000000000000000000000010000000 00000000000000000000000000000011
5 0x000000a2 0x00000003 00000000000000000000000010100010 00000000000000000000000000000011
6 0x00000627 0x00000003 00000000000000000000011000100111 00000000000000000000000000000011
7 0x000007ff 0x00000003 00000000000000000000011111111111 00000000000000000000000000000011
8 0x00000800 0x00000003 00000000000000000000100000000000 00000000000000000000000000000011
9 0x000020ac 0x00000003 00000000000000000010000010101100 00000000000000000000000000000011
10 0x00002233 0x00000003 00000000000000000010001000110011 00000000000000000000000000000011
11 0x0000ffff 0x00000003 00000000000000001111111111111111 00000000000000000000000000000011
12 0x00010000 0x00000003 00000000000000010000000000000000 00000000000000000000000000000011
13 0x00010348 0x00000003 00000000000000010000001101001000 00000000000000000000000000000011
14 0x00022e13 0x00000003 00000000000000100010111000010011 00000000000000000000000000000011
15 0x0010ffff 0x00000003 00000000000100001111111111111111 00000000000000000000000000000011
16 0x89abcdef 0x00000003 10001001101010111100110111101111 00000000000000000000000000000011
— program is finished running –
The idea behind UTF-8 is to augment a character code with some additional bits to protect against certain kinds of communication failures.