home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src6.dms / in.adf / BOUNCHSRCS.LZH / stars.S < prev    next >
Encoding:
Text File  |  1987-05-18  |  3.8 KB  |  241 lines

  1. j:
  2. move.w    #$2000,d0
  3. lea    $60000,a0
  4. fill_plane:
  5. clr.w    (a0)+
  6. dbf    d0,fill_plane
  7.  
  8. move.l    $4,a6
  9. jsr    -150(a6)
  10. move.l    d0,sysstack
  11. lea    gfxname,a1
  12. jsr    -408(a6)
  13. move.l    d0,gfxbase
  14. move.l    d0,a6
  15. move.l    d0,a5
  16. add.l    #$32,a5
  17. move.l    (a5),coppersave
  18. move.l    #copper,(a5)
  19. move.w    #$20,$dff096
  20. bsr    star_init
  21.  
  22. raster:
  23. cmp.b    #$f0,$dff006
  24. bne    raster
  25.  
  26. bsr    star
  27. mbutton:
  28. btst    #6,$bfe001
  29. bne    raster
  30.  
  31. move.w    #$8020,$dff096
  32. move.l    $4,a6
  33. move.l    sysstack,d0
  34. jsr    -156(a6)
  35. move.l    gfxbase,a5
  36. add.l    #$32,a5
  37. move.l    coppersave,(a5)
  38. move.l    $4,a6
  39. move.l    gfxbase,a1
  40. jsr    -414(a6)
  41. rts
  42.  
  43. even
  44. gfxname: dc.b 'graphics.library',0
  45. even
  46. gfxbase: dc.l 0
  47. coppersave: dc.l 0
  48. sysstack: dc.l 0
  49. old_irq:    dc.w 0
  50.  
  51. copper:    
  52. dc.l    $008e2c81        ;display window
  53. dc.l    $009050d8
  54. dc.l    $00920038        ;data fetch 40 bytes
  55. dc.l    $009400d0
  56. dc.l    $00e00006
  57. dc.l    $00e20000
  58. dc.l    $00e40006
  59. dc.l    $00e61f40
  60. dc.l    $01800000
  61. dc.l    $01820666
  62. dc.l    $01860aaa
  63. dc.l    $01840fff
  64. dc.l    $01002200
  65. dc.l    $f007fffe
  66. dc.l    $01000000
  67. dc.l     -2
  68.  
  69. star:                ;STAR ROUTINE
  70. bsr star_clear_screen
  71.  
  72. clr.l    d6
  73. lea    star_tabell,a0
  74. lea    star_clear_tabell,a5
  75.  
  76. star_loop:            ;setter alla stars
  77. clr.l    d0
  78. clr.l    d1
  79. clr.l    d2
  80. move.w    (a0)+,d0
  81. move.w    (a0)+,d1
  82. move.w    (a0)+,d2
  83. bsr    star_on            ;hopp till star on
  84. add.l    #4,a5
  85. add.w    #1,d6
  86. cmp.w    antal_star,d6
  87. bne    star_loop
  88.  
  89. clr.l    d6
  90. lea    star_tabell,a0
  91. star_flytt_loop:        ;flyttar star nermare
  92. sub.w    #1,(a0)
  93. cmp.w    #0,(a0)
  94. bne    star_flytt_loop1
  95. bsr    ny_star
  96. star_flytt_loop1:
  97. add.l    #6,a0
  98. add.w    #1,d6
  99. cmp.w    antal_star,d6
  100. bne    star_flytt_loop
  101. rts
  102.  
  103. ny_star:            ;ny stjerna
  104. movem.l    d0-d7/a0-a6,-(a7)
  105. mulu    #6,d6
  106. lea    star_tabell,a0
  107. add.l    d6,a0
  108. move.w    star_start_z,(a0)+
  109. bsr    random            ;slump y
  110. asr.w    #5,d0            ;space size y
  111. move.w    d0,(a0)+
  112. bsr    random            ;slump x
  113. asr.w    #5,d0            ;space size x
  114. move.w    d0,(a0)+
  115. movem.l    (a7)+,d0-d7/a0-a6
  116. rts
  117.  
  118. random:                ;slumtal
  119. move.w    rnd,d0
  120. mulu    #$3723,d0
  121. add.w    #$7646,d0
  122. move.w    d0,rnd
  123. rts
  124. RND:    dc.w $0876
  125.  
  126. star_on:            ;setter dit en stjerna
  127. movem.l    d0-d7/a0-a6,-(a7)
  128. clr.l    d3
  129. clr.l    d4
  130. add.w    oga_till_tv_size_z,d0    ;riktig star z
  131. move.w    oga_till_tv_size_z,d3    ;skerm y till d3
  132. muls    d1,d3
  133. divs    d0,d3
  134. swap    d3
  135. clr.w    d3
  136. swap    d3
  137. move.w    oga_till_tv_size_z,d4    ;skerm x till d4
  138. muls    d2,d4
  139. divs    d0,d4
  140. swap    d4
  141. clr.w    d4
  142. swap    d4
  143. add.w    star_bild_centrum_y,d3    ;star till mitten
  144. add.w    star_bild_centrum_x,d4
  145. cmp.w    star_bild_size_y,d3    ;kollar utanfor skerm
  146. bhi    star_ej_on
  147. cmp.w    star_bild_size_x,d4
  148. bhi    star_ej_on
  149.  
  150. clr.l    d1            ;bit on
  151. move.w    star_bild_size_x,d1
  152. divu    #8,d1
  153. mulu    d3,d1
  154. divu    #8,d4
  155. add.w    d4,d1
  156. add.l    #star_bild,d1
  157. move.l    d1,a0
  158. swap    d4
  159. eor.b    #15,d4
  160. move.l    a0,(a5)            ;spar star poss
  161.  
  162. cmp.w    star_intenc_1,d0
  163. blt    star_ej_bit_1
  164. bset    d4,(a0)            ;setter star bit 1
  165.  
  166. star_ej_bit_1:
  167. cmp.w    star_intenc_2,d0
  168. bgt    star_ej_bit_2
  169. clr.l    d0
  170. move.w    star_bild_size_x,d0
  171. divu    #8,d0
  172. mulu    star_bild_size_y,d0
  173. add.l    d0,a0
  174. bset    d4,(a0)            ;setter star bit 2
  175.  
  176. star_ej_bit_2:
  177. movem.l    (a7)+,d0-d7/a0-a6
  178. rts
  179.  
  180. star_ej_on:
  181. jsr    ny_star
  182. movem.l    (a7)+,d0-d7/a0-a6
  183. rts
  184.  
  185. star_CLEAR_SCREEN:
  186. lea    star_clear_tabell,a0
  187. clr.l    d0
  188. move.w    star_bild_size_x,d1
  189. divu    #8,d1
  190. mulu    star_bild_size_y,d1
  191.  
  192. star_clear_screen_loop:
  193. move.l    (a0)+,a1
  194. clr.b    (a1)
  195. add.l    d1,a1
  196. clr.b    (a1)
  197. add.w    #1,d0
  198. cmp.w    antal_star,d0
  199. bne    star_clear_screen_loop
  200. rts
  201.  
  202. star_init:            ;star init
  203. clr.l    d6
  204. lea    star_tabell,a0
  205.  
  206. star_init_loop:
  207. move.w    d6,d0
  208. mulu    #6,d0            ;SLUMP START Z  <===--
  209. move.w    d0,(a0)+
  210. bsr    random            ;slump av star y
  211. asr.w    #5,d0
  212. move.w    d0,(a0)+
  213. bsr    random            ;slump av star x
  214. asr.w    #5,d0
  215. move.w    d0,(a0)+
  216. add.w    #1,d6
  217. cmp.w    antal_star,d6
  218. bne    star_init_loop
  219. clr.l    d0
  220. move.w    star_start_z,d0
  221. divu    #3,d0
  222. move.w    d0,star_intenc_1
  223. mulu    #2,d0
  224. move.w    d0,star_intenc_2
  225. rts
  226.  
  227. star_intenc_1:        dc.w 0    ;skrivs av init
  228. star_intenc_2:        dc.w 0
  229.  
  230. oga_till_tv_size_z:    dc.w 3
  231. star_bild_size_x:    dc.w 320
  232. star_bild_size_y:    dc.w 200
  233. star_bild_centrum_x:    dc.w 160
  234. star_bild_centrum_y:    dc.w 100
  235. antal_star:        dc.w 20
  236. star_start_z:        dc.w 100
  237.  
  238. star_tabell:        blk.b 20*6,1    ;20 stars
  239. star_clear_tabell:    blk.b 20*8    ;20 stars
  240. star_bild=$60000
  241.