From e01a982e228142db7231a543d807e784b12ce0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 28 Apr 2015 14:16:57 +0000 Subject: [PATCH] Fine. I'm guilty. I wear eyelashes. Oh and i took a bite of the cake. --- Aufgabe1.X68 | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Aufgabe1.X68 diff --git a/Aufgabe1.X68 b/Aufgabe1.X68 new file mode 100644 index 0000000..a78bc0f --- /dev/null +++ b/Aufgabe1.X68 @@ -0,0 +1,68 @@ +*----------------------------------------------------------- +* Title : Wat?! +* Written by : Me and that other guy +* Date : Today +* Description: Dunno +*----------------------------------------------------------- + ORG $1000 +START: ; This is where the program starts - obviously + +* Put program code here + + ; Clear variables + clr.l Sum + + ; Load string address + move.l #String1, A0 + move.l #String2, A1 + move.l #String3, A2 + +LOOP: + ; Load chars to register + move.b (A0), D0 + move.b (A1), D1 + + ; If end of string is reached end loop + cmp.b #0, D0 + beq LOOP_END + + ; If String2[i] <= String1[i] jump to ADD_STRING2 + cmp.b D0, D1 + ble ADD_STRING2 + +; Add lower char to Sum +ADD_STRING1: + add.l D0, Sum + move.b D0, (A2) + bra LOOP_FOOTER +ADD_STRING2: + add.l D1, Sum + move.b D1, (A2) + +; Move to next char +LOOP_FOOTER: + add.l #1, A0 + add.l #1, A1 + add.l #1, A2 + bra LOOP + +LOOP_END: + ; Add '\0' + move.b #0, (A2) + + SIMHALT ; halt simulator + +* Put variables and constants here + +String1 dc.b 'Studierender',0 +String2 dc.b 'Informatiker',0 +String3 ds.b 13 +Sum ds.l 1 + + END START ; last line of source + + +*~Font name~Courier New~ +*~Font size~10~ +*~Tab type~1~ +*~Tab size~4~