Me too! Me three!
This commit is contained in:
52
Aufgabe4_Vögele_Wörner.X68
Normal file
52
Aufgabe4_Vögele_Wörner.X68
Normal file
@@ -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~
|
||||||
Reference in New Issue
Block a user