Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function in assembly language named encrypt which takes a pointer to a b

ID: 3600588 • Letter: W

Question

Write a function in assembly language named encrypt which takes a pointer to a buffer containing some cleartext, and modifies the buffer to contain the encrypted version of that text. The encryption scheme is to add a (wrap-around) displacement n to each alphabetic 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 AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789 Hello, my boots are layered like an onion. !@#$%^&*()_-+={}[]| <>,.?/~‘;:"’ and assuming for example n = 13, the result should be 1 NnOoPpQqRrSsTtUuVvWwXxYyZzAaBbCcDdEeFfGgHhIiJjKkLlMm 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 being 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.

Explanation / Answer

MARIE doesn't seem to support characters in its assmebler language. Instead, you must enter the ASCII character codes as integers. As an example, see this excerpt from this reference guide:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote