I'm trying to find all the prime factors of an inputted number. I was given the following Java code to convert to assembly.

```
String getFactors(int number) {
String answer = "";
for(int factor=2; factor <= number; factor++) {
if(number % factor == 0) {
answer += factor + "*";
number /= factor;
factor--;
}
}
return answer.substring(0, answer.length()-1);
}
```

My attempt so far:

```
D3=factor
move.w #1,D3
loop1:
add1 #1,D3
cmp.w input,factor
BHI done
divu factor,input
tst.b input
BNE loop1
add.w factor,answer
move.w answer,(A1)+
move.b #’*’,(A1)+
add.w factor,input
subq #1,factor
BRA loop1
done:
```