home *** CD-ROM | disk | FTP | other *** search
/ M.u.C.S. Disc 2000 / MUCS2000.iso / falcon / modules / cascade / source / cascade.s next >
Text File  |  1999-06-23  |  7KB  |  440 lines

  1.    ; Copyright 1999 Tomas Berndtsson, <tomas@nocrew.org>
  2.  
  3.       include    macros.s
  4.     include    colours.s
  5.  
  6. VLM_MODULE    =    0
  7. GFXMODE    =    %100110100
  8. SHOWVBL    =    0
  9.  
  10. XRES    =    320
  11. YRES    =    240
  12. DOTS    =    128
  13. STARTY    =    0
  14.  
  15. COLS    =    3
  16.  
  17.     ifne    VLM_MODULE
  18.     opt    nodebug
  19.     output    d:\sound\whip!\vlm\cascade.vlm
  20.     include    vlmserv.s
  21.     endc
  22.  
  23.     text
  24.  
  25.     ifne    VLM_MODULE
  26.  
  27.     dc.b    "VLM2"
  28.     dc.l    infotext
  29.     dc.l    settings
  30.     dc.l    init
  31.     dc.l    deinit
  32.     dc.l    main
  33.  
  34.     else
  35.     
  36.     bsr.w    init
  37.     vsync
  38.  
  39.     endc
  40.  
  41.     ifne    VLM_MODULE
  42.     nop
  43.     endc
  44.     nop
  45. main
  46.     bsr    scrswap
  47.  
  48.     ifne    SHOWVBL
  49.     move.l    scrp,a3
  50.     move.w    $468.w,d7
  51.     subq.w    #1,d7
  52. .vsl
  53.     move.l    #$ffffffff,(a3)+
  54.     move.l    #$00000000,(a3)+
  55.     dbra    d7,.vsl
  56.  
  57.     move.l    #$00000000,(a3)+
  58.     move.l    #$00000000,(a3)+
  59.     move.l    #$00000000,(a3)+
  60.     move.l    #$00000000,(a3)+
  61.     endc
  62.  
  63. ;    not.l    $ffff9800.w
  64.  
  65.     ifne    VLM_MODULE
  66.     vlm_wait_vbl
  67.     else
  68.     vsync
  69.     endc
  70.  
  71. ;    not.l    $ffff9800.w
  72.  
  73.     
  74.     lea    dotpos,a2
  75.     lea    dotspeed,a4
  76.     move.l    savedp,a6
  77.     lea    tcfadetab,a5
  78. fadeold
  79.     move.l    (a6)+,a3    
  80.     tst.l    a3
  81.     beq.s    fadeold
  82.     bmi.s    .nomoreclr
  83.  
  84.     tst.l    option_track
  85.     bne.s    .dotrack
  86.     clr.l    (a3)
  87.     clr.l    640(a3)
  88.     clr.l    -4(a6)
  89.     bra.s    fadeold
  90. .dotrack
  91.     moveq    #0,d0
  92.     move.w    (a3),d0
  93.     move.w    (a5,d0.l*2),(a3)
  94.     move.w    (a3),640(a3)
  95.     move.w    2(a3),d0
  96.     move.w    (a5,d0.l*2),2(a3)
  97.     move.w    2(a3),642(a3)
  98.     tst.l    (a3)
  99.     bne.s    fadeold
  100.     clr.l    -4(a6)
  101.     bra.s    fadeold
  102. .nomoreclr
  103.     move.l    savedp,a6
  104.  
  105.     bsr    fixspec
  106. ;    bsr    fixvol
  107.     move.l    scrp,a3
  108.  
  109.     move.l    left_spec_p,a0
  110.     move.l    right_spec_p,a1
  111.     bsr    docolumn
  112.  
  113.     cmp.w    #15,steps
  114.     blt    .nomore
  115.  
  116. ;    bsr    fixspec
  117. ;    bsr    fixvol
  118.     move.l    left_spec_p,a0
  119.     move.l    right_spec_p,a1
  120.     bsr    docolumn
  121.  
  122.     cmp.w    #30,steps
  123.     blt    .nomore
  124.  
  125. ;    bsr    fixspec
  126. ;    bsr    fixvol
  127.     move.l    left_spec_p,a0
  128.     move.l    right_spec_p,a1
  129.     bsr    docolumn
  130.  
  131. ;    move.l    #-1,(a6)
  132.  
  133.     move.w    #30,steps
  134. .nomore
  135.     addq.w    #1,steps
  136.     
  137.     ifne    VLM_MODULE
  138.  
  139.     rts
  140.     
  141.     else
  142.  
  143.     cmp.b    #$3b,$fffffc02.w
  144.     bne    main
  145.  
  146. slu
  147.     stdexit
  148.     pea    0.w
  149.     trap    #1
  150.  
  151.     endc
  152.  
  153.  
  154. fixspec
  155.     ifne    VLM_MODULE
  156.     vlm_get_left_spec left_spec_p
  157.     vlm_get_right_spec right_spec_p
  158.     else
  159.     move.l    #fake_left_spec,left_spec_p
  160.     move.l    #fake_right_spec,right_spec_p
  161.     endc
  162.     rts
  163.  
  164. fixvol
  165.     ifne    VLM_MODULE
  166.     vlm_get_left_volume left_volume+2
  167.     vlm_get_right_volume right_volume+2
  168.     else
  169.     move.w    #32767,left_volume+2
  170.     move.w    #65535,right_volume+2
  171.     endc
  172.     clr.w    left_volume
  173.     clr.w    right_volume
  174.     rts
  175.  
  176. docolumn
  177.     move.w    #STARTY,d7
  178. dl
  179. left
  180.     move.l    (a2),d0
  181.     bne.s    .placed
  182.     move.w    d7,d0
  183.     mulu.w    #320,d0
  184.     moveq    #0,d1
  185.     move.w    (a0)+,d1
  186.     sub.l    option_sense,d1
  187.     bpl.s    .notneg
  188.     clr.l    d1
  189. .notneg
  190. ;    add.l    left_volume,d1
  191.     lsr.l    #8,d1
  192.     lsr.w    #5,d1
  193.     move.w    d1,(a4)
  194.     clr.w    2(a4)
  195. .placed    
  196.     move.w    (a4)+,d2
  197.     lea    xspdcoltab_l,a5
  198.     move.l    (a5,d2.w*8),d1
  199.     move.l    4(a5,d2.w*8),d6
  200.     move.w    (a4),d2
  201.     addq.w    #1,(a4)+
  202.     lea    yspeedtab,a5
  203.     add.l    (a5,d2.w*4),d1
  204.     add.l    d0,d1
  205.     cmp.l    #239*320,d1
  206.     blt.s    .not_out
  207.     clr.l    (a2)+
  208.     bra.s    .no_dot
  209. .not_out
  210.     move.l    d1,(a2)+
  211.     lea    (a3,d1.l*2),a5
  212.     or.l    d6,(a5)
  213.     or.l    d6,640(a5)
  214.  
  215. .testnext    tst.l    (a6)+
  216.     bmi.s    .found
  217.     bne.s    .testnext
  218. .found    move.l    a5,-4(a6)
  219.  
  220. ;    move.l    a5,(a6)+
  221.  
  222. .no_dot    
  223.  
  224. right
  225.     move.l    (a2),d0
  226.     bne.s    .placed
  227.     move.w    d7,d0
  228.     mulu.w    #320,d0
  229.     add.l    #318,d0
  230.     moveq    #0,d1
  231.     move.w    (a1)+,d1
  232.     sub.l    option_sense,d1
  233.     bpl.s    .notneg
  234.     clr.l    d1
  235. .notneg
  236. ;    add.l    right_volume,d1
  237.     lsr.l    #8,d1
  238.     lsr.w    #5,d1
  239.     move.w    d1,(a4)
  240.     clr.w    2(a4)
  241. .placed    
  242.     move.w    (a4)+,d2
  243.     lea    xspdcoltab_r,a5
  244.     move.l    (a5,d2.w*8),d1
  245.     move.l    4(a5,d2.w*8),d6
  246.     move.w    (a4),d2
  247.     addq.w    #1,(a4)+
  248.     lea    yspeedtab,a5
  249.     add.l    (a5,d2.w*4),d1
  250.     add.l    d0,d1
  251.     cmp.l    #239*320,d1
  252.     blt.s    .not_out
  253.     clr.l    (a2)+
  254.     bra.s    .no_dot
  255. .not_out
  256.     move.l    d1,(a2)+
  257.     lea    (a3,d1.l*2),a5
  258.     or.l    d6,(a5)
  259.     or.l    d6,640(a5)
  260.  
  261. .testnext    tst.l    (a6)+
  262.     bmi.s    .found
  263.     bne.s    .testnext
  264. .found    move.l    a5,-4(a6)
  265.  
  266. ;    move.l    a5,(a6)+
  267.  
  268. .no_dot    
  269.  
  270.     addq.w    #1,d7
  271.     cmp.w    #DOTS+STARTY,d7
  272.     bne    dl
  273.  
  274.     rts
  275.  
  276.  
  277. init    
  278.     ifne    VLM_MODULE
  279.  
  280.     move.l    a0,service_struct
  281.     vlm_set_resolution #VLM_320x240x16
  282.     
  283.     else
  284.  
  285.     super
  286.     stdinit    #-1,#-1,#GFXMODE
  287.  
  288.     clr.l    $ffff9800.w
  289.  
  290.     lea    fake_left_spec,a0
  291.     lea    fake_right_spec,a1
  292.     move.w    #128-1,d7
  293. .ssl
  294.     move.w    d7,d6
  295.     asl.w    #8,d6
  296.     asl.w    #1,d6
  297.     or.w    #$01ff,d6
  298.     move.w    d6,(a0)+
  299.     move.w    d6,(a1)+
  300.     dbra    d7,.ssl
  301.  
  302.     endc
  303.     
  304.     lea    dotpos,a0
  305.     move.w    #DOTS*2*2-1,d7
  306. .cdpl
  307.     clr.l    (a0)+
  308.     dbra    d7,.cdpl
  309.  
  310.     lea    saved1,a0
  311.     lea    saved2,a1
  312.     moveq    #-1,d0
  313.     move.w    #DOTS*COLS*32*2+1-1,d7
  314. .sl
  315.     move.l    d0,(a0)+
  316.     move.l    d0,(a1)+
  317.     dbra    d7,.sl
  318.  
  319.     clr.w    steps
  320.  
  321.     rts
  322.  
  323. deinit
  324.     rts
  325.  
  326. scrswap
  327.     ifeq    VLM_MODULE
  328.     move.l    scrp,-(sp)
  329.     move.l    scrp+4,scrp
  330.     move.b    1(sp),$ffff8201.w
  331.     move.b    2(sp),$ffff8203.w
  332.     move.b    3(sp),$ffff820d.w
  333.     move.l    (sp)+,scrp+4
  334.  
  335.     else
  336.  
  337.     move.l    scrp,tmpscrp
  338.     move.l    scrp+4,scrp
  339.     move.l    tmpscrp,scrp+4
  340.     vlm_set_scradr tmpscrp
  341.  
  342.     endc
  343.  
  344.     move.l    savedp,d0
  345.     move.l    savedp+4,savedp
  346.     move.l    d0,savedp+4
  347.  
  348.     rts
  349.  
  350.     data
  351.  
  352. scrp    dc.l    scr1,scr2
  353. savedp    dc.l    saved1,saved2
  354.  
  355.     ifne    VLM_MODULE
  356. infotext    dc.b    'CASCADE',0
  357.     dc.b    'Author:  NoBrain/NoCrew',0
  358.     dc.b    'Version: 0.42',0
  359.     dc.b    'Date:    1999-06-17',0
  360.     dc.b    0
  361.     even
  362.     
  363. settings    dc.l    2
  364.  
  365.     dc.l    par1name
  366.     dc.l    1
  367. option_track    dc.l    1
  368.     dc.l    0
  369.  
  370.     dc.l    par2name
  371.     dc.l    3
  372. option_sense    dc.l    $dce
  373.     dc.l    par2struct
  374.  
  375. par1name    dc.b    'CASCADE TRACKING',0
  376. par2name    dc.b    'SENSITIVITY',0
  377.     even
  378.  
  379. par2struct    dc.l    0,32767
  380.  
  381.     else
  382.  
  383. option_track    dc.l    1
  384. option_sense    dc.l    $dce
  385.         
  386.     endc
  387.     
  388. tcfadetab    incbin    'tcfade.tab'
  389. yspeedtab    incbin    'yspeed.tab'
  390.  
  391. xspdcoltab_r    dc.l    -0,(R00+G00+B00)*65536+R00+G00+B00
  392.     dc.l    -1,(R01+G08+B02)*65536+R01+G04+B18
  393.     dc.l    -2,(R02+G16+B04)*65536+R02+G08+B20
  394.     dc.l    -3,(R03+G24+B06)*65536+R03+G12+B22
  395.     dc.l    -4,(R04+G32+B08)*65536+R04+G16+B18
  396.     dc.l    -5,(R05+G40+B10)*65536+R05+G20+B14
  397.     dc.l    -6,(R06+G48+B12)*65536+R06+G24+B10
  398.     dc.l    -7,(R07+G63+B14)*65536+R06+G48+B12
  399.  
  400.  
  401. xspdcoltab_l    dc.l    0,(R00+G00+B00)*65536+R00+G00+B00
  402.     dc.l    1,(R00+G02+B18)*65536+R04+G04+B02
  403.     dc.l    2,(R03+G04+B20)*65536+R08+G08+B04
  404.     dc.l    3,(R06+G06+B22)*65536+R12+G12+B06
  405.     dc.l    4,(R09+G08+B18)*65536+R16+G16+B08
  406.     dc.l    5,(R12+G10+B14)*65536+R20+G20+B10
  407.     dc.l    6,(R15+G12+B10)*65536+R24+G24+B12
  408.     dc.l    7,(R24+G24+B12)*65536+R31+G40+B14
  409.  
  410.  
  411.     bss
  412.  
  413.     ifne    VLM_MODULE
  414. tmpscrp    ds.l    1
  415. service_struct ds.l    1
  416.     endc
  417.     
  418.     ifeq    VLM_MODULE
  419. fake_left_spec    ds.w    128
  420. fake_right_spec    ds.w    128
  421.     stdbss
  422.     endc
  423.  
  424. steps    ds.w    1
  425.  
  426. left_spec_p    ds.l    1
  427. right_spec_p    ds.l    1
  428. left_volume    ds.l    1
  429. right_volume    ds.l    1
  430.  
  431.  
  432. dotpos    ds.l    DOTS*COLS*2
  433. dotspeed    ds.l    DOTS*COLS*2*2
  434.  
  435. saved1    ds.l    DOTS*COLS*32*2+1
  436. saved2    ds.l    DOTS*COLS*32*2+1
  437.  
  438. scr1    ds.w    XRES*YRES
  439. scr2    ds.w    XRES*YRES
  440.