Conway's Game of Life - 3D 68000er Assembler-Code für 8x8x8 Game of Life.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

core_01.s 7.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. no_clip:
  2. bsr clip_ld1
  3. tst.w d7
  4. beq.s cln_end
  5. move.w d7,(a2)
  6. subq.w #1,d7
  7. cln_loop:
  8. move.l (a0)+,(a1)+
  9. dbra d7,cln_loop
  10. cln_end:
  11. rts
  12. clip:
  13. bsr clip_ld1
  14. tst.w d7
  15. beq clip_end
  16. move.w (a0)+,d5
  17. move.w (a0)+,d6
  18. move.w xmin,d0
  19. cmp.w d0,d5
  20. bge xmin_save
  21. bra xmin_update
  22. xmin_next:
  23. move.w (a0)+,d3
  24. move.w (a0)+,d4
  25. move.w d3,d5
  26. move.w d4,d6
  27. sub.w d0,d3
  28. bge xmin_x2in
  29. sub.w d0,d1
  30. blt xmin_update
  31. bsr y_intercept
  32. bra xmin_update
  33. xmin_x2in:
  34. sub.w d0,d1
  35. bge xmin_save
  36. exg.l d1,d3
  37. exg.l d2,d4
  38. bsr y_intercept
  39. xmin_save:
  40. move.w d5,(a1)+
  41. move.w d6,(a1)+
  42. addq.w #1,(a2)
  43. xmin_update:
  44. move.w d5,d1
  45. move.w d6,d2
  46. dbf d7,xmin_next
  47. movea.l a3,a4
  48. subq.l #4,a1
  49. cmpm.l (a4)+,(a1)+
  50. beq xmin_dec
  51. move.l (a3),(a1)
  52. bra clip_xmax
  53. xmin_dec:
  54. tst.w (a2)
  55. beq clip_xmax
  56. subq.w #1,(a2)
  57. clip_xmax:
  58. bsr clip_ld2
  59. tst.w d7
  60. beq clip_ymin
  61. move.w (a0)+,d5
  62. move.w (a0)+,d6
  63. move.w xmax,d0
  64. cmp.w d5,d0
  65. bge xmax_save
  66. bra xmax_update
  67. xmax_next:
  68. move.w (a0)+,d3
  69. move.w (a0)+,d4
  70. move.w d3,d5
  71. move.w d4,d6
  72. sub.w d0,d3
  73. neg.w d3
  74. bge xmax_x2in
  75. sub.w d0,d1
  76. neg.w d1
  77. blt xmax_update
  78. bsr y_intercept
  79. bra xmax_update
  80. xmax_x2in:
  81. sub.w d0,d1
  82. neg.w d1
  83. bge xmax_save
  84. exg.l d1,d3
  85. exg.l d2,d4
  86. bsr y_intercept
  87. xmax_save:
  88. move.w d5,(a1)+
  89. move.w d6,(a1)+
  90. addq.w #1,(a2)
  91. xmax_update:
  92. move.w d5,d1
  93. move.w d6,d2
  94. dbf d7,xmax_next
  95. movea.l a3,a4
  96. subq.l #4,a1
  97. cmpm.l (a4)+,(a1)+
  98. beq xmax_dec
  99. move.l (a3),(a1)
  100. bra clip_ymin
  101. xmax_dec:
  102. tst.w (a2)
  103. beq clip_ymin
  104. subq.w #1,(a2)
  105. clip_ymin:
  106. bsr clip_ld1
  107. tst.w d7
  108. beq clip_ymax
  109. move.w (a0)+,d5
  110. move.w (a0)+,d6
  111. move.w ymin,d0
  112. cmp.w d0,d6
  113. bge ymin_save
  114. bra ymin_update
  115. ymin_next:
  116. move.w (a0)+,d3
  117. move.w (a0)+,d4
  118. move.w d3,d5
  119. move.w d4,d6
  120. sub.w d0,d4
  121. bge ymin_y2in
  122. sub.w d0,d2
  123. blt ymin_update
  124. bsr x_intercept
  125. bra ymin_update
  126. ymin_y2in:
  127. sub.w d0,d2
  128. bge ymin_save
  129. exg.l d1,d3
  130. exg.l d2,d4
  131. bsr x_intercept
  132. ymin_save:
  133. move.w d5,(a1)+
  134. move.w d6,(a1)+
  135. addq.w #1,(a2)
  136. ymin_update:
  137. move.w d5,d1
  138. move.w d6,d2
  139. dbf d7,ymin_next
  140. movea.l a3,a4
  141. subq.l #4,a1
  142. cmpm.l (a4)+,(a1)+
  143. beq ymin_dec
  144. move.l (a3),(a1)
  145. bra clip_ymax
  146. ymin_dec:
  147. tst.w (a2)
  148. beq clip_ymax
  149. subq.w #1,(a2)
  150. clip_ymax:
  151. bsr clip_ld2
  152. tst.w d7
  153. beq clip_end
  154. move.w (a0)+,d5
  155. move.w (a0)+,d6
  156. move.w ymax,d0
  157. cmp.w d6,d0
  158. bge ymax_save
  159. bra ymax_update
  160. ymax_next:
  161. move.w (a0)+,d3
  162. move.w (a0)+,d4
  163. move.w d3,d5
  164. move.w d4,d6
  165. sub.w d0,d4
  166. neg.w d4
  167. bge ymax_y2in
  168. sub.w d0,d2
  169. neg.w d2
  170. blt ymax_update
  171. bsr x_intercept
  172. bra ymax_update
  173. ymax_y2in:
  174. sub.w d0,d2
  175. neg.w d2
  176. bge ymax_save
  177. exg.l d1,d3
  178. exg.l d2,d4
  179. bsr x_intercept
  180. ymax_save:
  181. move.w d5,(a1)+
  182. move.w d6,(a1)+
  183. addq.w #1,(a2)
  184. ymax_update:
  185. move.w d5,d1
  186. move.w d6,d2
  187. dbf d7,ymax_next
  188. movea.l a3,a4
  189. subq.l #4,a1
  190. cmpm.l (a4)+,(a1)+
  191. beq ymax_dec
  192. move.l (a3),(a1)
  193. bra clip_end
  194. ymax_dec:
  195. tst.w (a2)
  196. beq clip_end
  197. subq.w #1,(a2)
  198. clip_end:
  199. rts
  200. clip_ld1:
  201. lea crds_in,a0
  202. lea crds_out,a1
  203. movea.l a1,a3
  204. move.w no_in,d7
  205. lea no_out,a2
  206. clr.w no_out
  207. rts
  208. clip_ld2:
  209. lea crds_out,a0
  210. lea crds_in,a1
  211. movea.l a1,a3
  212. move.w no_out,d7
  213. lea no_in,a2
  214. clr.w no_in
  215. rts
  216. y_intercept:
  217. tst.w d1
  218. beq yint_out
  219. tst.w d3
  220. beq yint_out
  221. movem.w d5/d6,-(sp)
  222. yint_in:
  223. move.w d2,d6
  224. add.w d4,d6
  225. asr.w #1,d6
  226. move.w d1,d5
  227. add.w d3,d5
  228. asr.w #1,d5
  229. beq yint_end
  230. bgt yint_loop
  231. move.w d5,d3
  232. move.w d6,d4
  233. bra yint_in
  234. yint_loop:
  235. move.w d5,d1
  236. move.w d6,d2
  237. bra yint_in
  238. yint_end:
  239. move.w d0,(a1)+
  240. move.w d6,(a1)+
  241. addq.w #1,(a2)
  242. movem.w (sp)+,d5/d6
  243. yint_out:
  244. rts
  245. x_intercept:
  246. tst.w d2
  247. beq xint_out
  248. tst.w d4
  249. beq xint_out
  250. movem.w d5/d6,-(sp)
  251. xint_in:
  252. move.w d1,d5
  253. add.w d3,d5
  254. asr.w #1,d5
  255. move.w d2,d6
  256. add.w d4,d6
  257. asr.w #1,d6
  258. beq xint_end
  259. bgt xint_loop
  260. move.w d6,d4
  261. move.w d5,d3
  262. bra xint_in
  263. xint_loop:
  264. move.w d5,d1
  265. move.w d6,d2
  266. bra xint_in
  267. xint_end:
  268. move.w d5,(a1)+
  269. move.w d0,(a1)+
  270. addq.w #1,(a2)
  271. movem.w (sp)+,d5/d6
  272. xint_out:
  273. rts
  274. .INCLUDE 'CORE_00.IS'