Nios/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 4 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
    movia sp, 0x04000000
4
    movia r4, 0x20000
5
    movi r5, 3
6
    movi r6, 4
7
    movi r7, 5
8
    call pack3
9
    1: br 1b  # done
10
11
.global pack3
12
pack3:
13
    
14
    
Upload a source file...