Difference between revisions of "Assembly Language Division"
Line 1: | Line 1: | ||
− | + | 1 INP R0,2 | |
− | + | 2 INP R1,2 | |
− | + | 3 MOV R2,#0 | |
− | LOOP: SUB R0,R0,R1 | + | 4 LOOP:SUB R0,R0,R1 |
− | + | 5 ADD R2,R2,#1 | |
− | + | 6 CMP R0,#0 | |
− | + | 7 BGT LOOP | |
− | + | 8 BEQ END | |
− | + | 9 SUB R2,R2,#1 | |
− | END: | + | 10 END:OUT R2,4 |
− | + | 11 HALT |
Revision as of 09:03, 14 January 2019
1 INP R0,2 2 INP R1,2 3 MOV R2,#0 4 LOOP:SUB R0,R0,R1 5 ADD R2,R2,#1 6 CMP R0,#0 7 BGT LOOP 8 BEQ END 9 SUB R2,R2,#1 10 END:OUT R2,4 11 HALT