home *** CD-ROM | disk | FTP | other *** search
/ Falcon 030 Power 2 / F030_POWER2.iso / ST_STE / DEMOS / MEGADEMO / PASSIONP.ARJ / PASSIONP.MSA / JELLY / JELLY.S < prev    next >
Text File  |  1997-03-05  |  11KB  |  416 lines

  1. ; ************************************************************************
  2. ; *****                                                              *****
  3. ; *****        MAPPED JELLY             *****
  4. ; *****                                                              *****
  5. ; ************************************************************************
  6. ; *****            A Jelly cube with a x-zoomed image on it.         *****
  7. ; *****                      By Alain BROBECKER.                     *****
  8. ; *****   Coded between 6th and 10th of June 1994. (No hurry!...)    *****
  9. ; ************************************************************************
  10. ; At the beginning all colors must be black, cos this are the initials
  11. ; colors of the fade.
  12.  
  13. time    equ    499
  14. ;249
  15. end_pos    equ    64*6
  16.  
  17. supervisor:
  18.   move.l    #$0,-(sp)
  19.   move.w    #$20,-(sp)
  20.   trap    #$1    ; User mode is shit....
  21.   addq.l    #$6,sp
  22.  
  23. initialisations:    
  24.   dc.w    $a00a    ; Fuck the mouse.
  25.   move.b    #$12,$fffffc02.w
  26.   move.b    $484.w,old_conterm
  27.   clr.b    $484.w    ; No bip, no repeat.
  28.   move.l    $114.w,old_timerc ; Unusefull for a demo.
  29.   move.l    #null_timerc,$114.w ; Put a "null" routine.
  30.   move.l    $70.w,old_vbl    ; I have to use my own Vbl.
  31.   move.l    #null_vbl,$70.w    ; A "null" vbl for the moment.
  32.  
  33.   move.w    #$25,-(sp) 
  34.   trap    #$e    ; Vsync
  35.   addq.l    #$2,sp
  36.   move.b    $ffff8260.w,old_rez ; Save screen features.
  37.   move.b    $ffff8201.w,old_screen
  38.   move.b    $ffff8203.w,old_screen+1
  39.   move.b    $ffff820d.w,old_screen+2
  40.  
  41.   move.b    #$0,$ffff8260.w
  42.  
  43. ; ************************************************************************
  44. ; Generate the zooming routines.
  45.  
  46.   move.l    #zoom_code,a0
  47.   move.l    #zoom_adr,a1
  48.   jsr    generate
  49.  
  50.  
  51. ; ************************************************************************
  52. ; ************************************************************************
  53. ; The demo itself runs now....
  54.  
  55.   move.l    #$0,$466.w    ; _frclock=0.
  56.   move.l    #demo_vbl,$70.w
  57.   move.l    #$0,position
  58.  
  59. init_timer_b:
  60.   bclr.b    #$0,$fffffa07.w    ; Timer B disabled!..
  61.   bset.b    #$0,$fffffa13.w ; Timer B demasked.
  62.   bset.b    #$3,$fffffa17.w    ; Soft end of interrupt.
  63.   move.l    #timer_b,$120
  64.   move.b    #$0,$fffffa1b.w    ; Timer B stoppe.
  65.   bset.b    #$0,$fffffa07.w    ; Timer B enabled.
  66.  
  67.   move.b    #$0,$ffff8a3d.w    ; No skew register.
  68.   move.l    #-1,$ffff8a28.w ; No masks.
  69.   move.w    #-1,$ffff8a2c.w
  70.       
  71. vbl_one:
  72.   jsr    wait_vbl
  73.   move.l    #screen1,a6
  74.  
  75.   move.b    #$0,$ffff8a3b.w    ; Fill with zeroes.
  76.  
  77. .clear_old_cube:
  78.   move.l    a6,a5
  79.   add.w    #7736,a5    ; a5 points on the first word to clear.
  80.   move.l    a5,$ffff8a32.w    ; Dest adress.
  81.   move.l    #$20072,$ffff8a2e.w ; Dest x inc and dest y inc.
  82.   move.l    #$180060,$ffff8a36.w ; 24 words per line and 96 lines.
  83.   move.b    #$c0,$ffff8a3c.w ; Go.
  84.   
  85. .clear_old_logo:
  86.   move.l    #y_conv_table,a0
  87.   move.w    old_logo_y1,d0
  88.   add.w    d0,d0
  89.   move.l    a6,a5
  90.   add.w    (a0,d0.w),a5    ; a5 points on the first word to clear.
  91.   move.l    a5,$ffff8a32.w    ; Dest adress.
  92.   move.l    #$20092,$ffff8a2e.w ; Dest x inc and dest y inc.
  93.   move.l    #$8000a,$ffff8a36.w ; 8 words per line and 10 lines.
  94.   move.b    #$c0,$ffff8a3c.w ; Go.
  95.  
  96.   move.l    #movements,a5
  97.   move.l    position,d7
  98.   add.l    d7,a5
  99.   addq.l    #6,d7
  100.   cmp.l    #end_pos,d7
  101.   bne.s    .pos_ok
  102.   moveq.l    #$0,d7
  103. .pos_ok:
  104.   move.l    d7,position
  105.  
  106.   move.w    #$203,$ffff8a3a.w ; Source.
  107.  
  108. .print_logo:
  109.   move.w    (a5)+,d0    ; Y of the logo.
  110.   move.w    d0,old_logo_y1
  111.   add.w    d0,d0
  112.   move.l    a6,a4
  113.   add.w    (a0,d0.w),a4    ; a4 points on the dest adress.
  114.   move.l    a4,$ffff8a32.w    ; Dest adress.
  115.   move.l    #$20092,$ffff8a2e.w ; Dest x inc and dest y inc.
  116.   move.l    #$8000a,$ffff8a36.w ; 8 words per line and 10 lines.
  117.   move.l    #logo,$ffff8a24.w ; Source adress.
  118.   move.l    #$20002,$ffff8a20.w ; Source x inc and y inc.
  119.   move.b    #$c0,$ffff8a3c.w ; Go.
  120.  
  121. .print_cube:
  122.   move.w    (a5)+,d4    ; y1.
  123.   move.w    #144,d5    ; y2.
  124.   move.w    (a5)+,d6    ; Jelly coef.
  125.   move.l    a6,a3    ; Ramvideo adress.
  126.   move.l    #image,d7    ; Source image.
  127.   move.l    #zoom_adr,a4    ; Zoom routs adresses table.
  128.   jsr    jelly_cube
  129.  
  130. .put_ramvideo_adress:
  131.   move.l    a6,d0   
  132.   move.l    d0,d1
  133.   swap.w    d0
  134.   move.b    d0,$ffff8201.w
  135.   swap.w    d0
  136.   rol.w    #$8,d0
  137.   move.b    d0,$ffff8203.w
  138.   move.b    d1,$ffff820d.w
  139.  
  140. vbl_two:
  141.   jsr    wait_vbl
  142.   move.l    #screen2,a6
  143.  
  144.   move.b    #$0,$ffff8a3b.w    ; Fill with zeroes.
  145.  
  146. .clear_old_cube:
  147.   move.l    a6,a5
  148.   add.l    #7736,a5    ; a5 points on the first word to clear.
  149.   move.l    a5,$ffff8a32.w    ; Dest adress.
  150.   move.l    #$20072,$ffff8a2e.w ; Dest x inc and dest y inc.
  151.   move.l    #$180060,$ffff8a36.w ; 24 words per line and 96 lines.
  152.   move.b    #$c0,$ffff8a3c.w ; Go.
  153.   
  154. .clear_old_logo:
  155.   move.l    #y_conv_table,a0
  156.   move.w    old_logo_y2,d0
  157.   add.w    d0,d0
  158.   move.l    a6,a5
  159.   add.w    (a0,d0.w),a5    ; a5 points on the first word to clear.
  160.   move.l    a5,$ffff8a32.w    ; Dest adress.
  161.   move.l    #$20092,$ffff8a2e.w ; Dest x inc and dest y inc.
  162.   move.l    #$8000a,$ffff8a36.w ; 8 words per line and 10 lines.
  163.   move.b    #$c0,$ffff8a3c.w ; Go.
  164.  
  165.   move.l    #movements,a5
  166.   move.l    position,d7
  167.   add.l    d7,a5
  168.   addq.l    #6,d7
  169.   cmp.l    #end_pos,d7
  170.   bne.s    .pos_ok
  171.   moveq.l    #$0,d7
  172. .pos_ok:
  173.   move.l    d7,position
  174.  
  175.   move.w    #$203,$ffff8a3a.w ; Source.
  176.  
  177. .print_logo:
  178.   move.w    (a5)+,d0    ; Y of the logo.
  179.   move.w    d0,old_logo_y2
  180.   add.w    d0,d0
  181.   move.l    a6,a4
  182.   add.w    (a0,d0.w),a4    ; a4 points on the dest adress.
  183.   move.l    a4,$ffff8a32.w    ; Dest adress.
  184.   move.l    #$20092,$ffff8a2e.w ; Dest x inc and dest y inc.
  185.   move.l    #$8000a,$ffff8a36.w ; 8 words per line and 10 lines.
  186.   move.l    #logo,$ffff8a24.w ; Source adress.
  187.   move.l    #$20002,$ffff8a20.w ; Source x inc and y inc.
  188.   move.b    #$c0,$ffff8a3c.w ; Go.
  189.  
  190. .print_cube:
  191.   move.w    (a5)+,d4    ; y1.
  192.   move.w    #144,d5    ; y2.
  193.   move.w    (a5)+,d6    ; Jelly coef.
  194.   move.l    a6,a3    ; Ramvideo adress.
  195.   move.l    #image,d7    ; Source image.
  196.   move.l    #zoom_adr,a4    ; Zoom routs adresses table.
  197.   jsr    jelly_cube
  198.  
  199. .put_ramvideo_adress:
  200.   move.l    a6,d0   
  201.   move.l    d0,d1
  202.   swap.w    d0
  203.   move.b    d0,$ffff8201.w
  204.   swap.w    d0
  205.   rol.w    #$8,d0
  206.   move.b    d0,$ffff8203.w
  207.   move.b    d1,$ffff820d.w
  208.  
  209. ;  cmpi.b    #$39,$fffffc02.w
  210. ;  beq.s    the_end
  211. .no_key:
  212.   move.l    $466.w,d0
  213.   cmp.w    #time-1,d0
  214.   ble    vbl_one
  215.  
  216.   move.l    old_vbl,$70.w    ; Restore the Vbl.
  217.  
  218. ; ************************************************************************
  219. ; ************************************************************************
  220. the_end:
  221.   move.w    #$25,-(sp) 
  222.   trap    #$e    ; Vsync
  223.   addq.l    #$2,sp
  224.  
  225.   move.b    old_rez,$ffff8260.w ; Restore screen features.
  226.   move.b    old_screen,$ffff8201.w
  227.   move.b    old_screen+1,$ffff8203.w
  228.   move.b    old_screen+2,$ffff820d.w
  229.  
  230.   move.l    old_vbl,$70.w    ; Restore the Vbl.
  231.   move.l    old_timerc,$114.w ; Restore old timerC rout.
  232.   move.b    old_conterm,$484.w
  233.   move.b    #$8,$fffffc02.w ; Restore mouse.
  234.   dc.w    $a009
  235.  
  236.   move.w    #$25,-(sp) 
  237.   trap    #$e    ; Vsync
  238.   addq.l    #$2,sp
  239.  
  240.   move.w    #$000,$ffff8240.w ; Devpac does not restore colors.
  241.   move.w    #$445,$ffff8242.w
  242.   move.w    #$445,$ffff8244.w
  243.   move.w    #$445,$ffff8246.w
  244.     
  245.   clr.w    -(sp)
  246.   trap    #$1
  247.  
  248. ; ************************************************************************
  249. null_timerc:        ; "Null" routine for the timerC.
  250.   addq.l    #$1,$4ba.w    ; Increment interrupt counter.
  251.   bclr.b    #$5,$fffffa11.w    ; Interrupt no more in service.
  252.   rte
  253.  
  254. ; ************************************************************************
  255. null_vbl:        ; "Null" vbl routine.
  256.   addq.l    #$1,$466.w    ; Increment _frclock.
  257.   cmp.l    #$0,$4d2.w    ; A music routine?
  258.   beq.s    .no_music
  259. .music:        ; Yes, so execute it.
  260.   move.l    a0,-(sp)
  261.   move.l    $4d2.w,a0
  262.   jsr    (a0)
  263.   move.l    (sp)+,a0
  264. .no_music:
  265.   rte
  266.  
  267. ; ************************************************************************
  268. demo_vbl:        ; "Null" vbl routine.
  269.   movem.l    d0/a0-a1,-(sp)
  270.   move.l    $466.w,d0
  271.   addq.l    #$1,d0    ; Increment _frclock.
  272.   move.l    d0,$466.w
  273.   cmp.w    #time-28,d0
  274.   bge.s    .near_end
  275. .put_colors:
  276.   cmp.w    #$1f,d0    ; Less than 32 vbls have passed.
  277.   ble.s    .ok1
  278.   move.w    #$1f,d0
  279. .ok1:
  280.   bclr.l    #$0,d0
  281.   lsl.w    #$4,d0    ; 32 bytes per set of colors.
  282.   move.w    d0,color_offset
  283.   move.l    #colors1,a0
  284.   add.w    d0,a0
  285.   move.w    #$8240,a1
  286.  rept    8
  287.   move.l    (a0)+,(a1)+
  288.  endr  
  289.  
  290. .timer_b:
  291.   move.b    #$0,$fffffa1b.w    ; Stop the timer.
  292.   move.b    #128,$fffffa21.w ; Wait 128 lines.
  293.   move.b    #$8,$fffffa1b.w    ; Event count mode.
  294.  
  295.   cmp.l    #$0,$4d2.w    ; A music routine?
  296.   beq.s    .no_music
  297. .music:        ; Yes, so execute it.
  298.   move.l    $4d2.w,a0
  299.   jsr    (a0)
  300. .no_music:
  301.   movem.l    (sp)+,d0/a0-a1
  302.   rte
  303.  
  304. .near_end
  305.   move.w    #time+3,a0
  306.   sub.w    d0,a0    ; a0=time-(_frclock).
  307.   move.w    a0,d0
  308.   bclr.l    #$0,d0
  309.   lsl.w    #$4,d0    ; 32 bytes per set of colors.
  310.   move.w    d0,color_offset
  311.   move.l    #colors1,a0
  312.   add.w    d0,a0
  313.   move.w    #$8240,a1
  314.  rept    8
  315.   move.l    (a0)+,(a1)+
  316.  endr  
  317.   bra.s    .timer_b
  318.   
  319. ;**************************************************************************
  320. timer_b:
  321.   move.b    #$0,$fffffa1b.w    ; Stop the timer.
  322.   move.l    a0,-(sp)
  323.   move.l    a1,-(sp)
  324.   move.l    #colors2,a0
  325.   add.w    color_offset,a0
  326.   move.w    #$8240,a1    ; Couleurs du bas.
  327.  rept    8
  328.   move.l     (a0)+,(a1)+
  329.  endr
  330.   move.l    (sp)+,a1
  331.   move.l    (sp)+,a0
  332.   bclr.b    #$0,$fffffa0f.w    ; Interruption finie.
  333.   rte
  334.  
  335. ; ************************************************************************
  336. wait_vbl:
  337.   move.w    d0,-(sp)
  338.   move.w    $468.w,d0
  339. .wait:
  340.   cmp.w    $468.w,d0
  341.   beq.s    .wait
  342.   move.w    (sp)+,d0
  343.   rts
  344.     
  345. ; ************************************************************************
  346. ; * The interesting routines.
  347. ; ************************************************************************
  348.  
  349. generate:
  350.   include    'a:\jelly\generate.s'
  351.   
  352. jelly_cube:
  353.   include    'a:\jelly\gel_cube.s'
  354.   
  355. ; ************************************************************************
  356.   Section DATA
  357.   
  358. colors1:
  359.   incbin    'a:\jelly\fade1.xxx'
  360.  
  361. colors2:
  362.   incbin    'a:\jelly\fade2.xxx'
  363.  
  364. movements:
  365.   incbin    'a:\jelly\movement.xxx'
  366.  
  367. y_conv_table:        ; Conv table for logo position ->adress.
  368. N set 72
  369.  rept    200
  370.   dc.w    N
  371. N set N+160
  372.  endr
  373.  
  374. logo:
  375.   incbin    'a:\jelly\pstvt.xxx'
  376.  
  377. image:
  378.   incbin    'a:\jelly\brune2.xxx'
  379.   
  380. ; ************************************************************************
  381.   Section BSS
  382.  
  383. old_vbl:        ; All the parameters for screen,
  384.   ds.l    1    ; and interrupts...
  385. old_timerc:
  386.   ds.l    1
  387. old_conterm:
  388.   ds.w    1 
  389. old_rez:
  390.   ds.w    1
  391. old_screen:
  392.   ds.l    1
  393.  
  394. screen1:
  395.   ds.b    32000
  396.  
  397. screen2:
  398.   ds.b    32000
  399.  
  400. zoom_code:        ; Space for the zooming routs.
  401.   ds.b    35000
  402. zoom_adr:
  403.   ds.l    50    ; Will contain the adresses of them.
  404.  
  405. position:        ; Adress in the movements.
  406.   ds.l    1
  407.   
  408. old_logo_y1:
  409.   ds.w    1
  410. old_logo_y2:
  411.   ds.w    1
  412. color_offset:
  413.   ds.w    1
  414.   
  415.   
  416.