Advertisement
Guest User

Untitled

a guest
Oct 16th, 2010
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. ; aplib_unchain_p4_copy_to_vram
  2. ;
  3. ; Converts pattern data from 4-bit linear to 4-bit planar format and sends the result to VRAM.
  4. ;
  5. ; In:
  6. ; A = source bank
  7. ; Y = source offset
  8. ; X = VRAM word address
  9. ; APLIB_NUMBYTES = number of bytes to copy
  10. ;
  11. aplib_unchain_p4_copy_to_vram:
  12. php
  13. sep #$20
  14. rep #$10
  15. phb
  16. pha
  17. plb
  18. lda #$80
  19. sta.l $2115
  20. rep #$20
  21. txa
  22. sta.l $2116
  23. _au4ctv_loop_tiles:
  24. lda #8
  25. sta APLIB_COUNT
  26. ldx #0
  27. sep #$20
  28. _au4ctv_tile:
  29. lda #4
  30. sta.b APLIB_COUNT2
  31. -:
  32. lda.w $0000,y
  33. iny
  34. lsr a
  35. rol.b APLIB_PLANAR,x
  36. lsr a
  37. rol.b APLIB_PLANAR+1,x
  38. lsr a
  39. rol.b APLIB_PLANAR+16,x
  40. lsr a
  41. rol.b APLIB_PLANAR+17,x
  42. lsr a
  43. rol APLIB_PLANAR,x
  44. lsr a
  45. rol APLIB_PLANAR+1,x
  46. lsr a
  47. rol APLIB_PLANAR+16,x
  48. lsr a
  49. rol APLIB_PLANAR+17,x
  50. dec APLIB_COUNT2
  51. bne -
  52. inx
  53. inx
  54. dec APLIB_COUNT
  55. bne _au4ctv_tile
  56. rep #$20
  57. ldx #0
  58. ; Copy the planar data to VRAM
  59. --:
  60. lda APLIB_PLANAR,x
  61. sta.l $2118
  62. inx
  63. inx
  64. cpx #32
  65. bne --
  66. lda.b APLIB_NUMBYTES
  67. sec
  68. sbc #32
  69. sta.b APLIB_NUMBYTES
  70. bne _au4ctv_loop_tiles
  71. plb
  72. plp
  73. rts
  74.  
  75.  
  76.  
  77. ; aplib_unchain_p8_copy_to_vram
  78. ;
  79. ; Converts pattern data from 8-bit linear to 8-bit planar format and sends the result to VRAM.
  80. ;
  81. ; In:
  82. ; A = source bank
  83. ; Y = source offset
  84. ; X = VRAM word address
  85. ; APLIB_NUMBYTES = number of bytes to copy
  86. ;
  87. aplib_unchain_p8_copy_to_vram:
  88. php
  89. sep #$20
  90. rep #$10
  91. phb
  92. pha
  93. plb
  94. lda #$80
  95. sta.l $2115
  96. rep #$20
  97. txa
  98. sta.l $2116
  99. _au8ctv_loop_tiles:
  100. lda #8
  101. sta APLIB_COUNT
  102. ldx #0
  103. sep #$20
  104. _au8ctv_tile:
  105. lda #8
  106. sta.b APLIB_COUNT2
  107. -:
  108. lda.w $0000,y
  109. iny
  110. lsr a
  111. rol.b APLIB_PLANAR,x
  112. lsr a
  113. rol.b APLIB_PLANAR+1,x
  114. lsr a
  115. rol.b APLIB_PLANAR+16,x
  116. lsr a
  117. rol.b APLIB_PLANAR+17,x
  118. lsr a
  119. rol APLIB_PLANAR+32,x
  120. lsr a
  121. rol APLIB_PLANAR+33,x
  122. lsr a
  123. rol APLIB_PLANAR+48,x
  124. lsr a
  125. rol APLIB_PLANAR+49,x
  126. dec APLIB_COUNT2
  127. bne -
  128. inx
  129. inx
  130. dec APLIB_COUNT
  131. bne _au8ctv_tile
  132. rep #$20
  133. ldx #0
  134. ; Copy the planar data to VRAM
  135. --:
  136. lda APLIB_PLANAR,x
  137. sta.l $2118
  138. inx
  139. inx
  140. cpx #64
  141. bne --
  142. lda.b APLIB_NUMBYTES
  143. sec
  144. sbc #32
  145. sta.b APLIB_NUMBYTES
  146. bne _au8ctv_loop_tiles
  147. plb
  148. plp
  149. rts
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement