Professional Documents
Culture Documents
• Debug
ALIGN
AREA Data2, DATA,READWRITE
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Outer LDR R5,=List ; point to the array Use memory bank to edit the values
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration) Three values 11,22,23 are edited..
inner LDR r6, [r5], #4 ; load two consecutive data from memory
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Outer LDR R5,=List ; point to the array Use memory bank to edit the values
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration) Three values 11,22,23 are edited..
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
inner LDR r6, [r5], #4 ; load two consecutive data from memory
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Outer LDR R5,=List ; point to the array Use memory bank to edit the values
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration) Three values 11,22,23 are edited..
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Use memory bank to edit the values
Outer LDR R5,=List ; point to the array Three values 11,22,23 are edited..
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration)
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Use memory bank to edit the values
Outer LDR R5,=List ; point to the array Three values 11,22,23 are edited..
MOV r2, r1; setup inner loop ( number of comparisons in each iteration)
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Use memory bank to edit the values
Outer LDR R5,=List ; point to the array Three values 11,22,23 are edited..
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration)
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Use memory bank to edit the values
Outer LDR R5,=List ; point to the array Three values 11,22,23 are edited..
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration)
inner LDR r6, [r5], #4 ; load two consecutive data from memory
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending
Skip SUBS r2, r2, #1 ; decrement number comparison remaining
BNE inner ; repeat if not 0
SUBS r1, r1, #1 ; update number of iteration remaining
BNE outer ; repeat again if not over
STOP B STOP
END
AREA Data1, READONLY
N DCD 03 ; total numbers to be sorted (here for descending order)
ALIGN
AREA Data2, DATA,READWRITE
List DCD 0x0011,0x0022,0x0033
AREA SORT, CODE, READONLY
ENTRY
LDR R0,=N ; setup the counter
LDR R1,[R0] Use memory bank to see the values
SUB r1, r1, #1 ; Outer loop counter ( n-1 iteration)
Use memory bank to edit the values
Outer LDR R5,=List ; point to the array Three values 11,22,23 are edited..
MOV r2, r1 ; setup inner loop ( number of comparisons in each iteration)
inner LDR r6, [r5], #4 ; load two consecutive data from memory
LDR r7, [r5]
CMP r6, r7 ; compare them
BGE Skip ; If first number is lesser than second then swap (BLE for ascending )
STR R6, [R5] ; swap by loading Smaller data ( R6 ) current
STR R7, [R5, #-4] ; and Bigger to previous location- to get in descending