Files
rear/Aufgabe3_Vögele_Wörner.X68
2015-06-09 15:51:35 +02:00

64 lines
1.2 KiB
Plaintext

*-----------------------------------------------------------
* Title : prime factorization
* Written by : Manuel Voegele and Simon Woerner
* Date : 2015-06-09
* Description: RTFT
*-----------------------------------------------------------
ORG $3000
* Put program code here
FACTORIZATION:
move.l #2, D2
FACTORIZATION_LOOP:
move.l D0, D3
divu D2, D0
swap D0
cmp.w #0, D0
beq FACTOR_FOUND
add.w #1, D2
move.l D3, D0
bra FACTORIZATION_LOOP
FACTOR_FOUND:
swap D0
move.w D2, (A1)+
cmp.w #1, D0
bgt FACTORIZATION_LOOP
rts
START: ; first instruction of program
move.l #numbers, A0
move.l #liste, A1
move.l #anzahl, D1
LOOP:
move.w (A0)+, D0
bsr FACTORIZATION
sub.l #1, D1
cmp.l #0, D1
bgt LOOP
SIMHALT ; halt simulator
* Put variables and constants here
numbers dc.w 42,6930,997
anzahl EQU 3
liste ds.w 20
END START ; last line of source
*~Font name~Courier New~
*~Font size~10~
*~Tab type~1~
*~Tab size~4~