Question: Write a MIPS assembly program that reads the size (n) of the message from the user. Then, the program allocates (n+1) bytes in the heap

Write a MIPS assembly program that reads the size (n) of the message from the user. Then, the program allocates (n+1) bytes in the heap. After that, read a string of n characters from the user he/she wishes to encrypt. Next, read an encrypting key (e) from the user [1, 25]. Encrypt the original string with the encryption key using the following code. Finally, print out the encrypted string. (Convert this for Caesar shift loop statements into MIPS and use it)

for (i=0; i

ch = str[i];

if (isupper(ch)){

ch = ch + e;

if (ch > 0x5A)

ch = ch - 26;

}

else if (islower(ch)){

ch = ch + e;

if (ch > 0x7A)

ch = ch - 26;

}

str[i] = ch;

}

 Sample Run:

Enter n: 11

Enter string: Hello World

Enter e: 13

Encrypted String: Uryyb Jbeyq

Write a MIPS assembly program that reads the size (n) of the

Use this table. Please attempt the answer only if you properly run and test your code as I am posting this again as the previous guy was copy-pasting wrong answers which were already put by someone else.

OHNW 00 Dec HX Oct Char Dec Hx OctHtml Chr Dec Hx Oct Html Chr Dec Hx Oct Html Chr 0 000 NUL (null) 32 20 040 Space 64 40 100 @ 96 60 140 1 001 SOH (start of heading) 33 21 041 ! 65 41 101 A 97 61 141 a 2 002 STX (start of text) 34 22 042 66 42 102 B 98 62 142 b 3 003 ETX (end of text) 35 23 043 # 67 43 103 C 99 63 143 4 4 004 EOT (end of transmission) 36 24 044 $ 68 44 104 D 100 64 144 d 5 5 005 ENQ (enquiry) 37 25 045 G#37; % 69 45 105 E 101 65 145 e 6 6 006 ACK (acknowledge) 38 26 046 & 70 46 106 F 102 66 146 f 7 7 007 BEL (bell) 39 27 047 G#39; 71 47 107 4#71; G 103 67 147 g 8 8 010 BS (backspace) 40 28 050 ( 72 48 110 H 104 68 150 h 9 9 011 TAB (horizontal tab) 41 29 051 ) 73 49 lll I 105 69 151 i 10 A 012 LF (NL line feed, new line) 42 21 052 * 74 4A 112 J 106 6A 152 j 11 B013 VT (vertical tab) 43 2B 053 + 75 4B 113 K 107 6B 153 k 12 C014 FF (NP form feed, new page) 44 2C 054 76 4C 114 G#76; L 108 6L 154 1 13 D 015 CR (carriage return) 45 2D 055 G#45; 77 40 115 M 109 6D 155 M 14 E 016 SO (shift out) 46 2E 056 646; 78 4E 116 N 110 6E 156 n 15 F 017 SI (shift in) 47 2F 057 G#47;/ 79 4F 117 #79; 0 111 6F 157 0 16 10 020 DLE (data link escape) 48 30 060 G#48; O 80 50 120 P 112 70 160 p 17 11 021 DCi (device control 1) 49 31 061 1 81 51 121 0 113 71 161 18 12 022 DC2 (device control 2) 50 32 062 &50; 2 82 52 122 R 114 72 162 r 19 13 023 DC3 (device control 3) 51 33 063 3 83 53 123 S 115 73 163 3 20 14 024 DC4 (device control 4) 52 34 064 4 84 54 124 T 116 74 164 t 21 15 025 NAK (negative acknowledge) 53 35 065 5 85 55 125 U |117 75 165 #117; u 22 16 026 SYN (synchronous idle) 54 36 066 G#54; 6 86 56 126 V 118 76 166 V 23 17 027 ETB (end of trans. block) 55 37 067 6#55; 7 87 57 127 W 119 77 167 W 24 18 030 CAN (cancel) 56 38 070 G#56; 8 88 58 130 X 120 78 170 X 25 19 031 EM (end of medium) 57 39 071 9 89 59 131 Y 121 79 171 Y 26 1A 032 SUB (substitute) 58 3A 072 : 90 5A 132 Z 122 71 172 Z 27 1B 033 ESC (escape) 59 3B 073 ; 91 5B 133 [ 123 7B 173 6#123; { 28 IC 034 FS (file separator) 60 3C 074 92 5C 134 124 7C 174 29 1D 035 GS (group separat 61 3D 075 = 93 5D 135 ) 125 7D 175 30 LE 036 RS (record separator) 62 3E 076 > 94 5E 136 A 126 7E 176 31 1F 037 US (unit separator) 63 3F 077 ? 95 5F 137 127 7F 177 G#127; DEL Source: www.Lookup Tables.com OHNW 00 Dec HX Oct Char Dec Hx OctHtml Chr Dec Hx Oct Html Chr Dec Hx Oct Html Chr 0 000 NUL (null) 32 20 040 Space 64 40 100 @ 96 60 140 1 001 SOH (start of heading) 33 21 041 ! 65 41 101 A 97 61 141 a 2 002 STX (start of text) 34 22 042 66 42 102 B 98 62 142 b 3 003 ETX (end of text) 35 23 043 # 67 43 103 C 99 63 143 4 4 004 EOT (end of transmission) 36 24 044 $ 68 44 104 D 100 64 144 d 5 5 005 ENQ (enquiry) 37 25 045 G#37; % 69 45 105 E 101 65 145 e 6 6 006 ACK (acknowledge) 38 26 046 & 70 46 106 F 102 66 146 f 7 7 007 BEL (bell) 39 27 047 G#39; 71 47 107 4#71; G 103 67 147 g 8 8 010 BS (backspace) 40 28 050 ( 72 48 110 H 104 68 150 h 9 9 011 TAB (horizontal tab) 41 29 051 ) 73 49 lll I 105 69 151 i 10 A 012 LF (NL line feed, new line) 42 21 052 * 74 4A 112 J 106 6A 152 j 11 B013 VT (vertical tab) 43 2B 053 + 75 4B 113 K 107 6B 153 k 12 C014 FF (NP form feed, new page) 44 2C 054 76 4C 114 G#76; L 108 6L 154 1 13 D 015 CR (carriage return) 45 2D 055 G#45; 77 40 115 M 109 6D 155 M 14 E 016 SO (shift out) 46 2E 056 646; 78 4E 116 N 110 6E 156 n 15 F 017 SI (shift in) 47 2F 057 G#47;/ 79 4F 117 #79; 0 111 6F 157 0 16 10 020 DLE (data link escape) 48 30 060 G#48; O 80 50 120 P 112 70 160 p 17 11 021 DCi (device control 1) 49 31 061 1 81 51 121 0 113 71 161 18 12 022 DC2 (device control 2) 50 32 062 &50; 2 82 52 122 R 114 72 162 r 19 13 023 DC3 (device control 3) 51 33 063 3 83 53 123 S 115 73 163 3 20 14 024 DC4 (device control 4) 52 34 064 4 84 54 124 T 116 74 164 t 21 15 025 NAK (negative acknowledge) 53 35 065 5 85 55 125 U |117 75 165 #117; u 22 16 026 SYN (synchronous idle) 54 36 066 G#54; 6 86 56 126 V 118 76 166 V 23 17 027 ETB (end of trans. block) 55 37 067 6#55; 7 87 57 127 W 119 77 167 W 24 18 030 CAN (cancel) 56 38 070 G#56; 8 88 58 130 X 120 78 170 X 25 19 031 EM (end of medium) 57 39 071 9 89 59 131 Y 121 79 171 Y 26 1A 032 SUB (substitute) 58 3A 072 : 90 5A 132 Z 122 71 172 Z 27 1B 033 ESC (escape) 59 3B 073 ; 91 5B 133 [ 123 7B 173 6#123; { 28 IC 034 FS (file separator) 60 3C 074 92 5C 134 124 7C 174 29 1D 035 GS (group separat 61 3D 075 = 93 5D 135 ) 125 7D 175 30 LE 036 RS (record separator) 62 3E 076 > 94 5E 136 A 126 7E 176 31 1F 037 US (unit separator) 63 3F 077 ? 95 5F 137 127 7F 177 G#127; DEL Source: www.Lookup Tables.com

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!