clipsprite16.s 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. .globl ClipSprite16
  2. .text
  3. .even
  4. ClipSprite16:
  5. movem.l %d3-%d5,-(%a7)
  6. tst.w %d1
  7. bge.s .L__cs16_1
  8. add.w %d1,%d2
  9. add.w %d1,%d1
  10. suba.w %d1,%a0
  11. moveq #0,%d1
  12. .L__cs16_1:
  13. move.w %d1,%d5
  14. add.w %d2,%d1
  15. sub.w #128,%d1
  16. ble.s .L__cs16_2
  17. sub.w %d1,%d2
  18. .L__cs16_2:
  19. mulu.w #30,%d5
  20. adda.w %d5,%a1
  21. move.w %d0,%d1
  22. not.w %d0
  23. and.w #15,%d0
  24. moveq #-1,%d4
  25. addq.w #1,%d0
  26. asr.w #4,%d1
  27. add.w %d1,%d1
  28. bge.s .L__cs16_3
  29. cmp.w #-2,%d1
  30. blt.s .L__cs16_rts
  31. clr.w %d4
  32. swap %d4
  33. .L__cs16_3:
  34. cmp.w #28,%d1
  35. blt.s .L__cs16_5
  36. beq.s .L__cs16_4
  37. .L__cs16_rts:
  38. movem.l (%a7)+,%d3-%d5
  39. rts
  40. .L__cs16_4:
  41. clr.w %d4
  42. .L__cs16_5:
  43. adda.w %d1,%a1
  44. subq.w #1,%d3
  45. moveq #0,%d5
  46. not.w %d5
  47. lsl.l %d0,%d5
  48. and.l %d4,%d5
  49. not.l %d5 |ANDing flag used in RPLC mode
  50. bra.s .L__cs16_loopentry | 2
  51. .L__cs16_AND:
  52. not.w %d1
  53. lsl.l %d0,%d1
  54. and.l %d4,%d1
  55. not.l %d1
  56. and.l %d1,(%a1)
  57. .L__cs16_loop:
  58. lea 30(%a1),%a1 | 4
  59. .L__cs16_loopentry:
  60. subq.w #1,%d2
  61. blt.s .L__cs16_rts
  62. moveq #0,%d1
  63. move.w (%a0)+,%d1
  64. cmp.w #1,%d3
  65. beq.s .L__cs16_AND
  66. lsl.l %d0,%d1
  67. and.l %d4,%d1
  68. tst.w %d3
  69. blt.s .L__cs16_XOR
  70. beq.s .L__cs16_OR
  71. |RPLC
  72. and.l %d5,(%a1)
  73. .L__cs16_OR:
  74. or.l %d1,(%a1)
  75. bra.s .L__cs16_loop
  76. .L__cs16_XOR:
  77. eor.l %d1,(%a1)
  78. bra.s .L__cs16_loop