Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. .pos 0x1000
  2. ld $s, r0 #r0 = &s - load s into r0
  3. ld (r0), r0 #r0 = value of r0 - load value of s into r0
  4. ld (r0), r1 #r1 = value of r0 - load value of s into r1
  5. ld 4(r0), r2 #r2 = r0+4 - load value of s + 4 into r2
  6. ld 4(r1), r3 #r3 = r1 + 4 - load value s+ 4 into r3
  7. st r3, (r2) #m[r2] = r3 - store contents of r3 into memory r2
  8. ld 4(r2), r3 #r3 = r2 + 4 - load value of s +4 +4 into r3
  9. st r3, (r1) #m[r1] = r3 - store contents of r1 into memory r3
  10. halt
  11.  
  12. .pos 0x2000
  13. s: .long d0
  14. # END OF STATIC ALLOCATION
  15.  
  16. # DYNAMICALLY ALLOCATED HEAP SNAPSHOT
  17. # (malloc'ed and dynamically initialized in c version)
  18. d0: .long d1
  19. .long d2
  20. d1: .long 1
  21. .long 2
  22. d2: .long 3
  23. .long 4
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement