From 0cfd8a82ed7b3079dafa6b8cb7f0d61da1682c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20V=C3=B6gele?= Date: Tue, 23 Jun 2015 13:51:13 +0200 Subject: [PATCH] Me too! Me three! --- Aufgabe4_Vögele_Wörner.X68 | 52 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 Aufgabe4_Vögele_Wörner.X68 diff --git a/Aufgabe4_Vögele_Wörner.X68 b/Aufgabe4_Vögele_Wörner.X68 new file mode 100644 index 0000000..5bbf30d --- /dev/null +++ b/Aufgabe4_Vögele_Wörner.X68 @@ -0,0 +1,52 @@ +*----------------------------------------------------------- +* Title : Prime number calculator +* Written by : Manuel Voegele and Simon Woerner +* Date : 2015-06-23 +* Description: Calculates the prime numbers from 3 to 100 +*----------------------------------------------------------- + ORG $3000 +START: ; first instruction of program + +* Put program code here + + move.w #n_start, D0 + move.l #list, A0 + +LOOP_CHECK_PRIME: + move.w #2, D1 + +LOOP_CHECK_NUMBER: + move.w D0, D2 + divu D1, D2 + clr.w D2 + swap D2 + cmp.w #0, D2 + beq LOOP_FOOT_NEXT_PRIME + add.w #1, D1 + move.w D1, D2 + mulu D2, D2 + cmp.w D0, D2 + ble LOOP_CHECK_NUMBER + + move.w D0, (A0)+ + +LOOP_FOOT_NEXT_PRIME: + add.w #1, D0 + cmp #n_end, D0 + ble LOOP_CHECK_PRIME + + SIMHALT ; halt simulator + +* Put variables and constants here + +n_start EQU 3 +n_end EQU 100 + +list ds.w 100 + + END START ; last line of source + +*~Font name~Courier New~ +*~Font size~10~ +*~Tab type~1~ +*~Tab size~4~