cii.s 402 B

123456789101112131415161718192021222324252627
  1. .define .cii
  2. .sect .text
  3. .sect .rom
  4. .sect .data
  5. .sect .bss
  6. .sect .text
  7. .cii:
  8. move.l (sp)+, a0 ! return address
  9. move.l (sp)+, d0 ! destination size
  10. sub.l (sp)+, d0 ! destination - source size
  11. bgt 1f
  12. sub.l d0, sp ! pop extra bytes
  13. jmp (a0)
  14. 1:
  15. clr.l d1
  16. tst.l (sp)
  17. bne 4f
  18. not.l d1 ! d1 contains sign of source
  19. 4:
  20. asr.l #2, d0
  21. sub.l #1, d0
  22. 2:
  23. move.l d1, -(sp)
  24. dbf d0, 2b
  25. jmp (a0)
  26. .align 2