home *** CD-ROM | disk | FTP | other *** search
/ M.u.C.S. Disc 2000 / MUCS2000.iso / falcon / whip.031 / vlm / whipsp11 / source / rgbsplit.s < prev    next >
Text File  |  1999-06-14  |  9KB  |  485 lines

  1. ;
  2. ; VLM EXAMPLE MODULE                                             NO/Escape'98
  3. ;
  4.  
  5.         section    text
  6.  
  7. *** VLM STRUCTURE **************************************************************
  8.  
  9.         dc.b    "VLM2"        ;vlm module type
  10.         dc.l    infotext    ;pointer to infotext
  11.         dc.l    settings    ;pointer to settings-structure
  12.         dc.l    init        ;pointer to init routine
  13.         dc.l    deinit        ;pointer to deinit routine
  14.         dc.l    main        ;pointer to mainloop routine
  15.  
  16. ;SERVICE ROUTINES PROVIDED BY THE CALLING PROGRAM
  17.  
  18. set_vblrout:
  19. ;a0: new vbl subroutine
  20.         movea.l service_struct,a1
  21.         movea.l (a1),a1
  22.         jsr     (a1)
  23.         rts
  24.  
  25. wait_vbl:    movea.l    service_struct,a1
  26.         movea.l    4(a1),a1
  27.         jsr    (a1)
  28.         rts
  29.  
  30. set_scradr:
  31. ;a0: new screen adress
  32.         movea.l    service_struct,a1
  33.         movea.l    8(a1),a1
  34.         jsr    (a1)
  35.         rts
  36.  
  37. set_resolution:
  38. ;d0: number of the wanted resolution
  39.         movea.l    service_struct,a1
  40.         movea.l    12(a1),a1
  41.         jsr    (a1)
  42.         rts
  43.  
  44. get_left_spec:    movea.l    service_struct,a1
  45.         movea.l    16(a1),a1
  46.         jsr    (a1)        ;returns in a0 the adress of left spec
  47.                 rts
  48.  
  49. get_right_spec:    movea.l    service_struct,a1
  50.         movea.l    20(a1),a1
  51.         jsr    (a1)            ;returns in a0 the adress of right spec
  52.         rts
  53.  
  54. get_left_volume:movea.l    service_struct,a1
  55.         movea.l 24(A1),A1
  56.         jsr    (A1)        ;returns in d0 the left volume value
  57.         rts
  58.  
  59. get_right_volume:
  60.         movea.l service_struct,a1
  61.         movea.l 28(a1),a1
  62.         jsr    (a1)        ;returns in d0 the right volume value
  63.         rts
  64.  
  65. get_left_osci:    movea.l service_struct,a1
  66.         movea.l    32(A1),a1
  67.         jsr    (a1)        ;returns in a0 the adress of osci data
  68.         rts
  69.  
  70. get_right_osci:    movea.l    service_struct,a1
  71.         movea.l    36(a1),a1
  72.         jsr    (a1)        ;returns in a0 the adress of osci data
  73.         rts
  74.  
  75. service_struct:    dc.l    0        ;must be set in 'init'
  76.  
  77. ********************************************************************************
  78. infotext:       
  79.         dc.b    'rgbsplitter',0
  80.         dc.b    ' author: evil ',0
  81.         dc.b    'version: 1.1',0
  82.         dc.b    '   date: june 15, 1999',0
  83.         dc.b    0
  84.         even
  85.  
  86. settings:       dc.l    7
  87.  
  88.         dc.l    stepratename
  89.         dc.l    2
  90. steprate:    dc.l    0
  91.         dc.l    stepratestruct
  92.  
  93.         dc.l    redbrightname
  94.         dc.l    3
  95. redbrightness:    dc.l    384
  96.         dc.l    redbrightstruct
  97.  
  98.         dc.l    greenbrightname
  99.         dc.l    3
  100. greenbrightness:dc.l    384
  101.         dc.l    greenbrightstruct
  102.  
  103.         dc.l    bluebrightname
  104.         dc.l    3
  105. bluebrightness:    dc.l    384
  106.         dc.l    bluebrightstruct
  107.  
  108.         dc.l    sinxname
  109.         dc.l    3
  110. sinxadd:    dc.l    3
  111.         dc.l    sinxstruct
  112.  
  113.         dc.l    sinyname
  114.         dc.l    3
  115. sinyadd:    dc.l    4
  116.         dc.l    sinystruct
  117.  
  118.         dc.l    timeslicename
  119.         dc.l    3
  120. timeslice:    dc.l    4
  121.         dc.l    timeslicestruct
  122.  
  123. redbrightstruct:dc.l    0,1024
  124. greenbrightstruct:dc.l    0,1024
  125. bluebrightstruct:dc.l    0,1024
  126. timeslicestruct:dc.l    1,20
  127. sinxstruct:    dc.l    0,10
  128. sinystruct:    dc.l    0,10
  129.  
  130.  
  131. stepratestruct:    dc.l    3
  132.         dc.b    'NORMAL',0
  133.         dc.b    'STRONG',0
  134.         dc.b    'HEFTIG!',0
  135.         even
  136. redbrightname:    dc.b    'RED BRIGHTNESS(LEFT VOL)',0
  137.         even
  138. greenbrightname:dc.b    'GREEN BRIGHTNESS(MAIN VOL)',0
  139.         even
  140. bluebrightname:    dc.b    'BLUE BRIGHTNESS(RIGHT VOL)',0
  141.         even
  142. timeslicename:    dc.b    'TIMESLICE:',0
  143.         even
  144. sinxname:    dc.b    'SINUS-X SPEED:',0
  145.         even
  146. sinyname:    dc.b    'SINUS-Y SPEED:',0
  147.         even
  148. stepratename:    dc.b    'STEPRATE (SENSITIVITY):',0
  149.         even
  150.  
  151.  
  152.  
  153.  
  154. init:           
  155. ;a0: service structure
  156.         move.l    a0,service_struct
  157.  
  158.         bsr.w    split_init
  159.         bsr.w    clear_screens
  160.  
  161.         movea.l    scradr2,a0    ;set new screen adress
  162.         bsr.w    set_scradr
  163.  
  164.         move.l    #2,d0        ;set resolution to 320x100
  165.         bsr.w    set_resolution
  166.                 rts
  167. deinit:        rts
  168.  
  169.  
  170. clear_screens:
  171.         move.l    scradr1,a0
  172.         move.l    scradr2,a1
  173.         move.l    scradr3,a2
  174.         move.w    #320*100*2/64-1,d7
  175. .loop:        rept    16
  176.         clr.l    (a0)+
  177.         clr.l    (a1)+
  178.         clr.l    (a2)+
  179.         endr
  180.         dbra    d7,.loop
  181.         rts
  182.  
  183.  
  184. main:        jsr    wait_vbl
  185.         jsr    switch_screens
  186.  
  187.         bsr.w    split_main
  188.  
  189.         rts            ;end of the mainroutine
  190.  
  191.  
  192.  
  193. split_vbl:
  194.         move.l    sinxadd,d0
  195.         lsl.l    #2,d0
  196.  
  197.         move.l    sinyadd,d1
  198.         lsl.l    #2,d1
  199.  
  200.         add.l    d0,xsinred
  201.         and.l    #$1fff,xsinred
  202.         add.l    d1,ysinred
  203.         and.l    #$1fff,ysinred
  204.  
  205.         add.l    d0,xsingreen
  206.         and.l    #$1fff,xsingreen
  207.         add.l    d1,ysingreen
  208.         and.l    #$1fff,ysingreen
  209.  
  210.         add.l    d0,xsinblue
  211.         and.l    #$1fff,xsinblue
  212.         add.l    d1,ysinblue
  213.         and.l    #$1fff,ysinblue
  214.  
  215.  
  216.         tst.l    countdown
  217.         beq.s    .no
  218.         subq.l    #1,countdown
  219. .no:
  220.         cmp.l    #8,leftvol
  221.         blt.s    .noleft
  222.         subq.l    #8,leftvol
  223. .noleft:    cmp.l    #8,rightvol
  224.         blt.s    .noright
  225.         subq.l    #8,rightvol
  226. .noright:    cmp.l    #8,mainvol
  227.         blt.s    .nomain
  228.         subq.l    #8,mainvol
  229. .nomain:
  230.  
  231.  
  232.         rts
  233.  
  234.  
  235. split_main:
  236.  
  237.         lea.l    sinus,a0
  238.  
  239.         move.l    xsinred,d0
  240.         move.l    (a0,d0.w),d1
  241.         muls.w    #80,d1
  242.         asr.l    #8,d1
  243.         asr.l    #7,d1
  244.         move.l    d1,xposred
  245.  
  246.                 move.l    ysinred,d0
  247.                 move.l    (a0,d0.w),d1
  248.                 muls.w    #64,d1
  249.                 asr.l    #8,d1
  250.                 asr.l    #7,d1
  251.         asl.l    #8,d1
  252.         move.l    d1,yposred
  253.  
  254.                 move.l    xsingreen,d0
  255.             move.l    (a0,d0.w),d1
  256.                 muls.w    #144,d1
  257.                 asr.l    #8,d1
  258.                 asr.l    #7,d1
  259.         move.l    d1,xposgreen
  260.  
  261.              move.l    ysingreen,d0
  262.                 move.l    (a0,d0.w),d1
  263.                 muls.w    #80,d1
  264.                 asr.l    #8,d1
  265.                 asr.l    #7,d1
  266.         asl.l    #8,d1
  267.         move.l    d1,yposgreen
  268.  
  269.                 move.l    xsinblue,d0
  270.             move.l    (a0,d0.w),d1
  271.                 muls.w    #48,d1
  272.                 asr.l    #8,d1
  273.                 asr.l    #7,d1
  274.         move.l    d1,xposblue
  275.  
  276.                 move.l    ysinblue,d0
  277.                 move.l    (a0,d0.w),d1
  278.                 muls.w    #32,d1
  279.                 asr.l    #8,d1
  280.                 asr.l    #7,d1
  281.         asl.l    #8,d1
  282.         move.l    d1,yposblue
  283.  
  284.  
  285.         bsr.w    get_left_volume
  286.         move.l    d0,d1
  287.         bsr.w    get_right_volume
  288.         move.l    d0,d2
  289.         add.l    d1,d0
  290.         lsr.l    #1,d0
  291.  
  292.  
  293.         tst.l    countdown
  294.         bne.w    .stepdone
  295.         move.l    timeslice,countdown
  296.  
  297.         cmp.l    #1,steprate
  298.         beq.s    .step1
  299.         cmp.l    #2,steprate
  300.         beq.s    .step2
  301.  
  302. .step0:        lsr.l    #7,d0
  303.         and.l    #%00000000000000000000000111111110,d0
  304.         move.l    d0,mainvol
  305.         lsr.l    #7,d1
  306.         and.l    #%00000000000000000000000111111110,d1
  307.         move.l    d1,leftvol
  308.         lsr.l    #7,d2
  309.         and.l    #%00000000000000000000000111111110,d2
  310.         move.l    d2,rightvol
  311.         bra.s    .stepdone
  312. .step1:        lsr.l    #6,d0
  313.         and.l    #%00000000000000000000001111111110,d0
  314.         move.l    d0,mainvol
  315.         lsr.l    #6,d1
  316.         and.l    #%00000000000000000000001111111110,d1
  317.         move.l    d1,leftvol
  318.         lsr.l    #6,d2
  319.         and.l    #%00000000000000000000001111111110,d2
  320.         move.l    d2,rightvol
  321.         bra.s    .stepdone
  322. .step2:        lsr.l    #5,d0
  323.         and.l    #%00000000000000000000011111111110,d0
  324.         move.l    d0,mainvol
  325.         lsr.l    #5,d1
  326.         and.l    #%00000000000000000000011111111110,d1
  327.         move.l    d1,leftvol
  328.         lsr.l    #5,d2
  329.         and.l    #%00000000000000000000011111111110,d2
  330.         move.l    d2,rightvol
  331.  
  332. .stepdone:
  333.  
  334.         move.l    scradr1,a0
  335.         lea.l    64(a0),a0
  336.  
  337.         lea.l    flare+788+256*78+64,a1
  338.         move.l    a1,a2
  339.         move.l    a1,a3
  340.         add.l    xposred,a1
  341.         add.l    yposred,a1
  342.         add.l    xposgreen,a2
  343.         add.l    yposgreen,a2
  344.         add.l    xposblue,a3
  345.         add.l    yposblue,a3
  346.  
  347.         lea.l    redpal,a4
  348.         lea.l    greenpal,a5
  349.         lea.l    bluepal,a6
  350.  
  351.         add.l    leftvol,a4
  352.         add.l    mainvol,a5
  353.         add.l    rightvol,a6
  354.  
  355.         move.l    redbrightness,d0
  356.         bclr    #0,d0
  357.         add.l    d0,a4
  358.  
  359.         move.l    greenbrightness,d0
  360.         bclr    #0,d0
  361.         add.l    d0,a5
  362.  
  363.         move.l    bluebrightness,d0
  364.         bclr    #0,d0
  365.         add.l    d0,a6
  366.  
  367.         clr.l    d0
  368.  
  369.         move.w    #100-1,d7
  370. .loop:        move.w    #128/8-1,d6
  371. .loop2:
  372.         rept    8
  373.         move.b    (a1)+,d0
  374.         move.w    (a4,d0.w*2),d1
  375.         move.b    (a2)+,d0
  376.         add.w    (a5,d0.w*2),d1
  377.         move.b    (a3)+,d0
  378.         add.w    (a6,d0.w*2),d1
  379.         move.w    d1,(a0)+
  380.         move.w    d1,(a0)+
  381.         endr
  382.  
  383.         dbra    d6,.loop2
  384.         lea.l    640-512(a0),a0
  385.         lea.l    128(a1),a1
  386.         lea.l    128(a2),a2
  387.         lea.l    128(a3),a3
  388.         dbra    d7,.loop
  389.  
  390.         rts
  391.  
  392.  
  393.  
  394. split_init:
  395.         lea.l    split_vbl,a0
  396.         bsr.w    set_vblrout
  397.  
  398.         lea.l    pal,a0
  399.         lea.l    redpal+512,a1
  400.         lea.l    greenpal+512,a2
  401.         lea.l    bluepal+512,a3
  402.  
  403.         move.w    #256/2-1,d7
  404. .loop        clr.l    -512(a1)
  405.         clr.l    -512(a2)
  406.         clr.l    -512(a3)
  407.         move.l    512(a0),(a2)+
  408.         move.l    1024(a0),(a3)+
  409.         move.l    (a0)+,(a1)+
  410.         dbra    d7,.loop
  411.  
  412.         lea.l    redpal+1024,a1
  413.         lea.l    greenpal+1024,a2
  414.         lea.l    bluepal+1024,a3
  415.  
  416.         move.l    -4(a1),d0
  417.         move.l    -4(a2),d1
  418.         move.l    -4(a3),d2
  419.  
  420.         move.w    #256*8/2-1,d7
  421. .loop2:        move.l    d0,(a1)+
  422.         move.l    d1,(a2)+
  423.         move.l    d2,(a3)+
  424.         dbra    d7,.loop2
  425.         rts
  426.  
  427.  
  428.  
  429. xsinred:    ds.l    1
  430. xsingreen:    ds.l    1
  431. xsinblue:    ds.l    1
  432. ysinred:    ds.l    1
  433. ysingreen:    ds.l    1
  434. ysinblue:    ds.l    1
  435. xposred:    ds.l    1
  436. xposgreen:    ds.l    1
  437. xposblue:    ds.l    1
  438. yposred:    ds.l    1
  439. yposgreen:    ds.l    1
  440. yposblue:    ds.l    1
  441.  
  442. leftvol:    ds.l    1
  443. rightvol:    ds.l    1
  444. mainvol:    ds.l    1
  445.  
  446. countdown:    ds.l    1
  447.  
  448.  
  449. ;ROUTINE SWITCHES VISIBLE SCREEN AND CYCLES THE SCREENADRESSES
  450. switch_screens:
  451.         move.l    scradr3,d0
  452.         move.l    scradr2,scradr3
  453.         move.l    scradr1,scradr2
  454.         move.l    d0,scradr1
  455.         movea.l    scradr2,a0
  456.         jsr    set_scradr
  457.         rts
  458.  
  459.         section    data
  460.  
  461.         even
  462.  
  463. flare:        incbin    'flare.apx'
  464.         even
  465. sinus:        incbin    'sinus.dat'
  466.         even
  467. pal:        incbin    'pal.16b'
  468.         even
  469.  
  470.  
  471. scradr1:    dc.l    scr1+256
  472. scradr2:    dc.l    scr2+256
  473. scradr3:    dc.l    scr3+256
  474.  
  475.         section    bss
  476.  
  477. redpal:        ds.w    256+256+(256*8)
  478. greenpal:    ds.w    256+256+(256*8)
  479. bluepal:    ds.w    256+256+(256*8)
  480.  
  481. scr1:        ds.w    320*100
  482. scr2:        ds.w    320*100
  483. scr3:        ds.w    320*100
  484.  
  485.         end