Arm/func pack3

From ASMBits

Write a function that stores three integers into consecutive words in memory. The function should write n1, n2, and n3 (in that order, lowest to highest address) to the array starting at array. You may assume that array is properly aligned for words (4-byte aligned).

There is no return value.

void pack3 (int* array, int n1, int n2, int n3);

Expected solution length: Around 2 lines.

Sample Input

 0x20000, 3, 4, 5 

Sample Output

Writes 3 to [0x20000], 4 to [0x20004], and 5 to [0x20008] 

Write your solution here

x
 
1
.global _start
2
_start:
3
    ldr r0, =0x20000
4
    mov r1, #3
5
    mov r2, #4
6
    mov r3, #5
7
    bl pack3
8
    1: b 1b  // done
9
10
.global pack3
11
pack3:
12
    
13
    
Upload a source file...