Advertisement
glokyfull

2pixgl5.s

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