What fun is there in making sense?
This commit is contained in:
74
Aufgabe2_Vögele_Wörner.X68
Normal file
74
Aufgabe2_Vögele_Wörner.X68
Normal file
@@ -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~
|
||||
Reference in New Issue
Block a user