Difference between revisions of "Assembly Language Division"
(Created page with " INP R0,2 INP R1,2 MOV R2,#0 MOV R3,#1 LOOP: SUB R0,R0,R1 ADD R2,R2,R3 CMP R0,#0 BGT LOOP BEQ END SUB R2,R2,R3...") |
|||
Line 2: | Line 2: | ||
INP R1,2 | INP R1,2 | ||
MOV R2,#0 | MOV R2,#0 | ||
− | |||
LOOP: SUB R0,R0,R1 | LOOP: SUB R0,R0,R1 | ||
− | ADD R2,R2, | + | ADD R2,R2,#1 |
CMP R0,#0 | CMP R0,#0 | ||
BGT LOOP | BGT LOOP | ||
BEQ END | BEQ END | ||
− | SUB R2,R2, | + | SUB R2,R2,#1 |
END: OUT R2,4 | END: OUT R2,4 | ||
HALT | HALT |
Revision as of 08:17, 14 January 2019
INP R0,2 INP R1,2 MOV R2,#0 LOOP: SUB R0,R0,R1 ADD R2,R2,#1 CMP R0,#0 BGT LOOP BEQ END SUB R2,R2,#1 END: OUT R2,4 HALT