Assembly-Natural numbers division program

721 views Asked by At

I need to make a program at LC3 assembly that devides 2 natural numbers and stores the remainder at R0.In case that R1 is zero,R1 must be 0.Else R1 must be 1. My code is:

.ORIG X3000
       LD R0,DIVIDED
       LD R1,DIVIDER
       BRZ IMPOSSIBLE
       ADD R2,R2,#1   
       NOT R4,R1
       ADD R4,R4,#1  ;r4=-r1       
LOOP   ADD R3,R0,R4  ;r3=ro-r1
       BRN FINISH
       ADD R0,R3,#0   ;ro=ro-r1
       BRNZP LOOP
IMPOSSIBLE  LD R2,ZERO
            BRNZP FINISH
FINISH HALT

DIVIDED .FILL #25

DIVIDER .FILL #4
 .END

This is my first program at LC3 assembly...I am a total beginner.Could anyone explain to me why this doesn't compile?I always get a "Invalid label '#25" "error message.Thank you in advance for your help!

0

There are 0 answers