- .begin
- .org 2048
- mov %r0, %r20 ! %r20 = memory offset
- mov %r0, %r21 ! %r21 = SUM
- AddThree:
- ld [ INPUT + %r20 ], %r10 ! loading the list and placing it in register 10
- add %r10, %r21, %r21 ! moving it around
- subcc %r10, 0, %r0 ! conditional subtraction
- add %r20, 4, %r20 ! not sure why this needs to happen
- add %r22, 1, %r22 ! this is my counter :)
- cmp %r22, 3 ! if its not true then move on
- bne AddThree ! NOT ZERO Branch
- StoreResult:
- mov %r21, %r4 ! moving the answer to store it
- st %r4, [OUTPUT] ! storing in the location OUTPUT
- mov %r0, %r21 ! Resetting things
- mov %r0, %r22 ! Resetting the counter
- halt
- INPUT: 10
- 10
- 10
- 20
- 20
- 20
- 30
- 30
- 30
- 40
- 40
- 40
- 0
- 0
- 0
- OUTPUT:
- END:
- .end
AHHHH
By: microhaxo | Date: Jun 26 2009 23:45 | Format: None | Expires: never | Size: 890 B | Hits: 919
Latest pastes
1 hours ago
11 hours ago
1 days ago
2 days ago
2 days ago