Advertisement
glokyfull

circles of dot by gloky

Dec 18th, 2015
519
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.81 KB | None | 0 0
  1. ;
  2. ; circles of dots
  3. ; code by gloky / mjj prod
  4. ;
  5. ; you can hack as you want this source
  6. ; as soon as you tell about me when this code is involved
  7. ;
  8. ;
  9.  
  10.  
  11. blitter_cls equ 0
  12.  
  13.  
  14. CONFIG equ 1
  15. ifeq CONFIG
  16. NBDOTPERCIRCLE equ 32
  17. NB_POSDOTPERCIRCLE equ 32*8
  18. NBCIRCLES equ 50
  19. RAYON_START equ 36
  20. RAYONMIN equ RAYON_START
  21. ANGLEWRAP equ 8 ; combien de version du cercle pour angle
  22. endc
  23.  
  24. ifeq (CONFIG-1)
  25. NBDOTPERCIRCLE equ 32
  26. NB_POSDOTPERCIRCLE equ 32*16
  27. NBCIRCLES equ 64+8+8 ; doit etre divisible par 8
  28. RAYON_START equ 4
  29. RAYONMIN equ RAYON_START
  30. ANGLEWRAP equ 16 ; combien de version du cercle pour angle
  31. endc
  32.  
  33. STANDALONE equ 1
  34. circleofdotstart:
  35.  
  36. *ifne STANDALONE
  37. clr.l -(sp)
  38. move.w #$20,-(sp)
  39. trap #1
  40. addq.l #6,sp
  41.  
  42.  
  43.  
  44. lea ptrscr,a0
  45. move.l #screen+256,d0
  46. clr.b d0
  47. move.l d0,(a0)+
  48. add.l #32000,d0
  49. move.l d0,(a0)
  50.  
  51.  
  52.  
  53. jsr wvbl
  54. move.b #0,$ffff8260.w
  55.  
  56. MOVE.L ptrscr,a0
  57. moveq.l #0,d0
  58. move.w #7999,d1
  59. cls move.l d0,(a0)+
  60. move.l d0,(a0)+
  61. dbf d1,cls
  62.  
  63.  
  64. jsr initsomething
  65.  
  66.  
  67. jsr initWaves ; doit etre lancé apres initsomething
  68.  
  69. move.w #$135,$ffff8240.w
  70. move.w #$777,$ffff8242.w
  71.  
  72. ifne blitter_cls
  73. jsr gloky_blitter_clear_init
  74. endc
  75.  
  76. main
  77. cmp.b #$b9,$fffffc02.w
  78. beq.w .fin
  79.  
  80. move.l ptrscr,a0
  81. ifne blitter_cls
  82. jsr gloky_blitter_clear
  83. endc
  84. ifeq blitter_cls
  85. jsr clear_circle
  86. endc
  87. *move.w #$11,$ffff8240.w
  88.  
  89. jsr calcwave
  90.  
  91. *not.w $ffff8240.w
  92.  
  93.  
  94. move.l ptrscr,d0
  95. lsr.w #8,d0
  96. move.l d0,$ffff8200.w
  97.  
  98. move.l ptrscr,d0
  99. move.l ptrscr+4,d1
  100. move.l d1,ptrscr
  101. move.l d0,ptrscr+4
  102.  
  103.  
  104. not $ffff8240.w
  105. not $ffff8240.w
  106. jsr wvbl
  107.  
  108.  
  109. bra main
  110. .fin
  111.  
  112. move.l $44e.w,d0
  113. lsr.w #8,d0
  114. move.l d0,$ffff8200.w
  115.  
  116. move.w #$777,$ffff8240.w
  117. move.b #1,$ffff8260.w
  118.  
  119. clr.w -(sp)
  120. trap #1
  121.  
  122. wvbl: move.w #423,$ffff8240.w
  123. move.l $466.w,d0
  124. .loop cmp.l $466.w,d0
  125. beq.s .loop
  126. move.w #003,$ffff8240.w
  127. rts
  128.  
  129. ifne blitter_cls
  130. gloky_blitter_clear:
  131. ; a0: @ ecran destination
  132. ;-----------------------------------------------------------------------------
  133. ;move.l a1,-(sp)
  134. lea $ff8a00,a1 ; blitter address
  135. move.l a0,$32(a1) ; dest address
  136. move.w #200,$38(a1) ; nbre of lines
  137. move.b #%11000000,$3c(a1) ; start blit (HOG mode)
  138. ;move.l (sp)+,a1
  139. rts
  140.  
  141. endc
  142.  
  143. init_generatedCode
  144. *;_mkconvx
  145. * lea convX,a0
  146. * moveq #0,d1
  147. * move.w #$0200,d2 +0200= or.b d1,dep(a0) puis or.b d2,dep(a0), etc..
  148. *
  149. *.0 move #$8128,d0
  150. *.1
  151. * move.w d0,(a0)+
  152. * move.w d1,(a0)+
  153. * add d2,d0
  154. * cmp.w #$8128+8*$200,d0
  155. * bne.s .1
  156. *
  157. * addq #1,d1
  158. * move.w #$8128,d0
  159. *.2
  160. * move.w d0,(a0)+
  161. * move.w d1,(a0)+
  162. *
  163. * add d2,d0
  164. * cmp.w #$8128+8*$200,d0
  165. * bne.s .2
  166. * addq #7,d1
  167. *
  168. * cmp.w #8*20,d1
  169. * bne.s .0
  170. ;*_mkconvx fin
  171.  
  172. lea convX,a0
  173. moveq #0,d0
  174. move.w #19,d1
  175. moveq #0,d2
  176. .0
  177. move.w d0,(a0)+
  178. addq #2,d0
  179. move.w d2,(a0)+ ; offset
  180. cmp.w #32,d0
  181. bne.s .0
  182. addq #8,d2 ; offset +16 pixel
  183. moveq #0,d0
  184. dbf d1,.0
  185.  
  186.  
  187. lea lstptrcode,a3
  188. lea bsscode,a1
  189. lea convX,a2
  190. lea lstorcount,a4
  191. lea lstor0,a5
  192.  
  193. moveq #NBCIRCLES-1,d7
  194. .looptaille:
  195.  
  196. move.w d7,d6
  197. add #RAYON_START,d6 ; =1,
  198. add d6,d6 ; d6=64*2 au depart
  199.  
  200. move.w #ANGLEWRAP-1,d5 ; 8-1
  201. lea circletable,a0
  202.  
  203. .loopAngle:
  204. move.w d5,-(sp)
  205.  
  206. ;move.l a1,(a3)+
  207.  
  208.  
  209. moveq #0,d0
  210. lea lstorcount,a4
  211. rept 8
  212. move.l d0,(a4)+
  213. endr ; effacer les 16 compteurs
  214. lea lstorcount,a4
  215. lea lstor0,a5
  216.  
  217. move.w #NBDOTPERCIRCLE-1,d5 ; 32-1 calcul d'un cercle de 32 dot
  218. .loopCircle
  219.  
  220. move.w (a0)+,d0 ; x
  221. move.w (a0)+,d1 ; y
  222. ext.l d0
  223. ext.l d1
  224.  
  225. muls d6,d0
  226. muls d6,d1
  227. swap d0
  228. swap d1
  229. ;add.w #96-48,d0 ; + centre
  230.  
  231. lsr #1,d6
  232. add d6,d0
  233. add d6,d1
  234. add d6,d6
  235. ;add.w #96,d0
  236. ;add.w #96,d1
  237.  
  238. ;move.w d6,d3
  239. ;lsr #2,d3
  240. ;add d3,d0
  241.  
  242. ; now a partir de d2 et d3 on creer un or.b dn,dep(a0)
  243. ; a2 = convX 1 pixel (pas de subpixel)
  244. ; d0 = x
  245. move.w d0,d3
  246. add d3,d3
  247. add d3,d3
  248. move.w (a2,d3),-(sp) ; numero de bit*2
  249. move.w 2(a2,d3),d4 ; offset x
  250.  
  251. ; calcul de l'offset adequat: int(d2/16)*8+d3*160
  252.  
  253. ; mulu #160,d1
  254. lsl #5,d1 *32
  255. move.w d1,d3
  256. ; * 128 + *32
  257. ;lsl #2,d3 *128;
  258. add d3,d3
  259. add d3,d3
  260. add d3,d1 *160
  261.  
  262. add d1,d4 ; d4 = offsetx+y
  263.  
  264. ; move.l d4,(a1)+
  265.  
  266. ;a4 = lstorcount
  267. ;a5 = lstor0
  268.  
  269. move.w (sp)+,d1 ; numero de bit*2
  270.  
  271. move.w (a4,d1),d3 ; count lstX (*2)
  272. move.w d1,d0
  273. lsl #5,d0
  274. lea (a5,d0),a6 ; a6=lstX
  275. add d3,a6 ; + countlstx
  276.  
  277. move.w d4,(a6) ; lstX+count*2=offsettotal
  278. addq #2,d3
  279. move.w d3,(a4,d1)
  280.  
  281. dbra d5,.loopCircle
  282.  
  283. ;****** now on a 16 liste d'offsets ; on genere les 16 routine qui affiche le cercle
  284. ; a4 = count lstX
  285. ; a5 = lst0
  286. ;
  287.  
  288. ;lea whereIScode,a6
  289. lea lstorcount+32,a4
  290. move.w #15,d5 ; 16 decalage/routine
  291. move.l a1,a6
  292. .loopcgmake1
  293. move.l a1,(a3)+ ; a3 = lstptrroutine
  294. *move.l a6,(a3)+
  295. lea lstor0,a5
  296.  
  297. move d5,d0
  298. lsl #6,d0 ; *64
  299. add d0,a5 ; a5 = lstF puis lstE etc // deprecated: puis lst1 puis lst2 etc
  300. move.w -(a4),d4 ; d4 = countX
  301. bne.s .dot
  302. ; nodot:
  303. ** a a modifier ici
  304. ; move.l #routinevide,-4(a3)
  305. bra.s .nodot
  306. .dot
  307. lsr #1,d4
  308. subq #1,d4
  309. .bcl
  310. move.w #$8168,(a1)+ ; or.w d0,$1234(a0)
  311. move.w (a5)+,(a1)+
  312. dbf d4,.bcl
  313. .nodot
  314. ;move.w #RTS,(a1)+
  315. move.w #$D040,(a1)+ ; add d0,d0 pour prochain points
  316.  
  317. dbf d5,.loopcgmake1
  318. move.w #$4e75,(a1)+
  319. ; ***
  320.  
  321. ;********
  322. move.w (sp)+,d5
  323. dbra d5,.loopAngle
  324.  
  325. dbra d7,.looptaille
  326.  
  327. routinevide rts
  328.  
  329. initOneWave
  330. ; d0 = rayon
  331. ; d1 = pas interne
  332. lea sinwave,a0
  333. lea buffer1,a1
  334. move.w #511,d7
  335.  
  336. move.w d0,d2
  337. add d2,d2
  338.  
  339. .loop
  340. move.w (a0)+,d4
  341. muls d2,d4
  342. swap d4
  343. add d0,d4
  344. add d4,d4
  345. add d4,d4
  346. move.w d4,(a1)+
  347. dbf d7,.loop
  348.  
  349. lea buffer1,a0
  350. move.l a6,a1 ; reftablesinus
  351. move.w d1,d0 ; pas interne
  352. move.w #NBCIRCLES,d1 ; NBCIRCLES=96
  353. move.w #512,d2
  354. bsr createSpecialSin
  355.  
  356. rts
  357.  
  358. initWaves
  359. move.w #250,d0
  360. move.w #512-17,d1
  361. LEA memoire,a2
  362. lea refs1,a6
  363. bsr initOneWave
  364.  
  365. move.w #100,d0
  366. move.w #2,d1
  367. lea refs2,a6
  368. bsr initOneWave
  369.  
  370. move.w #83,d0
  371. move.w #512-2,d1
  372. lea refs3,a6
  373. bsr initOneWave
  374.  
  375. move.w #424,d0
  376. move.w #4,d1
  377. lea refs4,a6
  378. bsr initOneWave
  379.  
  380.  
  381.  
  382. rts
  383.  
  384.  
  385. cycletoto dc.w 2*7
  386.  
  387. calcwave
  388. lea refs1,a6
  389. move.w curangle1,d0
  390. add d0,d0
  391. add d0,d0
  392. move.l (a6,d0),a0
  393.  
  394. lea refs2,a6
  395. move.w curangle2,d0
  396. add d0,d0
  397. add d0,d0
  398. move.l (a6,d0),a1
  399.  
  400. lea refs3,a6
  401. move.w curangle3,d0
  402. add d0,d0
  403. add d0,d0
  404. move.l (a6,d0),a2
  405.  
  406. lea refs4,a6
  407. move.w curangle4,d0
  408. add d0,d0
  409. add d0,d0
  410. move.l (a6,d0),a3
  411.  
  412.  
  413.  
  414. ;lea result,a6
  415.  
  416. lea calcsinbuffer,a5 ; buffer de 96 word
  417.  
  418. move.w #NBCIRCLES-1,d7 ; 96-1
  419. ifeq (ANGLEWRAP-8)
  420. move.w #%000000111000000,d6
  421. endc
  422. ifeq (ANGLEWRAP-16)
  423. move.w #%000001111000000,d6
  424. endc
  425.  
  426. .loooop
  427. move.w (a0)+,d0
  428. add (a1)+,d0
  429. add (a2)+,d0
  430. add (a3)+,d0
  431. * lsr #3,d0
  432. * and #%0000000000011100,d0
  433. ; d0 =angle*2 ,
  434. * lsl #5,d0 ; *32 ; angle*32 long
  435.  
  436. ;add d0,d0
  437. ;add d0,d0
  438. and d6,d0
  439.  
  440. move.w d0,(a5)+
  441. dbf d7,.loooop
  442.  
  443. *lea (a5,d0),a4
  444. *move.l (a4)+,(a6)+ ; adresse appel ; A MODIF
  445. *move.l (a4)+,(a6)+ ; adresse ou il faut placer le rts
  446.  
  447. *lea 32*4(a5),a5 ; passer au cercle suivant
  448. *dbf d7,.loooop
  449.  
  450. ; now dans calcsinbuffer on a 96 valeur correspondant au sinus
  451.  
  452. jsr calcSpot ; calcul de spot+scroll+realposition
  453.  
  454. move.w cycletoto,d1
  455.  
  456. ;move.w #NBCIRCLES-1,d7 ;96-1
  457. move.w #NBCIRCLES/8-1,d7
  458. lea realposition,a6
  459. lea calcsinbuffer,a5
  460. lea lstptrcode,a4
  461.  
  462. add.w d1,a6
  463. add.w d1,a6
  464. add.w d1,a6 ; 0 2 4 6 *3 = 0 6 12 18
  465.  
  466. ;neg.w d1
  467. ;add.w #6,d1
  468. mulu #2*16*ANGLEWRAP,d1
  469. add d1,a4
  470.  
  471. move.w cycletoto,d1
  472. subq.w #2,d1
  473. tst d1
  474. bpl.s .plouk
  475. move.w #2*7,d1
  476. .plouk move.w d1,cycletoto
  477.  
  478.  
  479. move.w #$4e75,d6
  480. ;move.w #$8168,d5 la plupart du temps c'est 8168 sinon c'est un rts
  481.  
  482. .loooop2
  483. move.w (a5)+,d0 ; angle*16*4
  484. ;lea 2*3(a5),a5
  485. lea (a4,d0),a2 ; a2 = lstptrcode[cercle+angle]
  486.  
  487. move.l (a6)+,a0 ; adresse ecran resultat fonction
  488. ;lea 8(a0),a1
  489. move.l (a2),a3
  490. add.w (a6)+,a2 ; decalage*8
  491. lea 6*7(a6),a6
  492. ;add d1,a2
  493. move.l (a2),a2 ; adresse routine
  494. moveq #1,d0
  495. jsr (a2)
  496. moveq #1,d0
  497. lea 160(a0),a0
  498. jsr (a2)
  499.  
  500. addq.l #8,a0
  501. move.w (a2),d5
  502. move.w d6,(a2) ; d6=rts
  503. move.w d0,-(sp)
  504. jsr (a3)
  505. lea -160(a0),a0
  506. move.w (sp)+,d0
  507. jsr (a3)
  508.  
  509. move.w d5,(a2)
  510. ;move.w d5,-4(a2) ; d5=add d0,d0
  511.  
  512. ; changement de cercle
  513. lea 4*16*ANGLEWRAP(a4),a4 *8
  514. lea 4*16*ANGLEWRAP(a4),a4 *8
  515. lea 4*16*ANGLEWRAP(a4),a4 *8
  516. lea 4*16*ANGLEWRAP(a4),a4 *8
  517. lea 4*16*ANGLEWRAP(a4),a4 *8
  518. lea 4*16*ANGLEWRAP(a4),a4 *8
  519. lea 4*16*ANGLEWRAP(a4),a4 *8
  520. lea 4*16*ANGLEWRAP(a4),a4 *8
  521.  
  522. dbf d7,.loooop2
  523.  
  524.  
  525. move.w curangle1,d0
  526. add #15,d0
  527. and #511,d0
  528. move.w d0,curangle1
  529.  
  530. move.w curangle2,d0
  531. add #511-17,d0
  532. and #511,d0
  533. move.w d0,curangle2
  534.  
  535. move.w curangle3,d0
  536. add #3,d0
  537. and #511,d0
  538. move.w d0,curangle3
  539.  
  540. move.w curangle4,d0
  541. add #12,d0
  542. and #511,d0
  543. move.w d0,curangle4
  544.  
  545. rts
  546.  
  547. prepareScaleTable
  548. lea superScaleTable,a0 ; buffer de 200 word *96
  549. move.w #NBCIRCLES-1,d7
  550. .loop0
  551.  
  552. move.w d7,d2
  553. add #RAYONMIN,d2
  554. ;move.w #96,d2
  555. ;sub d7,d2 ; taille du cercle correspondant
  556. ;sub #1,d2
  557. add d2,d2
  558. move.w #200,d3
  559. sub d2,d3 ; 199-taille du cercle = nb de pixel max
  560.  
  561. ; scale[100] doit placer le cercle au milieu
  562. ; d2 = taille du cercle
  563. ; en 100, placer en 100-d2/2
  564. ; en 0 placer en 0
  565. ; en 200 placer en 200-d2
  566. ; donc de 0 a 200 = 0 a 200-d2
  567. ; il faut ajouter a chaque fois (200-d2)/200 = d3/200
  568.  
  569. moveq #0,d4
  570. move.w d3,d4
  571. swap d4 d3*65536
  572. divu #200,d4 ;/200
  573. swap d4
  574. clr.w d4
  575. swap d4
  576.  
  577.  
  578. move.w #199,d1
  579. moveq #0,d6
  580. moveq #0,d5
  581. .oneTable:
  582. move.w d5,(a0)+
  583. add.l d4,d6
  584. swap d6
  585. move.w d6,d5
  586. swap d6
  587. add d5,d5
  588.  
  589. dbf d1,.oneTable
  590. dbf d7,.loop0
  591. rts
  592.  
  593. initsomething
  594. lea posSpot,a0
  595. move.w #100*2,d0
  596. move.w #100*2,d1
  597. move.w #NBCIRCLES-1,d7
  598. .bcl
  599. move.w d0,(a0)+
  600. move.w d1,(a0)+
  601. dbf d7,.bcl
  602.  
  603. jsr prepareScaleTable
  604. jsr init_generatedCode
  605.  
  606. lea convX2,a0
  607. moveq #0,d0
  608. moveq #19,d7
  609. moveq #0,d1
  610. .loop
  611. move.w d0,(a0)+ ; decalage
  612. move.w d1,(a0)+ ; offset
  613. add.w #4,d0 ; decalage*8
  614. cmp.w #16*4,d0
  615. bne.s .loop
  616. moveq #0,d0
  617. add.w #8,d1
  618. dbf d7,.loop
  619.  
  620. lea convY,a0
  621. move.w #0,d0
  622. move.w #160,d1
  623. move.w #199,d7
  624. .loop2
  625. move.w d0,(a0)+
  626. add d1,d0
  627. dbf d7,.loop2
  628.  
  629.  
  630. rts
  631.  
  632.  
  633. calcSpot:
  634. bsr scroll_posSpot ; positione a2 a la fin du posSpot
  635.  
  636. lea cosinusSpot,a0
  637. lea sinusSpot,a1
  638.  
  639. move.w cspot,d0 ; angle cosinus spot
  640. addq.w #1,d0
  641. and.w #511,d0
  642. move.w d0,cspot
  643. add d0,d0 ; angle*2
  644. move.w (a0,d0),d1 ; d1 = (100+100*cos(angle))*2
  645.  
  646. move.w sspot,d0
  647. addq.w #3,d0
  648. and.w #511,d0
  649. move.w d0,sspot
  650. add d0,d0
  651. move.w (a1,d0),d2 ; d2 = 100+100*sin(angle)
  652.  
  653. lea cosinusSpot,a0
  654. move.w cspot+2,d0 ; angle cosinus spot
  655. add.w #512-2,d0
  656. and.w #511,d0
  657. move.w d0,cspot+2
  658. add d0,d0 ; angle*2
  659. add.w (a0,d0),d1 ; d1 = (100+100*cos(angle))*2
  660.  
  661. move.w sspot+2,d0
  662. addq.w #1,d0
  663. and.w #511,d0
  664. move.w d0,sspot+2
  665. add d0,d0
  666. add.w (a1,d0),d2 ; d2 = 100+100*sin(angle)
  667.  
  668. lsr #1,d1
  669. lsr #1,d2
  670. and.w #$FFFE,d1
  671. and.w #$FFFE,d2
  672.  
  673. ;lea posSpot,a0
  674. move.w d1,(a2)+
  675. move.w d2,(a2)+
  676.  
  677. ; *********
  678. ; conversion de posSpot a realposition:
  679. ; ********
  680. lea superScaleTable,a0 ; buffer de 200 word *96
  681. lea posSpot,a1
  682. lea realposition,a2 ; buffer: offset,decalage
  683. lea convX2,a3
  684. lea convY,a4
  685. move.l ptrscr,a5 ; ecran courant
  686. move.w #NBCIRCLES-1,d7
  687. .bcl
  688. move.w (a1)+,d0 ; premiere coord , cercle de rayon 1
  689. ;add d0,d0
  690. move.w (a0,d0),d2 ; superScaleTable[d0]
  691. add d2,d2
  692. move.l (a3,d2),d3 ; d3 = decalage,offsetX
  693.  
  694. move.w (a1)+,d1 ; y
  695. ;add d1,d1
  696. move.w (a0,d1),d4 ; superscaleTable[d1]
  697. add.w (a4,d4),d3 ; d3= decalage,offsetX+offsetY
  698. lea (a5,d3.w),a6
  699. move.l a6,(a2)+ ; adresse ecran+offset
  700. swap d3
  701. move.w d3,(a2)+
  702.  
  703. lea 400(a0),a0 ; passage au 'scaleur' suivant
  704.  
  705.  
  706. dbf d7,.bcl
  707.  
  708. ; now realposition = liste de 96 (adresse ecran, decalage)
  709. rts
  710.  
  711. scroll_posSpot:
  712. ; lea posSpot+96*4,a0
  713. ; lea -4(a0),a1
  714. ; move.w #95,d7
  715. ;.;loop
  716. ; move.l -(a1),d0
  717. ; move.l d0,-(a0)
  718. ; dbf d7,.loop
  719.  
  720. ifeq (NBCIRCLES-96)
  721.  
  722. lea posSpot,a1
  723. lea 4(a1),a0
  724.  
  725. rept 11 ; 11*8=88
  726. movem.l (a0)+,d0-d7
  727. movem.l d0-d7,(a1)
  728. lea 32(a1),a1
  729. endr
  730. movem.l (a0)+,d0-d6 ; 88+7= 95
  731. movem.l d0-d6,(a1)
  732. lea 32-4(a1),a2
  733. endc
  734.  
  735. ifne (NBCIRCLES-96)
  736.  
  737. lea posSpot,a1
  738. lea 4(a1),a0
  739. move.w #NBCIRCLES-2,d7
  740. .1
  741. move.l (a0)+,(a1)+
  742. dbf d7,.1
  743. move.l a1,a2
  744.  
  745.  
  746. endc
  747. rts
  748.  
  749.  
  750. createSpecialSin
  751. ; a0 = table sinus de n element
  752. ; a1 = reftablesinus
  753. ; a2 = buffer resultat
  754. ; d0 = pas interne
  755. ; d1 = nombre de copie de valeur
  756. ; d2 = nombre n d'element de la table sinus
  757. ; retour = d1 : nombre de memoire occupé sur buffer resultat
  758.  
  759. move.w d2,d3
  760. lea bufferFlag,a3
  761. subq #1,d3
  762. .clrflag
  763. clr.b (a3)+
  764. dbra d3,.clrflag
  765.  
  766.  
  767. move.w d2,d3 ; 512 ou 1024
  768. subq #1,d3 ; 511 ou 1023 pour le and de l'angle
  769.  
  770. lea bufferFlag,a3
  771. subq #1,d2 ; 511 ou 1023 iteration
  772. moveq #0,d4 ; angle
  773. .loop
  774. tst.b (a3,d4) ; flag a 1 ?
  775. bne.s .flagA1
  776. .flagA0
  777. move.w d4,d5
  778. add d5,d5
  779. move.w (a0,d5),(a2)
  780. add d5,d5
  781. move.l a2,(a1,d5) ; a2 referencer en reftable+angle*4
  782. addq.l #2,a2
  783. st (a3,d4) positione flag(angle) a 1
  784. add d0,d4 ; pas interne
  785. and d2,d4 ; mod 512 ou 1022
  786. bra.s .loop
  787. .flagA1 ; copier d1 fois les valeurs suivante
  788. move.w d4,d5 ; angle courant copier sur d5
  789. move.w d1,d7
  790. subq #1,d7
  791. .cpy
  792. move.w d5,d6
  793. add d6,d6
  794. move.w (a0,d6),(a2)+
  795. add d0,d5
  796. and d2,d5
  797. dbf d7,.cpy
  798.  
  799. sub d0,d4
  800. addq #1,d4
  801. and d2,d4
  802. tst.b (a3,d4)
  803. bne.s .fin
  804. bra .flagA0
  805. .fin
  806. rts
  807.  
  808. ifne blitter_cls
  809. gloky_blitter_clear_init:
  810. ;-----------------------------------------------------------------------------
  811. move.l a0,-(sp)
  812. lea $ff8a00,a0 ; blitter address
  813. move.w #13,$36(a0) ; (BLT_XCOUNT)
  814. move.w #0,$20(a0) ; (BLT_SRCXINC)
  815. move.w #0,$22(a0) ; (BLT_SRCYINC)
  816. move.w #8,$2e(a0) ; (BLT_DSTXINC)
  817. move.w #160-((13*8)-8),$30(a0) ; (BLT_DSTYINC)
  818. move.b #$0,$3a(a0) ; (BLT_HOP)
  819. move.w #$ffff,$2a(a0) ; mid mask
  820. move.w #$ffff,$28(a0) ; Left end mask
  821. move.w #$ffff,$2c(a0) ; Right end mask
  822.  
  823. move.b #0,$3d(a0) ; skew value
  824. move.b #0,$3b(a0) ; (BLT_OP)
  825.  
  826.  
  827. move.l #_glk_eff,$24(a0) ; source address
  828.  
  829. move.l (sp)+,a0
  830. rts
  831. _glk_eff dc.l 0
  832. endc
  833. ifeq blitter_cls
  834. clear_circle:
  835. move.w #1,d7
  836. .waitnop:
  837. nop
  838. nop
  839. nop
  840. nop
  841. dbf d7,.waitnop
  842.  
  843. not.w $ffff8240.w
  844. ; a0 = ecran+offset ou on doit effacer l'effet
  845.  
  846. moveq #0,d0
  847. move.w #99,d7 ; 64*2 ligne = 128 lignes
  848.  
  849. .loop
  850. move.w d0,(a0)
  851. move.w d0,8(a0)
  852. move.w d0,16(a0)
  853. move.w d0,24(a0)
  854. move.w d0,32(a0)
  855. move.w d0,40(a0)
  856. move.w d0,48(a0)
  857. move.w d0,56(a0)
  858. move.w d0,64(a0)
  859. move.w d0,72(a0)
  860. move.w d0,80(a0)
  861. move.w d0,88(a0)
  862. move.w d0,96(a0)
  863.  
  864. move.w d0,160(a0)
  865. move.w d0,168(a0)
  866. move.w d0,176(a0)
  867. move.w d0,184(a0)
  868. move.w d0,192(a0)
  869. move.w d0,200(a0)
  870. move.w d0,208(a0)
  871. move.w d0,216(a0)
  872. move.w d0,224(a0)
  873. move.w d0,232(a0)
  874. move.w d0,240(a0)
  875. move.w d0,248(a0)
  876. move.w d0,256(a0)
  877.  
  878. lea 320(a0),a0
  879. dbf d7,.loop
  880. not.w $ffff8240.w
  881. rts
  882.  
  883. endc
  884.  
  885. DATA
  886. sinwave: incbin 'sinwave.dat'
  887. circletable:
  888. ifeq CONFIG
  889. incbin 'cercle.dat'
  890. endc
  891. ifeq (CONFIG-1)
  892. incbin 'cerc512.dat'
  893. endc
  894. curangle1 dc.w 0
  895. curangle2 dc.w 2
  896. curangle3 dc.w 10
  897. curangle4 dc.w 100
  898.  
  899. cspot dc.w 10
  900. dc.w 22
  901. sspot dc.w 60
  902. dc.w 40
  903. cosinusSpot: incbin 'cosinus' ; 100+100*cos(angle de 0 a 511)
  904. sinusSpot: incbin 'sinus'
  905.  
  906. BSS
  907.  
  908. ptrscr
  909. ds.l 2
  910. screen ds.b 256
  911. ds.b 32000
  912. ds.b 32000
  913. ;ds.w 32000
  914. ;ds.w 32000
  915.  
  916. superScaleTable: ds.w 200*NBCIRCLES ;200*96 un peu moins de 40 000 octet
  917.  
  918. ******
  919.  
  920. realposition
  921. buffer1 ds.w 512 ; 1.5k et on peut pas le metre dans memoire
  922. bufferFlag ds.b 512 ; parce que c'est utilisé en meme temps
  923. ;realposition:
  924. ;ds.l 96
  925. ;ds.w 96
  926.  
  927. calcsinbuffer equ realposition+NBCIRCLES*6 ; ds.w 96
  928.  
  929. ********
  930.  
  931.  
  932.  
  933. lstptrcode ds.l ANGLEWRAP*NBCIRCLES*16 ; 8*96*32
  934. ; 16 adresse d'appel
  935. ; puis 16 adresse ou il faut placer les rts
  936. ; format: (adresse appel, adresse retour)*16
  937. ;
  938. refs1 ds.l 512
  939. refs2 ds.l 512
  940. refs3 ds.l 512
  941. refs4 ds.l 512
  942.  
  943. convX2 ds.l 320
  944. convY ds.w 200
  945. memoire
  946.  
  947. convX ds.l 320
  948. lstor0 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  949. lstor1 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  950. lstor2 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  951. lstor3 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  952. lstor4 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  953. lstor5 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  954. lstor6 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  955. lstor7 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  956. lstor8 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  957. lstor9 ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  958. lstorA ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  959. lstorB ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  960. lstorC ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  961. lstorD ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  962. lstorE ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  963. lstorF ds.w NBDOTPERCIRCLE ; max 32 point par cercle
  964.  
  965. lstorcount ds.w 16 ; compteur lstorX
  966. ds.l 768*3-320-NBDOTPERCIRCLE*8 ; a partir de memoire: 768*3 long reservé
  967.  
  968.  
  969. bsscode ds.l NBDOTPERCIRCLE*ANGLEWRAP*NBCIRCLES ; 96*32*8*2 256*96*2 ; 96 cercle de 256 or.w *2, version dep(a0) et dep+8(a0)
  970. ds.w ANGLEWRAP*NBCIRCLES*16 ; 8 'angle'*96 cercles * 32 add d0,d0
  971. ds.w ANGLEWRAP*NBCIRCLES ; 8*96 ; rts
  972. posSpot ds.l NBCIRCLES
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement