Advertisement
glokyfull

y disting scroll bitwise

Dec 18th, 2015
552
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.14 KB | None | 0 0
  1.  
  2.  
  3. ;
  4. ;
  5. ; 2pix bender
  6. ;code by gloky
  7. ;(c) vincent guesdon
  8.  
  9. ; ceci est un dump de 2pixgl3.s
  10. ; il va etre amelior‚ comme suit:
  11. ; un troisieme sinus pur la fonction
  12. ; une gestion minmax meilleurs (les minmax ne sont plus de 16 en 16 mais de 1 en 1)
  13.  
  14.  
  15. TEXT
  16. fonte198 equ 1
  17. interstice equ 1 ; interstice on ou off
  18. nbinterstice equ 1 ; =1 ou plus, n =n*2 pixel d'espace entre 2 lettre si zero, just set interstice=0
  19. justifyfonte equ 0 ; si =1, analyse la fonte au prealable et shrink le cas echeant exemple, le i prendra moins d'espace
  20. XFONTE equ 2
  21. HAUTEURFONTE equ 24
  22. NBFONTECAR equ 50
  23.  
  24. * ifne fonte198-1
  25. *XFONTE equ 1
  26. *HAUTEURFONTEfile equ 14
  27. *HAUTEURFONTE equ 16
  28. *NBFONTECAR equ 40
  29. * endc
  30.  
  31. STANDALONE equ 1
  32.  
  33. ifne STANDALONE
  34. clr.l -(sp)
  35. move.w #$20,-(sp)
  36. trap #1
  37. addq.l #6,sp
  38. endc
  39. pixbender2bitstart:
  40. jsr init2pix
  41.  
  42. ifne STANDALONE
  43. lea oldpalette,a0
  44. movem.l $ffff8240.w,d0-d7
  45. movem.l d0-d7,(a0)
  46. endc
  47.  
  48.  
  49. lea palette,a0
  50. movem.l (a0),d0/d1
  51. movem.l d0/d1,$ffff8240.w
  52.  
  53. jsr wvbl
  54. ifne standalone
  55. move.b #0,$ffff8260.w
  56. endc
  57. ifeq standalone
  58. rts
  59. endc
  60.  
  61. main_2pixgl3:
  62. IFNE STANDALONE
  63. move.l logscr,d0
  64. move.l physcr,d1
  65. move.l d1,logscr
  66. move.l d0,physcr
  67. jsr set8200
  68. ENDC
  69.  
  70. ;not $ffff8240.w
  71. ;not $ffff8240.w
  72. IFNE STANDALONE
  73. jsr wvbl
  74. ENDC
  75.  
  76. ifeq STANDALONE
  77. move.l workscr,d0
  78. move.l d0,logscr
  79. endc
  80. jsr demobitbender
  81. ; ifeq STANDALONE
  82. ; move.l logscr,d0
  83. ; move.l physcr,d1
  84. ; move.l d1,logscr
  85. ; move.l d0,physcr
  86. ; jsr set8200
  87. ; ENDC
  88.  
  89.  
  90. ifne STANDALONE
  91. cmp.b #$39+$80,$fffffc02.w
  92. beq.s .exitmain
  93. jmp main_2pixgl3
  94. .exitmain:
  95. pea exit_2pixgl3
  96. endc
  97. rts
  98.  
  99.  
  100. exit_2pixgl3:
  101. ifne standalone
  102. lea oldpalette,a0
  103. movem.l (a0)+,d0-d7
  104. movem.l d0-d7,$ffff8240.w
  105. endc
  106.  
  107. ifne standalone
  108. move.l $44e.w,d0
  109. jsr set8200
  110. jsr wvbl
  111. move.b #1,$ffff8260.w
  112. ; restaurer palette
  113. ; dezinit mem si necessaire
  114. ; flush keyboard
  115. ; resolution d'avant
  116. endc
  117. ifeq STANDALONE
  118. rts
  119. endc
  120. ifne STANDALONE
  121. clr.w -(sp)
  122. trap #1
  123. endc
  124. ifeq STANDALONE
  125. jsr dezinitramspace2pix
  126. *jsr dezinit_mem_2pixgl3
  127. endc
  128.  
  129. ifne STANDALONE
  130. include "mymem.s"
  131. *include "mymem.s"
  132. endc
  133. BSS
  134. ifne STANDALONE
  135. oldpalette ds.l 8
  136. endc
  137. DATA
  138. palette dc.w 0,$441,$415,$455 ;$441,$666,$223
  139. TEXT
  140.  
  141. init2pix:
  142. ifne STANDALONE
  143. jsr initmemall
  144. endc
  145. jsr initramspace
  146. ;lea variables,a1
  147.  
  148. move.l convY160,a2
  149. moveq #0,d0
  150. move.w #160,d1
  151. move.w #199,d2
  152. .makeconv
  153. move.w d0,(a2)+
  154. add d1,d0
  155. dbf d2,.makeconv
  156.  
  157.  
  158. ; creation des couleurs de fonte
  159. lea fontes,a2
  160. move.l fonteexpend,a1 ; adresse buffer qui va contenir la fonte expendé
  161. lea colorswaptab1_3,a3
  162.  
  163. move.w #49,d0 ; 50 caractere
  164.  
  165. .fontecar:
  166. move.w d0,-(sp)
  167. move.w #1,d0
  168. move.l a2,-(sp)
  169. .row
  170. move.w #7,d6
  171. move.l #%10000000000000001000000000000000,d5
  172. move.w #15,d4 16 bit
  173. ;*lea 16(a1),a3
  174. move.l a2,-(sp)
  175. .bcl:
  176. ;moveq #15,d7
  177. move.w #HAUTEURFONTE-1,d7
  178.  
  179. .loop:
  180. move.w (a2)+,d2
  181. move.w (a2)+,d3
  182.  
  183. add.w #4,a2
  184.  
  185. and.w d5,d2
  186. lsr d4,d2
  187. ; d2=0 ou 1
  188. and.w d5,d3
  189. lsr d4,d3
  190. add d3,d3
  191. add d2,d3 ; d3 =xx couleur fonte original
  192. move.b (a3,d3),d3 ; d3=xx couleur 1 et 3 inversé
  193. lsl #4,d3
  194. move.b d3,(a1)+
  195. dbf d7,.loop
  196.  
  197. lsr.l #1,d5
  198. subq #1,d4
  199. moveq #HAUTEURFONTE-1,d7
  200. lea -4*XFONTE*HAUTEURFONTE(a2),a2
  201. .loop2:
  202. move.w (a2)+,d2
  203. move.w (a2)+,d3
  204. add.w #4,a2
  205. and.w d5,d2
  206. lsr d4,d2
  207. and.w d5,d3
  208. lsr d4,d3
  209. add d3,d3
  210. add d2,d3
  211. move.b (a3,d3),d3 ; couleur xx 1 et 3 swapé
  212. lsl #2,d3
  213. move.b d3,(a1)+
  214. dbf d7,.loop2
  215.  
  216. lsr.l #1,d5
  217. subq #1,d4
  218. lea -4*XFONTE*HAUTEURFONTE(a2),a2 ; XFONTE=1 ou 2
  219. dbf d6,.bcl
  220.  
  221. move.l (sp)+,a2
  222. add.w #4,a2
  223. dbf d0,.row
  224. move.l (sp)+,a2
  225. move.w (sp)+,d0
  226. ;sub.w #8,a2 ; 4*(xfonte-1) ?
  227. lea HAUTEURFONTE*XFONTE*4(a2),a2
  228. dbf d0,.fontecar
  229.  
  230. ifne justifyfonte
  231. move.l fonteexpend,a0
  232. lea tableaujustif,a1
  233. move.w #49,d7 ; 50 car
  234. .justifyloop:
  235. move.w #15,d6 ; 16 double colone, a changer avec valeur equ
  236. .loopcol
  237. move.w #HAUTEURFONTE-2,d5
  238. move.b (a0)+,d0
  239. moveq #0,d1
  240. .scanonecolone:
  241. or.b (a0)+,d0
  242. dbf d5,.scanonecolone
  243. tst.b d0
  244. bne.s .endjustifyleft
  245. addq.w #1,d1
  246. dbf d6,.loopcol
  247. ; ici on a tout scann‚ et tout est egale a zero
  248. ; on considere qu'il s'agit d'un espace
  249. move.w #16,(a1)+
  250. dbf d7,.justifyloop
  251. jmp .suite
  252. .endjustifyleft:
  253. ; d1 contient le nombre d'espace au debut du caractere
  254. cmp.w #2,d1
  255. bmi.s .nojustifyleft
  256. ; d1=2 ou plus: on decalale la lettre a gauche pour obtenir un espacement de 2
  257. ;sub.w #2,d1
  258. ;si d1=5 par exemple, on decale de 5-2= 3 colonne
  259. ; a0 si zerocol un scan , a0 a ete scann‚ d1+1 fois
  260. move.w d1,d2
  261. addq #1,d2
  262. mulu #HAUTEURFONTE,d2
  263. neg.w d2
  264. lea (a0,d2),a2 ; a2 se trouve au debut de la lettre
  265. move.w d1,d2 ; d2=1 <=> 1 espace
  266. move.w #16-1,d3 ; taillex de la fonte
  267. sub.w d2,d3
  268. .justifyleft:
  269. move.w #HAUTEURFONTE-1,d4
  270. .deponecol:
  271. move.b (a0)+,(a2)+
  272. dbf d4,.deponecol
  273. dbf d3,.justifyleft
  274. ; now a copier la lettre vers sa gauche mais on a pas effacer le reste a droite
  275.  
  276. move.w d1,d2
  277. mulu #HAUTEURFONTE,d2
  278. subq #1,d2
  279. moveq #0,d4
  280. .1 move.b d4,(a2)+
  281. dbf d2,.1
  282. ; a2 se trouve a la letre suivante
  283. ; et a0 aussi a priori
  284. ; d1 est toujours egale au nombre de colone vide qu'il y'avait avant
  285.  
  286. ; now on scan la partie droite
  287. ; on sait deja qu'il y'a d1 colone vide a droite puisqu'on a decaler la fonte de d1 colone
  288.  
  289. move.w d1,d4
  290. mulu #HAUTEURFONTE,d4
  291. sub.w d4,a0 ; a0 se trouve a la fin du gfx lettre decal‚
  292.  
  293.  
  294. move.w #16-1,d6 16 double colone
  295. sub d1,d6 - justifyleft
  296. moveq #0,d5 ; nombre de colone espace a droite
  297. moveq #0,d4
  298. .scan0 move.w #HAUTEURFONTE-1,d2
  299. .scan2 move.b -(a0),d3
  300. or.b d3,d4
  301. dbf d2,.scan2
  302. tst.b d4 ; d4 = 0 -> une colone vide
  303. bne.s .endjustifydroite
  304. ; colone vide on ajoute 1 a d1
  305. addq.w #1,d1
  306. addq.w #1,d5
  307. dbf d6,.scan0
  308. nop nop
  309. .endjustifydroite
  310. ; d5 = nombre de colone espace a droite sur la lettre shrink‚
  311. ; a0 = lettre+colonne numero 16 - d1-1
  312. ; et aussi la premiere colone pleine
  313. ; la lettre a deja ete shrink‚ comme il faut a gauche
  314. ; il faut juste placer la taille total de la lettre avec interstice
  315. move.w #16,d0 ; la taille de la fonte non schrink‚
  316. sub.w d1,d0 ; -nombre total de colone espace gauche+droite
  317. addq.w #2,d0 ; +l'espacement normalis‚ entre 2 lettre
  318. cmp.w #16,d0 ; mais on ne doit pas depass‚ la taille max de la lettre
  319. blt.s .nomax
  320. move.w #16,d0
  321. .nomax
  322. move.w d0,(a1)+
  323.  
  324. ; on replace a0 a la letre suivante:
  325. mulu #HAUTEURFONTE,d1
  326. ext.l d1
  327. add.w d1,a0
  328.  
  329. dbf d7,.justifyloop
  330.  
  331.  
  332. .suite:
  333. endc
  334.  
  335. ****
  336.  
  337. move.l bandescroll,a0
  338. move.l a0,d0
  339. move.l d0,windowscrollvar
  340. move.l d0,windowscrollconst
  341.  
  342. ; remplir les 160*2*5*4 octets avec adresse routine vide et 0
  343. move.l #dummyrout,d0
  344. moveq.l #0,d1
  345. move.w #160*2-1,d2
  346. .clearbande:
  347. move.l d0,(a0)+ ; a determiner: l'ordre
  348. move.l d0,(a0)+
  349. move.l d0,(a0)+
  350. move.l d0,(a0)+
  351. move.l d0,(a0)+
  352. dbf d2,.clearbande
  353.  
  354. ;jsr init_ecran ; placer un eventuel bitmap sur les 2 ecran
  355.  
  356.  
  357. ;move.l fonteexpend,a0
  358. move.l listecgfonte,a2
  359. move.l zoneramcg,a1
  360. move.l fonteexpend,a4
  361. move.w #NBFONTECAR*8*XFONTE-1,d0
  362. .bclcgfonte:
  363. movem.l d0/a0/a2/a4,-(sp)
  364. jsr create5cg
  365. movem.l (sp)+,d0/a0/a2/a4
  366. lea 5*4(a2),a2
  367. lea HAUTEURFONTE*2(a4),a4 32 = 16* 2 octet sauter 2 colonne
  368. dbf d0,.bclcgfonte
  369.  
  370.  
  371. move.l listecgfonte,a2
  372. move.l asciitofonte,a3
  373.  
  374.  
  375. lea asciicar198,a1
  376.  
  377. moveq #0,d0
  378. move.b (a1)+,d0
  379. mulu #8*5*4*XFONTE,d0
  380. move.w #255,d1
  381. .defaultcar
  382. move.w d0,(a3)+
  383. dbf d1,.defaultcar
  384. move.l asciitofonte,a3
  385. moveq #0,d0
  386. move.w #8*5*4*XFONTE,d2 ; 8*xfonte colone de 5 code genere *4 octet pour representer l'adresse ; *XFONTE ?
  387. .loopcar:
  388. moveq #0,d1
  389. move.b (a1)+,d1 ; a code ascii 'a' ....
  390. beq.w exitloop
  391. lsl #1,d1 ; numerocar*2
  392. ;en numerocar*2 y'a le compteur ordinal
  393. move.w d0,(a3,d1.w) ; correspond d0 = le 'compteur de boucle'*d2=8*5*4
  394. add.w d2,d0
  395. bra.s .loopcar
  396.  
  397. asciicar:
  398. dc.b 29 ; 29 = 29iem car de la fonte si caractere pas connu ici c'est l'espace (le 30 iem car de la chaine qui suit est l'espace)
  399. dc.b 'abcdefghijklmnopqrstuvwxyz:.1 234567890/'
  400. dc.b 0 = fin
  401. even
  402. asciicar198:
  403. dc.b 48
  404. dc.b 'abcdefghijklmnopqrstuvwxyz!?:;0123456789"(),-.+'' *'
  405. even
  406. textescroll:
  407. dc.b 'hello, this is a mix of two fx, circles of dot (18x32 dot: 576 dots) and this scrolltext. '
  408. dc.b 'the scroll take two plan, and the dots is on one of the plan take by the scroll '
  409. dc.b 'that mean there are 2 plan free, so a 320x200 image with 4 color can be displayed ...'
  410. dc.b 'or maybe 3 plan equal 8 color where the scroll is not displayed, with rastercolors technik. '
  411. dc.b ' cliped dot could not be done with this fx because'
  412. dc.b ' it''s life, it''s the way the generated code is done '
  413. dc.b ' generated code is basicaly or.w d0,1234(a0) sorted by shift and add d0,d0 '
  414. dc.b 'without the bitbender i can display more than 3000 dots with still the bottom border left '
  415. dc.b 'this have a price: no cliping or with lot of ram (big screen in memory) '
  416. dc.b 'and it''s an idea i don''t like .. this text is boring i know ..... '
  417. dc.b 'let''s wraaaaaap ........ 5 4 3 2 1 tralala '
  418.  
  419. dc.b 0
  420.  
  421.  
  422.  
  423. ; dc.b 'and now, a circle of dot fx, with about 3000 dot .... please wait precalcing... ok :)'
  424. ; dcb.b 10,' '
  425. ; dc.b 'this demo take more than one meg, because all fx was mixed in a hurry. '
  426. ; dc.b ' some fx can feat in 512k, other take 1 meg'
  427. ; dc.b ' and now how about sinus dot ? '
  428. ; dc.b 'at this time i wrote this text, i don''t know if you''ll see about 1000 dot or about 1400 dot depending on if i finish my sinus dot with optimisation at time '
  429. ; dc.b ' this demo will probably lack of design and graphic '
  430. ; dc.b 'may be without music i don''t know '
  431. ; dc.b ' life...... '
  432. ; dc.b ' this scroll feature bitwise y disting and 2 plan font (of course, the more there is pixel in font, the less there is machine time free)'
  433. ; dc.b ' ok that''s all for the moment .....'
  434. ;
  435. ;
  436.  
  437.  
  438.  
  439. dc.b 0
  440. even
  441. ptrtexte dc.l textescroll
  442. debuttexte: dc.l textescroll
  443. curfonte: dc.l 1
  444. windowscrollconst: ds.l 1 ; a remplir = move.l bandescroll,windowscrollconst
  445. windowscrollvar ds.l 1 ; a remplir = bandescroll + deplacement
  446. cptscrollvar dc.w 0 ; compteur 0..160
  447.  
  448. exitloop:
  449. ; la suite de init
  450.  
  451. jsr create_fct
  452.  
  453.  
  454. rts
  455. dummyrout rts
  456. initscrolltexte:
  457. clr.w cyclescroll
  458. rts
  459. ifne interstice
  460. intermode dc.w 0
  461. intercount dc.w nbinterstice
  462. endc
  463. cyclescroll dc.w 0
  464. scrolltexte:
  465. IFNE interstice
  466. tst.w intermode
  467. beq .1
  468. ;lea curfonte,a2 ; fonte courante+2col ;*****************************************
  469. move.l windowscrollvar,a0
  470. move.l #dummyrout,d0 ; curfonte: dc.l listecgfonte+tlfnt*car
  471.  
  472. move.l d0,(a0)+
  473. move.l d0,(a0)+
  474. move.l d0,(a0)+
  475. move.l d0,(a0)+
  476. move.l d0,(a0)+
  477.  
  478. lea 5*4*160-20(a0),a1
  479. move.l d0,(a1)+
  480. move.l d0,(a1)+
  481. move.l d0,(a1)+
  482. move.l d0,(a1)+
  483. move.l d0,(a1)+
  484. ;lea 5*4(a0),a0
  485. move.l a0,windowscrollvar
  486.  
  487. move.w #-1,cyclescroll
  488. subq.w #1,intercount
  489. bne.s .2
  490. move.w #0,intermode
  491. *move.w #-1,cyclescroll
  492. move.w #nbinterstice,intercount
  493. .2 jmp .majmachin
  494. rts
  495. .1
  496. ENDC
  497. tst.w cyclescroll
  498. bne.s .autre
  499. .entrerlettre
  500. move.l ptrtexte,a0
  501. moveq #0,d0
  502. move.b (a0)+,d0
  503. bne.s .ok
  504. move.l debuttexte,d1
  505. move.l d1,a0
  506. move.b (a0)+,d0
  507. .ok: move.l a0,ptrtexte
  508. add d0,d0 ; d0*2
  509. move.l asciitofonte,a1
  510. move.w (a1,d0),d0 ; converti en numero car*5*8*4*xfonte
  511. move.l listecgfonte,a2
  512. add d0,a2
  513. move.l a2,curfonte
  514. .autre:
  515. lea curfonte,a2 ; fonte courante+2col ;*****************************************
  516. move.l windowscrollvar,a0
  517. move.l (a2),a3 ; curfonte: dc.l listecgfonte+tlfnt*car
  518. movem.l (a3)+,d0-d4
  519. move.l a3,(a2)
  520.  
  521. movem.l d0-d4,(a0)
  522. lea 5*4*160(a0),a1
  523. movem.l d0-d4,(a1)
  524. lea 5*4(a0),a0
  525. move.l a0,windowscrollvar
  526. .majmachin
  527. addq.w #1,cptscrollvar
  528. cmp.w #160,cptscrollvar
  529. bne.s .ok2
  530. move.w #0,cptscrollvar
  531. move.l windowscrollconst,d0
  532. move.l d0,windowscrollvar
  533. .ok2
  534. addq.w #1,cyclescroll
  535. cmp.w #8*XFONTE,cyclescroll
  536. bne.s .ok3
  537. ifne interstice
  538. move.w #1,intermode
  539. endc
  540. move.w #0,cyclescroll
  541. .ok3
  542. rts
  543.  
  544. set8200:
  545. lsr.w #8,d0
  546. move.l d0,$ffff8200.w
  547. rts
  548. IFNE STANDALONE
  549. wvbl:
  550. move.w #$25,-(sp)
  551. trap #14
  552. addq.l #2,sp
  553. rts
  554. ENDC
  555.  
  556. oldT1 ds.w 2
  557. oldT2 ds.w 2
  558. majcurrentT:
  559.  
  560. lea oldT1,a0
  561. lea oldT2,a1
  562. move.w 2(a0),d0
  563. move.w d0,(a0)
  564. move.w 2(a1),d0
  565. move.w d0,(a1)
  566. move.w currentT1,d2
  567. move.w d2,2(a0)
  568. move.w currentT2,d3
  569. move.w d3,2(a1)
  570.  
  571.  
  572. move.w alphat1,d0
  573. move.w alphat2,d1
  574. ;move.w currentT1,d2
  575. ;move.w currentT2,d3
  576. add d0,d2
  577. add d1,d3
  578. move.w #511,d4
  579. and.w d4,d2
  580. and.w d4,d3
  581. move.w d2,currentT1
  582. move.w d3,currentT2
  583.  
  584. ;lea oldT1,a0
  585. ;lea oldT2,a1
  586. ;move.w 2(a0),d0
  587. ;move.w d0,(a0)
  588. ;move.w 2(a1),d1
  589. ;move.w d1,(a1)
  590. ;move.w d2,2(a0)
  591. ;move.w d3,2(a1)
  592.  
  593. rts
  594.  
  595.  
  596. ; H L
  597. ;
  598. ;
  599. ; d1 =01 01
  600. ; d2= 01 10
  601. ; d3 =01 11
  602. ; d4 =10 01
  603. ; d5 =10 11
  604. ; d6= 11 01
  605. ; d7= 10 10
  606. ; d0 =11 10
  607. ; d8= 11 11 = d3,d3
  608.  
  609.  
  610.  
  611. ; ci apres: probleme bitmap et non couleur (00 01 correspond a bitmap correspondant plan0 plan1)
  612.  
  613.  
  614. listeopcode: ; classé par couleur premier pix,couleur deuxieme pix c1c1 c2c2 00 00 a 11 11
  615. dc.l 0
  616. dc.l $83680000,$83680002,$83a80000,$85680000
  617. dc.l $8b680000,$89a80000,$8da80000,$85680002
  618. dc.l $85a80000,$87680002,$87a80000,$8fa80000
  619. dc.l $81a80000,$8ba80000
  620. dc.L $7897ffff
  621.  
  622. ; d0= 11 10
  623. ; d1 =01 01
  624. ; d2= 01 10
  625. ; d3 =01 11
  626. ; d4 =10 01
  627. ; d5 =10 11
  628. ; d6= 11 01
  629. ; d7= 10 10
  630. ;
  631. ; d8= 11 11 = d3,d3
  632. regvalue:
  633. ; dc.l %11000000000000001100000000000000
  634.  
  635. dc.l %11000000000000001000000000000000 ; d0 = 11 10
  636. dc.l %01000000000000000100000000000000 ; d1 = 01 01
  637. dc.l %01000000000000001000000000000000 ; d2 = 01 10
  638. dc.l %01000000000000001100000000000000 ; d3 = 01 11
  639. dc.l %10000000000000000100000000000000 ; d4 = 10 01
  640. dc.l %10000000000000001100000000000000 ; d5 = 10 11
  641. dc.l %11000000000000000100000000000000 ; d6 = 11 01
  642. dc.l %10000000000000001000000000000000 ; d7 = 10 10
  643.  
  644. regvalue0:
  645. ; dc.l %11000000000000001100000000000000
  646.  
  647. dc.l %10000000000000001100000000000000 ; d0 = 11 10
  648. dc.l %01000000000000000100000000000000 ; d1 = 01 01
  649. dc.l %01000000000000001000000000000000 ; d2 = 01 10
  650. dc.l %01000000000000001100000000000000 ; d3 = 01 11
  651. dc.l %10000000000000000100000000000000 ; d4 = 10 01
  652. dc.l %10000000000000001100000000000000 ; d5 = 10 11
  653. dc.l %11000000000000000100000000000000 ; d6 = 11 01
  654. dc.l %10000000000000001000000000000000 ; d7 = 10 10
  655.  
  656. loadregvalue:
  657.  
  658. movem.l regvalue,d0-d7
  659. rts
  660.  
  661.  
  662. specialgeneric
  663. ;tst.l d0
  664. beq .1
  665. not.l d0
  666. add d2,d0
  667. move.l d0,(a1)+
  668. addq.l #2,d0
  669. move.l d0,(a1)+
  670. .1 jmp (a6)
  671.  
  672. create5cg:
  673. ; a1 = ram
  674. ; a2 = list of cg (5 adresse)
  675. ; a4 = fonte+2col ; fonteexpend
  676. ;lea listinstswap13,a3
  677.  
  678. move.l a6,-(sp) ; au cas ou
  679.  
  680. lea listeopcode,a3
  681.  
  682. move.l a1,(a2)+
  683.  
  684. ; prepare cg0:
  685. lea HAUTEURFONTE(a4),a5 14+2
  686. moveq #0,d3
  687. moveq #0,d2
  688. move.w #160,d5
  689. move.b (a4)+,d3
  690. lea _toto1,a6
  691. move.l (a3,d3.w),d0
  692. bpl.w specialgeneric ; special0
  693. add d2,d0
  694. move.l d0,(a1)+
  695. _toto1
  696. lea _toto2,a6
  697. add d5,d2
  698.  
  699. move.b (a4)+,d3
  700. move.l (a3,d3.w),d0
  701. bpl.w specialgeneric
  702. add d2,d0
  703. move.l d0,(a1)+
  704. _toto2
  705. lea _toto3,a6
  706. add d5,d2
  707. moveq #HAUTEURFONTE-3,d7
  708. _loop0:
  709. move.b (a4)+,d3
  710. add.b (a5)+,d3
  711. move.l (a3,d3.w),d0
  712. bpl specialgeneric
  713. add d2,d0
  714. move.l d0,(a1)+
  715. _toto3
  716. add d5,d2
  717.  
  718.  
  719. dbf d7,_loop0
  720.  
  721. lea _toto4,a6
  722. move.b (a5)+,d3
  723. move.l (a3,d3.w),d0
  724. bpl specialgeneric
  725. add d2,d0
  726. move.l d0,(a1)+
  727. ; jsr (a6)
  728. _toto4
  729. lea _toto5,a6
  730. add d5,d2
  731. move.b (a5)+,d3
  732. move.l (a3,d3.w),d0
  733. bpl specialgeneric
  734. add d2,d0
  735. move.l d0,(a1)+
  736. _toto5
  737. move.w #$4e75,(a1)+
  738.  
  739. ;***************************************************
  740. lea _toto6,a6
  741. move.l a1,(a2)+
  742. ; now le deuxieme code gen:
  743. move.l a4,a5
  744. lea -HAUTEURFONTE(a4),a4
  745. ;lea -16(a5),a5
  746. move.b (a4)+,d3
  747. move.l (a3,d3.w),d0
  748. bpl specialgeneric
  749. move.l d0,(a1)+
  750.  
  751. ;moveq #0,d2
  752. ;jsr (a6)
  753. _toto6
  754. lea _toto7,a6
  755. move.w #160,d5
  756. move.w d5,d2
  757. moveq #HAUTEURFONTE-2,d7
  758. _loop1:
  759. move.b (a4)+,d3
  760. add.b (a5)+,d3
  761. move.l (a3,d3.w),d0
  762. bpl specialgeneric
  763. add d2,d0
  764. move.l d0,(a1)+
  765. _toto7
  766. add d5,d2
  767. dbf d7,_loop1
  768.  
  769. lea _toto8,a6
  770. move.b (a5)+,d3
  771. move.l (a3,d3.w),d0
  772. bpl specialgeneric
  773. add d2,d0
  774. move.l d0,(a1)+
  775. _toto8
  776. move.w #$4e75,(a1)+
  777.  
  778. ;******************************************************
  779. lea _toto9,a6
  780. move.l a1,(a2)+
  781. ; now le troisieme code gen: les 2 colonne au meme niveau
  782. moveq #0,d2
  783. move.l a4,a5
  784. lea -HAUTEURFONTE(a4),a4
  785. moveq #HAUTEURFONTE-1,d7
  786. _loop2:
  787. move.b (a4)+,d3
  788. add.b (a5)+,d3
  789. move.l (a3,d3.w),d0
  790. bpl specialgeneric
  791. add d2,d0
  792. move.l d0,(a1)+
  793. _toto9
  794. add d5,d2
  795. dbf d7,_loop2
  796. move.w #$4e75,(a1)+
  797.  
  798.  
  799. ;******************************************************
  800.  
  801. move.l a1,(a2)+
  802. ; now le 4iem la deuxieme colone est au dessus
  803. lea _toto10,a6
  804. moveq #0,d2
  805. move.l a4,a5
  806. lea -HAUTEURFONTE(a4),a4
  807. move.b (a5)+,d3
  808. move.l (a3,d3.w),d0
  809. bpl specialgeneric
  810. add d2,d0
  811. move.l d0,(a1)+
  812. _toto10
  813. lea _toto11,a6
  814. add d5,d2
  815. moveq #HAUTEURFONTE-2,d7
  816. _loop3:
  817. move.b (a4)+,d3
  818. add.b (a5)+,d3
  819. move.l (a3,d3.w),d0
  820. bpl specialgeneric
  821. add d2,d0
  822. move.l d0,(a1)+
  823. _toto11
  824. add d5,d2
  825. dbf d7,_loop3
  826. lea _toto12,a6
  827. move.b (a4)+,d3
  828. move.l (a3,d3.w),d0
  829. bpl specialgeneric
  830. add d2,d0
  831. move.l d0,(a1)+
  832. _toto12
  833. move.w #$4e75,(a1)+
  834.  
  835.  
  836. ;******************************************************
  837.  
  838. lea _toto13,a6
  839. move.l a1,(a2)+
  840. ; now le 5iem code genere: la deuxieme colonne est 2 au dessus
  841. move.l a4,a5
  842. lea -HAUTEURFONTE(a4),a4
  843. moveq #0,d2
  844.  
  845. move.b (a5)+,d3
  846. move.l (a3,d3.w),d0
  847. bpl specialgeneric
  848. ;add d2,d0
  849. move.l d0,(a1)+
  850. _toto13
  851. lea _toto14,a6
  852. add d5,d2
  853. move.b (a5)+,d3
  854. move.l (a3,d3.w),d0
  855. bpl specialgeneric
  856. add d2,d0
  857. move.l d0,(a1)+
  858. _toto14
  859. lea _toto15,a6
  860. add d5,d2
  861. moveq #HAUTEURFONTE-3,d7
  862. _loop4:
  863. move.b (a4)+,d3
  864. add.b (a5)+,d3
  865. move.l (a3,d3.w),d0
  866. bpl specialgeneric
  867. add d2,d0
  868. move.l d0,(a1)+
  869. _toto15
  870. add d5,d2
  871. dbf d7,_loop4
  872. lea _toto16,a6
  873. move.b (a4)+,d3
  874. move.l (a3,d3.w),d0
  875. bpl specialgeneric
  876. add d2,d0
  877. move.l d0,(a1)+
  878. _toto16
  879. lea _toto17,a6
  880. add d5,d2
  881. move.b (a4)+,d3
  882. move.l (a3,d3.w),d0
  883. bpl specialgeneric
  884. add d2,d0
  885. move.l d0,(a1)+
  886. _toto17
  887.  
  888. move.w #$4e75,(a1)+
  889. ;******************************************************
  890.  
  891. move.l (sp)+,a6 ; au cas ou, bis
  892.  
  893. rts
  894.  
  895. dc.w -320,16
  896. dc.w -160,16
  897.  
  898. dc.w 0,0
  899. dc.w 160,4
  900. tableappel: dc.w 320,8 ; a verifier toussa
  901. dc.w 320,12
  902. dc.w 320,16
  903.  
  904. dc.w 480,0
  905. dc.w 640,0
  906.  
  907.  
  908.  
  909.  
  910. decodevalue:
  911. ; a0 = sinus 1 sous forme de Y*2
  912. ; a1 = sinus 2 sous forme de Y*2
  913. ; d2 = F,F,F,%1100 and pour int(y/2)*4 *a2 = conversion int(Y/2)*4
  914. ; a3 = conversion Y*160
  915. ; a4 = adresse buffer contenant adr cg1,cg2,cg3,cg4,cg5 puis cg1,cg2,cg3,cg4,cg5 etc (bandeau des adresses cg)
  916. ; a5 = table qui contient le numero de la routine cg, l'offset a rajouter
  917.  
  918.  
  919. ; entrée: a0,a1,a4: sortie: dans adresse zonememoire1
  920. ; sortie: zonememoire1 contient ensemble adressse a a appeler, adresse ecran+offset repartie en 8 partie: suivant les numero de bit selectionner au moment de l'affichage
  921.  
  922. lea tableappel,a5
  923. move.l convY160,a3
  924. move.l zonememoire1,a6 ; 160*8 octet libre
  925.  
  926. move.w #%1111111111111100,d2
  927. move.l logscr,d4
  928. ;addq #2,d4: selection plan 1 et 2 au lieu de 0 et 1
  929.  
  930. moveq #19,d6 ; 20 bloque de 16pixel
  931. .loop0:
  932. moveq #7,d7 ; 8x2= 16 pixel
  933. ; offset X
  934. *move.l logscr,d4
  935.  
  936. .loop1:
  937.  
  938. move.w (a0)+,d0 ; sin1
  939. add.w (a1)+,d0 ; sin2
  940. ; add (a2)+,d0
  941. and.w d2,d0
  942. move.w (a0)+,d1
  943. add.w (a1)+,d1
  944. ; add (a2)+,d1 ; sin3
  945. and.w d2,d1
  946.  
  947. sub.w d1,d0 ; sub.w d0,d1 ; d1=d1-d0 ; Y2=Y2-Y1: negatif si Y1 > Y2
  948. ;neg.w d1
  949. move.l (a5,d0.w),d3 ; s/d1/d0 ; d3 = numerocg, offset
  950. move.l (a4,d3.w),(a6)+ ; stoque dans buffer resultat: adresse code genere a appeler
  951. swap d3 ; Y relatif (*160)
  952. lsr #1,d1 ;s/d0/d1 ; y*4 devient y*2
  953. add.w (a3,d1),d3 y*160 ;s /d0/d1
  954. ext.l d3
  955. add.l d4,d3 ; ecran+8*int(x/16)
  956. move.l d3,(a6)+
  957. lea 19*8(a6),a6
  958. lea 5*4(a4),a4
  959.  
  960. dbf d7,.loop1
  961. lea -8*20*8+8(a6),a6 ; ????
  962. addq.l #8,d4
  963. dbf d6,.loop0
  964.  
  965. rts
  966.  
  967. decodevaluebis:
  968. ; a0 = sinus 1 sous forme de Y*2
  969. ; a1 = sinus 2 sous forme de Y*2
  970. ; d2 = F,F,F,%1100 and pour int(y/2)*4 *a2 = conversion int(Y/2)*4
  971. ; a3 = conversion Y*160
  972. ; a4 = adresse buffer contenant adr cg1,cg2,cg3,cg4,cg5 puis cg1,cg2,cg3,cg4,cg5 etc (bandeau des adresses cg)
  973. ; a5 = table qui contient le numero de la routine cg, l'offset a rajouter
  974.  
  975.  
  976. ; entrée: a0,a1,a4: sortie: dans adresse zonememoire1
  977. ; sortie: zonememoire1 contient ensemble adressse a a appeler, adresse ecran+offset repartie en 8 partie: suivant les numero de bit selectionner au moment de l'affichage
  978.  
  979. lea tableappel,a5
  980. move.l convY160,a3
  981. move.l zonememoire1,a6 ; 160*8 octet libre
  982.  
  983. move.w #%1111111111111100,d2
  984. move.l logscr,d4
  985. ;addq #2,d4: selection plan 1 et 2 au lieu de 0 et 1
  986.  
  987. moveq #19,d6 ; 20 bloque de 16pixel
  988. .loop0:
  989. moveq #7,d7 ; 8x2= 16 pixel
  990. ; offset X
  991. *move.l logscr,d4
  992.  
  993. .loop1:
  994.  
  995. move.w (a0)+,d0 ; sin1
  996. add.w (a1)+,d0 ; sin2
  997. and.w d2,d0
  998. move.w (a0)+,d1
  999. add.w (a1)+,d1
  1000. and.w d2,d1
  1001.  
  1002. ;sub.w d1,d0 ; sub.w d0,d1 ; d1=d1-d0 ; Y2=Y2-Y1: negatif si Y1 > Y2
  1003. ;neg.w d1
  1004. move.l (a5,d1.w),d3 ; s/d1/d0 ; d3 = numerocg, offset
  1005. move.l (a4,d3.w),(a6)+ ; stoque dans buffer resultat: adresse code genere a appeler
  1006. swap d3 ; Y relatif (*160)
  1007. lsr #1,d0 ;s/d0/d1 ; y*4 devient y*2
  1008. add.w (a3,d0),d3 y*160 ;s /d0/d1
  1009. ext.l d3
  1010. add.l d4,d3 ; ecran+8*int(x/16)
  1011. move.l d3,(a6)+
  1012. lea 19*8(a6),a6
  1013. lea 5*4(a4),a4
  1014.  
  1015. dbf d7,.loop1
  1016. lea -8*20*8+8(a6),a6 ; ????
  1017. addq.l #8,d4
  1018. dbf d6,.loop0
  1019.  
  1020. rts
  1021. cpt: dc.w 0
  1022.  
  1023. ultimatecall:
  1024. move.l zonememoire1,a6
  1025.  
  1026. movem.l regvalue,d0-d7 ; les bits
  1027. move.w #8,cpt
  1028. .loop:
  1029. rept 20
  1030. move.l (a6)+,a5 ; adresse routine
  1031. move.l (a6)+,a0
  1032. jsr (a5)
  1033. endr
  1034.  
  1035. lsr.l #2,d0
  1036. lsr.l #2,d1
  1037. lsr.l #2,d2
  1038. lsr.l #2,d3
  1039. lsr.l #2,d4
  1040. lsr.l #2,d5
  1041. lsr.l #2,d6
  1042. lsr.l #2,d7
  1043. subq #1,cpt
  1044. bne.w .loop
  1045.  
  1046. rts
  1047.  
  1048. effacebande:
  1049. ; d1 = valeur angle sin1 de depart correspondant a la bande oldT1
  1050. ; d2 = valeur angle sin2 de depart correspondant a la bande oldT2
  1051. ; d0 = 0 pour le code effacement
  1052. ; a1 = adresse ecran correspondant a la bande affiché
  1053. ; a0 utilisé par cg effacement = ecran+offset X
  1054.  
  1055. ;
  1056. _debug equ 0
  1057.  
  1058. ifne _debug
  1059. move.l blocefface,a4
  1060. move.w 4*120(a4),-(sp)
  1061. move.w #$4e75,4*120(a4)
  1062. move.l #%00100010001000101000100010001000,d0
  1063. move.l logscr,a0
  1064. move.w #19,d7
  1065. .debug:
  1066. jsr (a4)
  1067. addq.l #8,a0
  1068. dbf d7,.debug
  1069. move.w (sp)+,4*120(a4)
  1070.  
  1071. endc
  1072.  
  1073.  
  1074. ;not.w $ffff8240.w
  1075.  
  1076.  
  1077. move.l oldT1,d1
  1078. move.l oldT2,d2
  1079.  
  1080. move.l logscr,a0
  1081.  
  1082. move.l sinminmax1,a2
  1083. move.l sinminmax2,a3
  1084. move.w #19,d7 ; 17 colonne
  1085.  
  1086. move.w alphax1,d4
  1087. move.w alphax2,d5
  1088. asl #4,d4 ; *16
  1089. asl #4,d5
  1090. and.w #511,d4
  1091. and.W #511,d5
  1092. add d4,d4
  1093. add d5,d5
  1094. add d4,d4
  1095. add d5,d5 *4
  1096. move.l blocefface,a4 ; lea codeefface,a4
  1097. add d1,d1
  1098. add d1,d1 ; d1*4
  1099. add d2,d2
  1100. add d2,d2 ; d2*4
  1101.  
  1102. moveq #0,d0 ; pour voir si ca marche: 1 au lieu de 0
  1103. move.w #511*4,d6
  1104. .loop:
  1105. move.l (a2,d1),d3
  1106. add.l (a3,d2),d3
  1107. and.l #%11111111111111001111111111111100,d3
  1108. lea (a4,d3.w),a5 ; adresse jsr = poid faible = min
  1109. swap d3
  1110.  
  1111. lea (HAUTEURFONTE+1)*4(a4,d3.w),a6 ; 17 au lieu de 18 devrai marcher mais y'a des ptit point c pas normal a6 = max+16 instruction
  1112. move.w (a6),d3
  1113.  
  1114. move.w #$4e75,(a6)
  1115. jsr (a5)
  1116.  
  1117. move.w d3,(a6) ; restaure la ou y'avait le rts
  1118.  
  1119. add d4,d1
  1120. add d5,d2
  1121. ;move.w #511*4,d6
  1122. and.w d6,d1
  1123. and.w d6,d2
  1124.  
  1125. addq.l #8,a0 ; changement de colone
  1126. dbf d7,.loop
  1127.  
  1128. ;not.w $ffff8240.w
  1129.  
  1130. rts
  1131.  
  1132.  
  1133. demobitbender:
  1134.  
  1135. jsr scrolltexte
  1136.  
  1137. IFNE standalone
  1138. jsr effacebande
  1139. endc
  1140. jsr majcurrentT
  1141.  
  1142.  
  1143.  
  1144. move.l sin1adr,a0
  1145. move.w currentT1,d0
  1146. add d0,d0
  1147. add d0,d0
  1148. move.l (a0,d0.w),a0 ; adresse 320 valeur
  1149. move.l sin2adr,a1
  1150. move.w currentT2,d0
  1151. add d0,d0
  1152. add d0,d0
  1153. move.l (a1,d0.w),a1
  1154.  
  1155. move.l windowscrollvar,a4 ; en fait bandescroll + le window offset
  1156. jsr decodevalue
  1157. jsr ultimatecall
  1158.  
  1159. rts
  1160.  
  1161. create_fct:
  1162.  
  1163. move.w #510,alphax1
  1164. move.w #1,alphax2
  1165.  
  1166. move.w #1,alphat1
  1167. move.w #100,currentT1
  1168. move.w #511-3,alphat2
  1169. move.w #19,currentT2
  1170.  
  1171. lea oldT1,a0
  1172. move.w #100,(a0)+
  1173. move.w #100,(a0)+
  1174. lea oldT2,a0
  1175. move.w #19,(a0)+
  1176. move.w #19,(a0)+
  1177.  
  1178.  
  1179.  
  1180. move.l sinusTemp,a0
  1181. move.w #125,d0
  1182. jsr createSinTab
  1183.  
  1184. move.w alphax1,d0 ; pas interne premier sinus
  1185. move.w #320,d1 ; nombre de copie de valeur
  1186. move.w #512,d2 ; nombre d'element
  1187. move.l ramvaluesin,a2
  1188. move.l sin1adr,a1
  1189. move.l sinusTemp,a0
  1190. jsr createSpecialSin_2pixgl3
  1191. *jsr createSpecialSin ;delta = modifier la manier de calc min max
  1192. move.l a2,-(sp)
  1193.  
  1194. move.l sinusTemp,a0
  1195. move.w #90,d0
  1196. jsr createSinTab
  1197.  
  1198. move.l (sp)+,a2
  1199.  
  1200. move.w alphax2,d0 ; pas interner deuxieme sinus
  1201. move.w #320,d1
  1202. move.w #512,d2
  1203. move.l sin2adr,a1
  1204. move.l sinusTemp,a0
  1205. jsr createSpecialSin_2pixgl3
  1206. *jsr createSpecialSin_2pixgl3delta
  1207. ; calcul des minmax de chaque sinus
  1208. ;move.w #511,d0
  1209. move.l sin1adr,a0
  1210. move.l sinminmax1,a1
  1211.  
  1212. *bsr .localrout
  1213. *bra.s .suite
  1214. pea .suite
  1215.  
  1216. .localrout:
  1217. move.w #511,d0
  1218. .bclangle:
  1219. move.l (a0)+,a2
  1220. move.w (a2)+,d2 ; min
  1221. move.w d2,d3 ; max
  1222. moveq #14,d1
  1223. .bcl15:
  1224. move.w (a2)+,d4
  1225. cmp d4,d2
  1226. blt.s .1
  1227. move.w d4,d2
  1228. .1
  1229. cmp.w d4,d3
  1230. bgt.s .2
  1231. move.w d4,d3
  1232. .2
  1233. dbf d1,.bcl15
  1234. move.w d3,(a1)+ ; min ; sera adresse d'appel de routine
  1235. ;add.w #16,d3 ; non, pas hauteur de la fonte parce que sin1+sin2
  1236. move.w d2,(a1)+ ; max ; sera adresse de retour ou on met le rts
  1237. dbf d0,.bclangle
  1238. rts
  1239. .suite
  1240. ;move.w #511,d0
  1241. move.l sin2adr,a0
  1242. move.l sinminmax2,a1
  1243. bsr .localrout
  1244.  
  1245. rts
  1246.  
  1247. ; pas le meme que dans la sinlib (*2 a la volé)
  1248. ifne standalone
  1249. createSinTab
  1250. ; d0 = constante = rayon
  1251. ; a0 = buffer qui contiendra rayon/2*sin(angle)+rayon/2
  1252. lea sintabbss,a1
  1253. move.w #511,d1
  1254. ;move.w #32768,d3
  1255. .loop
  1256. clr.l d2
  1257. move.w (a1)+,d2
  1258. ; nombre entre 0 et 65535 positif
  1259. mulu d0,d2
  1260. swap d2
  1261. add d2,d2
  1262. move.w d2,(a0)+
  1263. dbra.w d1,.loop
  1264. rts
  1265. endc
  1266. colorswaptab1_3:
  1267. ; a faire, determiner meilleurs temps machine
  1268. dc.b 0,1,2,3
  1269. dc.b 0,1,3,2
  1270. dc.b 0,2,1,3
  1271. dc.b 0,3,1,2
  1272. dc.b 0,2,3,1
  1273. dc.b 0,3,2,1
  1274.  
  1275.  
  1276. *dc.b 0,2,2,2
  1277. *dc.b 0,1,2,3
  1278. ;dc.b 0,3,1,2
  1279. ;dc.b 0,3,1,2
  1280. ;dc.b 0,3,1,2
  1281. createSpecialSin_2pixgl3:
  1282. ; a0 = table sinus de n element
  1283. ; a1 = reftablesinus
  1284. ; a2 = buffer resultat
  1285. ; d0 = pas interne
  1286. ; d1 = nombre de copie de valeur
  1287. ; d2 = nombre n d'element de la table sinus
  1288. ; retour = d1 : nombre de memoire occupé sur buffer resultat
  1289.  
  1290.  
  1291. move.w d2,d3
  1292. lea bufferFlag2,a3
  1293. subq #1,d3
  1294. .clrflag
  1295. clr.b (a3)+
  1296. dbra d3,.clrflag
  1297.  
  1298.  
  1299. move.w d2,d3 ; 512 ou 1024
  1300. subq #1,d3 ; 511 ou 1023 pour le and de l'angle
  1301.  
  1302. lea bufferFlag2,a3
  1303. subq #1,d2 ; 511 ou 1023 iteration
  1304. moveq #0,d4 ; angle
  1305. .loop
  1306. tst.b (a3,d4) ; flag a 1 ?
  1307. bne.s .flagA1
  1308. .flagA0
  1309. move.w d4,d5
  1310. add d5,d5
  1311. move.w (a0,d5),(a2)
  1312. add d5,d5
  1313. move.l a2,(a1,d5) ; a2 referencer en reftable+angle*4
  1314. addq.l #2,a2
  1315. st (a3,d4) positione flag(angle) a 1
  1316. add d0,d4 ; pas interne
  1317. and d2,d4 ; mod 512 ou 1022
  1318. bra.s .loop
  1319. .flagA1 ; copier d1 fois les valeurs suivante
  1320. move.w d4,d5 ; angle courant copier sur d5
  1321. move.w d1,d7
  1322. subq #1,d7
  1323. .cpy
  1324. move.w d5,d6
  1325. add d6,d6
  1326. move.w (a0,d6),(a2)+
  1327. add d0,d5
  1328. and d2,d5
  1329. dbf d7,.cpy
  1330.  
  1331. sub d0,d4
  1332. addq #1,d4
  1333. and d2,d4
  1334. tst.b (a3,d4)
  1335. beq.s .flagA0
  1336. .fin
  1337. rts
  1338. ; not used
  1339. createSpecialSin_2pixgl3delta:
  1340. ; a0 = table sinus de n element
  1341. ; a1 = reftablesinus
  1342. ; a2 = buffer resultat
  1343. ; d0 = pas interne
  1344. ; d1 = nombre de copie de valeur
  1345. ; d2 = nombre n d'element de la table sinus
  1346. ; retour = d1 : nombre de memoire occupé sur buffer resultat
  1347.  
  1348.  
  1349. move.w d2,d3
  1350. lea bufferFlag2,a3
  1351. subq #1,d3
  1352. .clrflag
  1353. clr.b (a3)+
  1354. dbra d3,.clrflag
  1355.  
  1356.  
  1357. move.w d2,d3 ; 512 ou 1024
  1358. subq #1,d3 ; 511 ou 1023 pour le and de l'angle
  1359.  
  1360. lea bufferFlag2,a3
  1361. subq #1,d2 ; 511 ou 1023 iteration
  1362. moveq #0,d4 ; angle
  1363. move.w d0,d6
  1364. add d6,d6 = d6 = pas interne *2
  1365. .loop
  1366. tst.b (a3,d4) ; flag a 1 ?
  1367. bne.s .flagA1
  1368. .flagA0
  1369. move.w d4,d5
  1370. add d5,d5
  1371. move.w (a0,d5),(a2)
  1372.  
  1373. add d5,d5
  1374. move.l a2,(a1,d5) ; a2 referencer en reftable+angle*4
  1375.  
  1376. ;addq.l #2,a2
  1377.  
  1378. move.w d4,d5
  1379. add d0,d5
  1380. and d2,d5
  1381. add d5,d5
  1382. move.w (a0,d5),d5
  1383. neg.w d5
  1384. add (a2)+,d5
  1385. move.w d5,(a2)+
  1386.  
  1387.  
  1388. st (a3,d4) positione flag(angle) a 1
  1389. add d6,d4 ; 2*pas interne
  1390. and d2,d4 ; mod 512 ou 1022
  1391. bra.s .loop
  1392. .flagA1 ; copier d1 fois les valeurs suivante
  1393. move.w d4,-(sp)
  1394. ;move.w d4,d5 ; angle courant copier sur d5
  1395. move.w d1,d7
  1396. lsr #1,d7
  1397. subq #1,d7
  1398. .cpy
  1399. move.w d4,d5
  1400. add d5,d5
  1401. move.w (a0,d5),(a2)
  1402. add d0,d4
  1403. and d2,d4
  1404. move.w d4,d5
  1405. add d5,d5
  1406. move.w (a0,d5),d5
  1407. neg.w d5
  1408. add.w (a2)+,d5
  1409. move.w d5,(a2)+
  1410. dbf d7,.cpy
  1411.  
  1412. move.w (sp)+,d4
  1413. sub d0,d4
  1414. addq #1,d4
  1415. and d2,d4
  1416. tst.b (a3,d4)
  1417. beq.s .flagA0
  1418. .fin
  1419. rts
  1420.  
  1421.  
  1422.  
  1423. initramspace:
  1424. ; la bande de scroll contenant les 5 adresse de code genere:
  1425. lea variables,a1
  1426. move.l #5*4*160*2,d0
  1427. move.l d0,ramtofree2pix
  1428. jsr getMem
  1429. move.l a0,(a1)+
  1430.  
  1431. ; la zonememoire1: contenant adress routines et adresse ecran
  1432. move.l #8*20*8,d0
  1433. add.l d0,ramtofree2pix
  1434. jsr getMem
  1435. move.l a0,(a1)+
  1436.  
  1437. ; les 2 ecran physique et logique
  1438. ifne standalone
  1439. move.l #64256,d0
  1440. add.l d0,ramtofree2pix
  1441. jsr getMem
  1442. move.l a0,d0
  1443. add.l #256,d0
  1444. move.b #0,d0
  1445. move.l d0,(a1)+
  1446. add.l #32000,d0
  1447. move.l d0,(a1)+
  1448. endc
  1449.  
  1450. ifeq standalone
  1451. add.l #8,a1
  1452. endc
  1453.  
  1454.  
  1455. ; les valeurs couleur %xx0000 et %00xx00 de toute la fonte: 1 octet par pixel,40 caractere 16x16 pixel
  1456. move.l #NBFONTECAR*XFONTE*16*HAUTEURFONTE,d0 40*256
  1457. add.l d0,ramtofree2pix
  1458.  
  1459. jsr getMem
  1460. move.l a0,(a1)+
  1461.  
  1462. ***
  1463. *; la zonememoire2: qui va contenir les 160*5 code genere qui se renouvelle en buffer circulaire
  1464. * move.l #(18+17+16+17+18+4*5)*160*4+20*4,d0
  1465. * jsr getMem
  1466. * move.l a0,(a1)+
  1467. *
  1468.  
  1469. ; la zone de variable:
  1470. move.l #256,d0
  1471. add.l d0,ramtofree2pix
  1472. jsr getMem
  1473. move.l a0,(a1)+
  1474.  
  1475. ; les 512 adresse dans les sin1 et sin2
  1476. move.l #512*4,d0
  1477. add.l d0,ramtofree2pix
  1478. jsr getMem
  1479. move.l a0,(a1)+
  1480. move.l #512*4,d0
  1481. add.l d0,ramtofree2pix
  1482. jsr getMem
  1483. move.l a0,(a1)+
  1484.  
  1485. ; les 512 minmax de sin1 et sin2
  1486. move.l #512*2*4,d0
  1487. add.l d0,ramtofree2pix
  1488. jsr getMem
  1489. move.l a0,(a1)+
  1490. move.l a0,d0
  1491. add.l #512*4,d0
  1492. move.l d0,(a1)+
  1493.  
  1494. ; convY160
  1495. move.l #200*2,d0
  1496. add.l d0,ramtofree2pix
  1497. jsr getMem
  1498. move.l a0,(a1)+
  1499.  
  1500.  
  1501. ; la ram pour les valeurs de sinus (taille arbitraire)
  1502. move.l #512*2*10,d0
  1503. add.l d0,ramtofree2pix
  1504. jsr getMem
  1505. move.l a0,(a1)+
  1506.  
  1507. ; listecgfonte:
  1508. move.l #NBFONTECAR*XFONTE*8*5*4,d0
  1509. add.l d0,ramtofree2pix
  1510. jsr getMem
  1511. move.l a0,(a1)+
  1512.  
  1513. ; asciitofonte:
  1514. move.l #256*2,d0
  1515. add.l d0,ramtofree2pix
  1516. jsr getMem
  1517. move.l a0,(a1)+
  1518.  
  1519. ; zone des code genere: zoneramcg
  1520.  
  1521. *move.l #400*1024,d0 ; une valeur au pif sufisament grande ici 400ko
  1522.  
  1523. *move.l #58652,d0 ; pas plus de 60k
  1524. move.l #201376+300000,d0 ; 800k de code genere on compte large 201376 = 196,66K avec fonte198
  1525. add.l d0,ramtofree2pix
  1526. jsr getMem
  1527. move.l a0,(a1)+
  1528.  
  1529. ; sinusTemp
  1530. move.l #512*2,d0
  1531. add.l d0,ramtofree2pix
  1532. jsr getMem
  1533. move.l a0,(a1)+
  1534.  
  1535. ; blocefface
  1536. move.l #200*4+2,d0
  1537. add.l d0,ramtofree2pix
  1538. jsr getMem
  1539. move.l a0,(a1)+
  1540.  
  1541. ; now creer le code gen:
  1542.  
  1543. move.l #$21400000,d0 ; instruction <---------- a modif pour move.l d0,0(a0)
  1544. move.w #199,d1
  1545. move.w #160,d2
  1546. .bloceffacegen:
  1547. move.l d0,(a0)+
  1548. add.w d2,d0
  1549. dbf d1,.bloceffacegen
  1550. move.w #$4e75,(a0)+
  1551.  
  1552. rts
  1553.  
  1554. dezinitramspace2pix:
  1555. move ramtofree2pix,d0
  1556. jsr freeMem
  1557. rts
  1558.  
  1559. BSS
  1560. variables:
  1561. bandescroll: ds.l 1
  1562. zonememoire1: ds.l 1
  1563. logscr: ds.l 1
  1564. physcr: ds.l 1
  1565. fonteexpend ds.l 1
  1566. *zonememoire2: ds.l 1
  1567. totovar ds.l 1 buffer 256 octet
  1568. sin1adr ds.l 1
  1569. sin2adr ds.l 1
  1570. sinminmax1 ds.l 1
  1571. sinminmax2 ds.l 1
  1572. convY160 ds.l 1
  1573. ramvaluesin ds.l 1
  1574. listecgfonte ds.l 1 ; pointe vers ds.l 40*8*5 adresse de codegen (40 car*5cg par colone2pix*8(=16 pix))
  1575. asciitofonte ds.l 1 ; pointe vers ds.w 256 offset sur listecgfonte = (asciitonumcar)*5*8*4 ou si inexistant cg caractere espace
  1576. zoneramcg ds.l 1
  1577. sinusTemp ds.l 1 ; 512*2
  1578. blocefface ds.l 1 ; adresse routine liste de move.l d0,Y*160(a0)
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584. ; variable normale
  1585. currentT1 ds.w 1
  1586. currentT2 ds.w 1
  1587. alphat1 ds.W 1
  1588. alphat2 ds.w 1
  1589. alphax1 ds.w 1 ; pas interne de sin1 et sin2
  1590. alphax2 ds.w 1
  1591.  
  1592. ramtofree2pix: ds.l 1
  1593.  
  1594. *ramlistcg ds.l 1
  1595. *ramcg ds.l 1
  1596. *ramscreen1 ds.l 1
  1597. *ramscreen2 ds.l 1
  1598. *physScr ds.l 1
  1599. *logScr ds.l 1
  1600. *bandeau ds.l 2*8
  1601.  
  1602. *ram ds.b 500000 ; 500k
  1603.  
  1604. bufferFlag2 ds.b 512
  1605.  
  1606.  
  1607. DATA
  1608. ifne standalone
  1609. sintabbss incbin 'C:\SRC\2PIX\sin16b.dat'
  1610. endc
  1611. fontes
  1612. * ifne fonte198-1
  1613. * incbin 'totofnt.dat'
  1614. * endc
  1615. * ifeq fonte198-1
  1616. incbin 'C:\SRC\2PIX\fnt198.dat'
  1617. * endc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement