Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- num: .word 0xabcdeff, 0x11223344, 0xaabbccdd, 0x12345678,0x12345678, 0x11aa22bb
- .text
- la x1, num
- li x4, 5
- addi x3, x0, 0
- rpt:
- lw x2, 0(x1)
- add x3, x3, x2
- addi x1, x1, 4
- addi x4, x4, -1
- bne x4, x0, rpt
- sw x3, 4(x1)
- nop
- ===================================================
- .data
- num: .half 0xabcd, 0xeeff, 0x1122, 0x3344, 0xaabb, 0xccdd, 0x1234, 0x5678, 0x11aa, 0x22bb
- .text
- la x1, num
- li x4, 5
- addi x4, x4, -1
- rpt:
- lhu x2, 0(x1)
- add x3, x3, x2
- addi x1, x1, 4
- addi x4, x4, -1
- bne x4, x0, rpt
- sw x3, 4(x1)
- nop
- ===================================================
- .data
- num: .byte 0xab, 0xcd, 0xee, 0xff, 0x11, 0x22, 0x33, 0x44, 0xaa, 0xbb, 0xcc, 0xdd, 0x12, 0x34, 0x56, 0x78, 0x11, 0xaa, 0x22, 0xbb
- .text
- la x1, num
- li x4, 5
- addi x3, x0, 0
- rpt:
- lbu x2, 0(x1)
- add x3, x3, x2
- addi x1, x1, 4
- addi x4, x4, -1
- bne x4, x0, rpt
- sw x3, 4(x1)
- nop
- ===================endianness======================
- .data
- num: .word 0xabcdeeff, 0x11223344, 0xaabbccdd, 0x12345678, 0x11aa22bb
- .text
- li x4, 0x300
- li x2, 6
- la x3, num
- next: addi x7, x0, 4
- back: lbu x6, 3(x3)
- sb x6, 0(x4)
- addi x3, x3, -1
- addi x4, x4, 1
- addi x7, x7, 01
- bne x7, x0, back
- addi x3, x3, 8
- addi x2, x2, -1
- bne x2, x0, next
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement