diff --git a/Aufgabe2_Vögele_Wörner.X68 b/Aufgabe2_Vögele_Wörner.X68 new file mode 100644 index 0000000..bbbd68e --- /dev/null +++ b/Aufgabe2_Vögele_Wörner.X68 @@ -0,0 +1,74 @@ +*----------------------------------------------------------- +* 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: ; This is where the program starts - obviously + +* Put program code here + + ; Load string address + move.l #input, A0 + move.l #output, A1 + +LOOP: + ; Load char to register + move.b (A0), D0 + + ; If end of string is reached end loop + cmp.b #0, D0 + beq LOOP_END + + ; Apply the encryption key + add.b #key, D0 + + ; Make the char lower case + move.b D0, D1 + or.b #casebit, D1 + + ; Check if char is greater than 'z' + cmp.b #z, D1 + ble WRITE_CHAR + + ; Cycle to A after Z + sub.b #alphabetLength, D0 + +WRITE_CHAR: + ; Write the encrypted char to the output string + move.b D0, (A1) + + ; Move pointers to next char + add.l #1, A0 + add.l #1, A1 + bra LOOP + +LOOP_END: + + ; Add '\0' at output string end + move.b #0, (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~