bigtile.z80 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. ;===========================================================
  2. bigtile:
  3. ;===========================================================
  4. ;Inputs:
  5. ; A is the method:
  6. ; 0=Overwrite
  7. ; 1=AND
  8. ; 2=XOR
  9. ; 3=OR
  10. ; 4=Swap
  11. ; 5=Erase
  12. ; 6=Mask
  13. ; 7=Gray
  14. ; B is the width (in bytes)
  15. ; C is the height (in pixels)
  16. ; DE points to the sprite data
  17. ; HL points to the output location
  18. ;Outputs:
  19. ; HL is A*12 larger (next sprite down?)
  20. ; DE points to the next byte after the sprite data
  21. ; A is 0
  22. ; B is not changed
  23. ; C is 12-B
  24. ;===========================================================
  25. push af
  26. ld a,c
  27. di
  28. ex af,af'
  29. ld a,12
  30. sub b
  31. ld c,a
  32. pop af
  33. OverwriteXxY:
  34. or a
  35. jr nz,ANDXxY
  36. ex af,af'
  37. _:
  38. ex de,hl
  39. push bc
  40. ldi
  41. inc bc
  42. djnz $-3
  43. ex de,hl
  44. add hl,bc
  45. pop bc
  46. dec a
  47. jr nz,-_
  48. ret
  49. ANDXxY:
  50. dec a
  51. jr nz,XORXxY
  52. ex af,af'
  53. _:
  54. push bc
  55. push af
  56. ld a,(de)
  57. and (hl)
  58. ld (hl),a
  59. inc de
  60. inc hl
  61. djnz $-5
  62. add hl,bc
  63. pop af
  64. pop bc
  65. dec a
  66. jr nz,-_
  67. ret
  68. XORXxY:
  69. dec a
  70. jr nz,ORXxY
  71. ex af,af'
  72. _:
  73. push bc
  74. push af
  75. ld a,(de)
  76. xor (hl)
  77. ld (hl),a
  78. inc de
  79. inc hl
  80. djnz $-5
  81. add hl,bc
  82. pop af
  83. pop bc
  84. dec a
  85. jr nz,-_
  86. ret
  87. ORXxY:
  88. dec a
  89. jr nz,SwapXxY
  90. ex af,af'
  91. _:
  92. push bc
  93. push af
  94. ld a,(de)
  95. or (hl)
  96. ld (hl),a
  97. inc de
  98. inc hl
  99. djnz $-5
  100. add hl,bc
  101. pop af
  102. pop bc
  103. dec a
  104. jr nz,-_
  105. ret
  106. SwapXxY:
  107. dec a
  108. jr nz,EraseXxY
  109. ex af,af'
  110. ld c,12
  111. _:
  112. push bc
  113. push af
  114. ld a,(de)
  115. ldi
  116. dec hl
  117. ld (hl),a
  118. inc hl
  119. djnz $-6
  120. add hl,bc
  121. pop af
  122. pop bc
  123. dec a
  124. jr nz,-_
  125. ret
  126. EraseXxY:
  127. dec a
  128. jr nz,MaskXxY
  129. ex af,af'
  130. push bc
  131. push af
  132. _:
  133. ld a,(de)
  134. cpl
  135. and (hl)
  136. ld (hl),a
  137. inc de
  138. inc hl
  139. djnz -_
  140. add hl,bc
  141. pop af
  142. pop bc
  143. dec a
  144. jr nz,-_-2
  145. ret
  146. MaskXxY:
  147. dec a
  148. jr nz,GrayXxY
  149. ex af,af'
  150. _:
  151. push bc
  152. push af
  153. ex de,hl
  154. ld a,(de)
  155. and (hl)
  156. inc hl
  157. or (hl)
  158. ld (de),a
  159. inc de
  160. inc hl
  161. djnz $-7
  162. ex de,hl
  163. add hl,bc
  164. pop af
  165. pop bc
  166. dec a
  167. jr nz,-_
  168. ret
  169. GrayXxY:
  170. bit grayFlag,(iy+InternalFlag)
  171. ld a,55h
  172. jr z,$+3
  173. rrca
  174. ex af,af'
  175. _:
  176. push bc
  177. push af
  178. ex af,af'
  179. ld (hl),a
  180. ex de,hl
  181. and (hl)
  182. inc hl
  183. or (hl)
  184. inc hl
  185. ex de,hl
  186. push af
  187. ld a,(hl)
  188. ex af,af'
  189. pop af
  190. ld (hl),a
  191. inc hl
  192. djnz $-14
  193. add hl,bc
  194. ex af,af'
  195. rlca
  196. ex af,af'
  197. pop af
  198. pop bc
  199. dec a
  200. jr nz,-_
  201. ret