exg.s 304 B

1234567891011121314151617181920
  1. .define .exg
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! d0 : exchange size in bytes
  8. .exg:
  9. lea 4(sp, d0), a0 ! address of bottom block
  10. lea 4(sp), a1 ! address of top block
  11. asr.l #2, d0
  12. sub.l #1, d0
  13. 1:
  14. move.l (a1), d1
  15. move.l (a0), (a1)+
  16. move.l d1, (a0)+
  17. dbf d0, 1b
  18. rts
  19. .align 2