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