*----------------------------------------------------------- * Title : Ceasar chipher * Written by : Manuel V?gele, Simon W?rner (Team 1) * Date : 12.05.2015 * Description: This program encrypts a string using ROT3 *----------------------------------------------------------- ORG $3000 ; Start at address 3000 START: ; This is where the program starts - obviously * Put program code here ; Load string address move.l #input, A0 ; Store the address of the varialbe input into address register A0 move.l #output, A1 ; Store the address of the varialbe output into address register A1 LOOP: ; Load char to register move.b (A0), D0 ; Store the value at the address stored in address register A0 into data register D0 ; If end of string is reached end loop cmp.b #0, D0 ; Compare the constant 0 and the value in the register D0 beq LOOP_END ; Jump to label LOOP_END if the value in the register D0 == the constant 0 ; Apply the encryption key add.b #key, D0 ; Add the constant key and the value in the register D0 and store the result into data register D0 ; Make the char lower case move.b D0, D1 ; Store the value in the register D0 into data register D1 or.b #casebit, D1 ; Bitwise or the constant casebit and the value in the register D1 and store the result into data register D1 ; Check if char is greater than 'z' cmp.b #z, D1 ; Compare the constant z and the value in the register D1 ble WRITE_CHAR ; Jump to label WRITE_CHAR if the value in the register D1 <= the constant z ; Cycle to A after Z sub.b #alphabetLength, D0 ; Subtract the constant alphabetLength from the value in the register D0 and store the result into data register D0 WRITE_CHAR: ; Write the encrypted char to the output string move.b D0, (A1) ; Store the value in the register D0 into the memory at the address stored in address register A1 ; Move pointers to next char add.l #1, A0 ; Increase the address in the register A0 by 1 add.l #1, A1 ; Increase the address in the register A1 by 1 bra LOOP ; Jump to label LOOP LOOP_END: ; Add '\0' at output string end move.b #0, (A1) ; Store the constant 0 into the memory at the address stored in address register A1 SIMHALT ; halt simulator * Put variables and constants here input dc.b 'Zykluszeit',0 output ds.b 11 key EQU 3 z EQU 'z' casebit EQU $20 alphabetLength EQU 26 END START ; last line of source *~Font name~Courier New~ *~Font size~10~ *~Tab type~1~ *~Tab size~4~