cmi.s 479 B

1234567891011121314151617181920212223242526272829
  1. .define .cmi
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. ! on entry d0: # bytes in 1 block
  8. ! on exit d0: result
  9. .cmi:
  10. move.l (sp)+, d1 ! return address
  11. move.l sp, a0 ! address of top block
  12. lea (sp,d0.l), a1 ! address of lower block
  13. move.l d1,-(sp)
  14. move.l d0, d1
  15. asr.l #2, d0
  16. 1:
  17. cmp.l (a0)+, (a1)+
  18. bne 2f
  19. sub.l #1, d0
  20. bne 1b
  21. 2:
  22. bge 3f
  23. neg.l d0 ! less
  24. 3:
  25. move.l (sp)+,a0
  26. lea (sp,d1.l*2), sp ! new sp; two blocks popped
  27. jmp (a0) ! return
  28. .align 2