ECE 471 LAB 1 FALL 2008 EXERCISE: Write a program which will perform Caesar shift encryption and decryption on a block of text in memory. A Caesar shift cypher will encrypt simply by adding the shift value (a constant) to each character, wrapping around so "A" follows "Z". For example a shift of "1" will turn "A" into "B", "B" into "C", and "Z" into "A", etc., while a shift of "2" will turn "A" into "C", "B" into "D", and "Z" into "B", etc. For decryption, simply subtract the shift value. Traditionally a letter rather than a number is used for the "key"; "A" is used for a shift value of "0", "B" is used for a shift value of "1", etc. A simple data structure will immediately follow your program. The first word (2 bytes) of this structure will be a "source pointer" to the start of a block of memory containing the original text. The second word will be a count of the number of bytes to be encrypted. Next will be a two byte "destination pointer" to where in memory the result should be placed. The next byte is the key in the form of an ASCII letter ("A" for a shift of "0", "B" for a shift of 1, etc.). Finally, the byte after this will be used as a flag to indicate whether encryption or decryption is desired. Your code will assume these values have been set up prior to running. These data values should not change as your program executes. If you want something to change, copy it to a scratchpad location. Your program will maintain the case of each letter (encrypt capital letters as capitals, and lower case letters as lower case letters). If a character is not a letter, then it will not be changed. The encrypted result will be placed in memory beginning at the location pointed to by the destination pointer. It is possible the source and destination pointers are the same, so the original text is replaced with the encrypted text. Your software should not make any assumptions about the location of the source or destination, the block size, shift value, etc.; rather, it should look at the data structure to find out. You may also want to reserve other storage; e.g., for a temporary scratchpad. NOTES: 1. All code should be written before coming to lab. We will check for this at the start of lab. Org your code at $8800 and place a SWI instruction at the end of your code to return to BUFFALO. 2. Your code should use labels where ever possible. 3. For testing, you can enter a test message using the "fcc" (form constant character string) assembler directive. 4. Use the assembler to set everything up - just download your code (with data values) and run. Use BUFFALO to check the results. However your code should not make assumptions about where things are located. You should be able to use BUFFALO to change the location of the source and destination strings and try again without reassembling/downloading. 5. Your lab notebook should contain this lab sheet, a flowchart or pseudo code of your implementation, a "sketch" of the algorithm (showing the memory blocks & where pointers are pointing) as it is in progress, and a listing file. 6. The following links have information on using our boards. http://www.eece.maine.edu/~eason/ece471/readme.pdf http://www.eece.maine.edu/~eason/ece471/getting_started.pdf http://www.eece.maine.edu/~eason/ece471/manual.pdf