Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AREA Unique, CODE, READONLY
- IMPORT main
- EXPORT start
- start
- LDR R1, =VALUES
- LDR R2, =COUNT
- LDR R2, [R2] ; load number of values from string COUNT
- whValues
- CMP R2, #0 ; while (count != 0)
- BEQ endWhValues ; {
- LDRB R0, [R1] ; load currentNumber
- ADD R1, R1, #4 ; address = address + 4
- LDRB R4, [R1] ; load nextNumber
- SUB R2, R2, #1 ; count = count - 1
- MOV R3, R2 ; count2 = count
- uniqueNumber
- CMP R3, #0 ; while (count2 != 0)
- BEQ whValues ; AND
- CMP R0, R4 ; while (currentNumber != nextNumber)
- BEQ notUnique ; {
- MOV R5, R1 ; copy address of values from curent pointer
- LDRB R5, [R5] ; load value at current pointer
- ADD R4, R5, #4 ; address = address + 4
- SUB R3, R3, #1 ; count2 = count2 - 1
- B uniqueNumber ; }
- endWhValues
- LDR R0, =1 ; if (unique)
- B stop ; R0 = 1
- notUnique
- LDR R0, =0 ; if (!unique)
- B stop ; R0 = 0
- stop B stop
- AREA TestData, DATA, READWRITE
- COUNT DCD 10
- VALUES DCD 5, 2, 7, 18, 4, 13, 4, 18, 8, 9, 12
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement