Advertisement
glokyfull

2pixgl5c.s

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