Write an ASM language for division using repeated subtraction?

All QuestionsCategory: Embedded SystemWrite an ASM language for division using repeated subtraction?
Chetan Shidling Staff asked 5 years ago

i need code.

1 Answers
Chetan Shidling Staff answered 5 years ago

Code:

AREA A0, CODE
ENTRY
MOV R5, #15
MOV R6, #3
CMP R6, #0
BEQ EN
CMP R6, R5
MOVPL R6, #1
BPL EN
DIV SUB R7, R5, R6
ADD R1, R1, #1
CMP R7, R6
MOVPL R5, R7
BPL DIV
EN
STOP B STOP
END