darkline.s 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. *****************************************************************
  2. * MODULE TITLE :darkline *
  3. * *
  4. * DESCRIPTION :consists of line drawing routines *
  5. * *
  6. * *
  7. * *
  8. * NAME DATE *
  9. * *
  10. * LIST OF ROUTINES :draw_line *
  11. * EOR_draw_line *
  12. * *
  13. *****************************************************************
  14. draw_line
  15. ifnd hard_only
  16. bsr own_the_blitter
  17. endc
  18. movem.l a6,-(sp)
  19. move.l screen_mem(a0),a0
  20. do_line_bits
  21. MOVEQ #0,D6
  22. MOVEQ #0,D7
  23. MOVE.W D0,-(SP)
  24. MOVE.W D0,D6 ;STORE FOR USE IN CALCING START POS
  25. MOVE.W D1,D7
  26. CALC_OCTANT
  27. MOVEQ #0,D5 ;USE TO LOCATE OC
  28. sub.w d1,d3 ;sub y1 from y2
  29. bpl y2bigger
  30. neg.w d3
  31. bset #2,d5
  32. y2bigger
  33. sub.w d0,d2 ;x1 from x2
  34. bpl x2bigger
  35. neg.w d2
  36. bset #1,d5
  37. x2bigger
  38. cmp.w d2,d3 ;is deltax smaller than deltay
  39. BGe.s DELTAXSMALLER
  40. BSET #0,D5 ;D5 CONTAINS OCTANT POS
  41. move.w d3,sdelta
  42. move.w d2,ldelta
  43. bra.s calc_start
  44. DELTAXSMALLER
  45. move.w d3,ldelta
  46. move.w d2,sdelta
  47. CALC_START
  48. moveq #0,d2
  49. move.l #main_screen_struct,a6
  50. move.w screen_x_size(a6),d2
  51. asr.w #3,d2
  52. mulu d2,d7
  53. ADD.L D7,A0
  54. andi.w #$fff0,d6
  55. asr #3,d6
  56. ADD.L D6,A0 ;START POINT HELD IN A0
  57. MOVEQ #0,D6
  58. move.w sdelta,d6
  59. asl #1,d6
  60. move.w d6,sdelta
  61. MOVE.W LDELTA,D2
  62. MOVE.W d2,length
  63. SUB.W D2,D6
  64. asl #1,D2 ;CON LDELTA
  65. MOVE.W SDELTA,D1
  66. SUB.W D2,D1 ;contains xpres2
  67. MOVE.W (SP)+,D0 ;INIT BLTCON0
  68. andi.w #$000f,d0
  69. ROR.W #4,D0
  70. OR.W #$0Bca,D0
  71. MOVE.W SDELTA,D7
  72. CMP.W LENGTH,D7
  73. BGT NO_SET
  74. MOVE.W #$40,D7
  75. BRA OR_IN_VAL
  76. NO_SET
  77. MOVE.W #0,D7
  78. OR_IN_VAL
  79. LEA TABLE,A6 ;OCTANT
  80. OR.B (A6,D5),D7
  81. BLITTER_IT
  82. BLITQ BTST #14,$dff002
  83. BNE BLITQ
  84. MOVE.W #$ffff,$dff072
  85. MOVE.W #$8000,$dff074 ;MUST BE THIS
  86. MOVE.L A0,$dff048 ;START ADDRESS
  87. MOVE.L A0,$dff054
  88. MOVE.l d6,$dff050 ;CONTAINS 2*SDELTA-LDELTA
  89. MOVE.W SDELTA,$dff062 ;2*SDELTA IN HERE
  90. MOVE.W d1,$dff064 ;CONTAINS 2*SDELTA-2*LDELTA (xpres2)
  91. MOVE.W D0,$dff040
  92. move.l #main_screen_struct,a0
  93. move.w screen_x_size(a0),d0
  94. asr.w #3,d0
  95. MOVE.W d0,$dff066 ;SCREEN WIDTH IN BYTES
  96. MOVE.W d0,$dff060
  97. MOVE.W D7,$dff042
  98. MOVE.W #$ffff,$dff044 ;MASK
  99. MOVE.W length,D0
  100. CMPi.W #0,D0
  101. BHI KLM
  102. MOVE.W #1,D0
  103. KLM
  104. asl #6,D0
  105. ADDi.W #2,D0
  106. MOVE.W D0,$dff058
  107. movem.l (sp)+,a6
  108. ifnd hard_only
  109. bsr disown_the_blitter
  110. endc
  111. RTS
  112. dark_line
  113. movem.l a6,-(sp)
  114. bra do_line_bits
  115. eor_dark_line
  116. movem.l a6,-(sp)
  117. bra eor_line_bits
  118. table
  119. DC.B 0*4+1
  120. DC.B 4*4+1
  121. DC.B 2*4+1
  122. DC.B 5*4+1
  123. DC.B 1*4+1
  124. DC.B 6*4+1
  125. DC.B 3*4+1
  126. DC.B 7*4+1
  127. EVEN
  128. sdelta dc.w 0
  129. length dc.w 0
  130. ldelta dc.w 0
  131. EOR_draw_line
  132. ifnd hard_only
  133. bsr own_the_blitter
  134. endc
  135. movem.l a6,-(sp)
  136. move.l screen_mem(a0),a0
  137. eor_line_bits
  138. MOVEQ #0,D6
  139. MOVEQ #0,D7
  140. MOVE.W D0,-(SP)
  141. MOVE.W D0,D6 ;STORE FOR USE IN CALCING START POS
  142. MOVE.W D1,D7
  143. E_CALC_OCTANT
  144. MOVEQ #0,D5 ;USE TO LOCATE OC
  145. sub.w d1,d3 ;sub y1 from y2
  146. bpl e_y2bigger
  147. neg.w d3
  148. bset #2,d5
  149. e_y2bigger
  150. sub.w d0,d2 ;x1 from x2
  151. bpl e_x2bigger
  152. neg.w d2
  153. bset #1,d5
  154. e_x2bigger
  155. cmp.w d2,d3 ;is deltax smaller than deltay
  156. BGe.s e_DELTAXSMALLER
  157. BSET #0,D5 ;D5 CONTAINS OCTANT POS
  158. move.w d3,sdelta
  159. move.w d2,ldelta
  160. bra.s e_calc_start
  161. e_DELTAXSMALLER
  162. move.w d3,ldelta
  163. move.w d2,sdelta
  164. e_CALC_START
  165. moveq #0,d2
  166. move.l #main_screen_struct,a6
  167. move.w screen_x_size(a6),d2
  168. asr.w #3,d2
  169. mulu d2,d7
  170. ADD.L D7,A0
  171. andi.w #$fff0,d6
  172. asr #3,d6
  173. ADD.L D6,A0 ;START POINT HELD IN A0
  174. MOVEQ #0,D6
  175. move.w sdelta,d6
  176. asl #1,d6
  177. move.w d6,sdelta
  178. MOVE.W LDELTA,D2
  179. MOVE.W d2,length
  180. SUB.W D2,D6
  181. asl #1,D2 ;CON LDELTA
  182. MOVE.W SDELTA,D1
  183. SUB.W D2,D1 ;contains xpres2
  184. MOVE.W (SP)+,D0 ;INIT BLTCON0
  185. andi.w #$000f,d0
  186. ROR.W #4,D0
  187. OR.W #$0B5a,D0
  188. MOVE.W SDELTA,D7
  189. CMP.W LENGTH,D7
  190. BGT e_NO_SET
  191. MOVE.W #$40,D7
  192. BRA e_OR_IN_VAL
  193. e_NO_SET
  194. MOVE.W #0,D7
  195. e_OR_IN_VAL
  196. LEA TABLE,A6 ;OCTANT
  197. OR.B (A6,D5),D7
  198. e_BLITTER_IT
  199. e_BLITQ BTST #14,$dff002
  200. BNE e_BLITQ
  201. MOVE.W #$ffff,$dff072
  202. MOVE.W #$8000,$dff074 ;MUST BE THIS
  203. MOVE.L A0,$dff048 ;START ADDRESS
  204. MOVE.L A0,$dff054
  205. MOVE.l d6,$dff050 ;CONTAINS 2*SDELTA-LDELTA
  206. MOVE.W SDELTA,$dff062 ;2*SDELTA IN HERE
  207. MOVE.W d1,$dff064 ;CONTAINS 2*SDELTA-2*LDELTA (xpres2)
  208. MOVE.W D0,$dff040
  209. move.l #main_screen_struct,a0
  210. move.w screen_x_size(a0),d0
  211. asr.w #3,d0
  212. MOVE.W d0,$dff066 ;SCREEN WIDTH IN BYTES
  213. MOVE.W d0,$dff060
  214. MOVE.W D7,$dff042
  215. MOVE.W #$ffff,$dff044 ;MASK
  216. MOVE.W length,D0
  217. CMPi.W #0,D0
  218. BHI e_KLM
  219. MOVE.W #1,D0
  220. e_KLM
  221. asl #6,D0
  222. ADDi.W #2,D0
  223. MOVE.W D0,$dff058
  224. movem.l (sp)+,a6
  225. ifnd hard_only
  226. bsr disown_the_blitter
  227. endc
  228. RTS