Write an ASM language to find smallest number in given array?

All QuestionsCategory: Embedded SystemWrite an ASM language to find smallest number in given array?
Chetan Shidling Staff asked 5 years ago

I need code.

1 Answers
Chetan Shidling Staff answered 5 years ago

Code 01:

AREA SMALL, CODE
ENTRY
LDR R0,= 0X40000000
MOV R5, #4
LDR R2, [R0], #4
SML LDR R4, [R0], #4
CMP R2, R4
MOVCS R2, R4
SUBS R5, R5, #1
BNE SML
STOP B STOP
END

Code 02:

AREA SMALL2, CODE
ENTRY
LDRR5, = 0X40000000
MOV R0, #5
LDRB R6, [R5], #1
SML LDRB R7, [R5], #1
SUBS R8, R6, R7
MOVCS R6, R7
SUBS R0, R0, #1
BNE SML
STOP B STOP
END