- .begin
- .org 2048
- mov %r0, %r20 ! %r20 = memory offset
- mov %r0, %r21 ! %r21 = SUM
- AddThree:
- ld [ INPUT + %r20 ], %r10
- add %r10, %r21, %r21
- subcc %r10, 0, %r0
- add %r20, 4, %r20
- add %r22, 1, %r22
- cmp %r22, 3
- bne AddThree
- call StoreResult
- StoreResult:
- mov %r21, %r4
- st %r4, [OUTPUT]
- mov %r0, %r21
- mov %r0, %r22
- cmp %r4, 0
- bne Restart
- halt
- Restart:
- !ld [INPUT], %r10
- call AddThree
- halt
- INPUT: 10
- 10
- 10
- 20
- 20
- 20
- 30
- 30
- 30
- 40
- 40
- 40
- 0
- 0
- 0
- OUTPUT:
- END:
- .end
ASM adding stuff
By: BlakeH | Date: Jun 27 2009 01:51 | Format: None | Expires: never | Size: 665 B | Hits: 1066
Latest pastes
15 hours ago
16 hours ago
1 days ago
2 days ago
4 days ago