Question: IN ARM CORTEX M3 ASSEMBLY LANGUAGE 2. (10 marks) Write a function in assembly language named encrypt which takes a pointer to a buffer containing

IN ARM CORTEX M3 ASSEMBLY LANGUAGE
2. (10 marks) Write a function in assembly language named encrypt which takes a pointer to a buffer containing some cleartext, and modifies the buffer to con- tain the encrypted version of that text The encryption scheme is to add a (wrap-around) displacement n to each al phabetic char where the letters of the alphabet are numbered A-1, B-2, etc. The same encoding is used for lower-case letters: a-1, b-2, etc. For example given the clear text 0123456789 Hello, my boots are layered like an onion and assuming for examplen- 13, the result should be 0123456789 Uryyb, zl obbgf ner ynlrerq yvxr na bavba Note that only the alphabetic characters have changed, case has been preserved, and each alphabetic character has been displaced by 13, for instance a Z be- ing character 26 becomes M (character 13), and a b (character 2) becomes o (character 15) Your code should accept any n from 0 to 25. Of course 0 means no change. If a value larger than 25 is provided, your program should replace the contents of the buffer with the string: XXxxx...XXX The buffer pointer must be stored in R4 while the buffer size and rotate amount must be encoded in R3 as follows: size of the buffer must be stored in the bits 14:0 of R3, while the value of n must be stored in bits 19:15 of R3 2. (10 marks) Write a function in assembly language named encrypt which takes a pointer to a buffer containing some cleartext, and modifies the buffer to con- tain the encrypted version of that text The encryption scheme is to add a (wrap-around) displacement n to each al phabetic char where the letters of the alphabet are numbered A-1, B-2, etc. The same encoding is used for lower-case letters: a-1, b-2, etc. For example given the clear text 0123456789 Hello, my boots are layered like an onion and assuming for examplen- 13, the result should be 0123456789 Uryyb, zl obbgf ner ynlrerq yvxr na bavba Note that only the alphabetic characters have changed, case has been preserved, and each alphabetic character has been displaced by 13, for instance a Z be- ing character 26 becomes M (character 13), and a b (character 2) becomes o (character 15) Your code should accept any n from 0 to 25. Of course 0 means no change. If a value larger than 25 is provided, your program should replace the contents of the buffer with the string: XXxxx...XXX The buffer pointer must be stored in R4 while the buffer size and rotate amount must be encoded in R3 as follows: size of the buffer must be stored in the bits 14:0 of R3, while the value of n must be stored in bits 19:15 of R3
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
