home *** CD-ROM | disk | FTP | other *** search
/ Fujiology Archive / fujiology_archive_v1_0.iso / !FALCON / !BONUS / WHIPPLUG / WHIPBU10.ZIP / whipbu10 / source / bump.s < prev    next >
Text File  |  1999-06-11  |  9KB  |  438 lines

  1. ;
  2. ; VLM EXAMPLE MODULE                                             NO/Escape'98
  3. ;
  4.  
  5.                 ;OUTPUT 'E:\VOODOO\VLM\EXAMPLE.VLM'
  6.                 TEXT
  7.  
  8. *** VLM STRUCTURE **************************************************************
  9.  
  10.                 DC.B "VLM2"     ;vlm module type
  11.                 DC.L infotext   ;pointer to infotext
  12.                 DC.L settings   ;pointer to settings-structure
  13.                 DC.L init       ;pointer to init routine
  14.                 DC.L deinit     ;pointer to deinit routine
  15.                 DC.L main       ;pointer to mainloop routine
  16.  
  17. ;SERVICE ROUTINES PROVIDED BY THE CALLING PROGRAM
  18.  
  19. set_vblrout:
  20. ;a0: new vbl subroutine
  21.                 movea.l service_struct,A1
  22.                 movea.l (A1),A1
  23.                 jsr     (A1)
  24.                 rts
  25.  
  26. wait_vbl:
  27.                 movea.l service_struct,A1
  28.                 movea.l 4(A1),A1
  29.                 jsr     (A1)
  30.                 rts
  31.  
  32. set_scradr:
  33. ;a0: new screen adress
  34.                 movea.l service_struct,A1
  35.                 movea.l 8(A1),A1
  36.                 jsr     (A1)
  37.                 rts
  38.  
  39. set_resolution:
  40. ;d0: number of the wanted resolution
  41.                 movea.l service_struct,A1
  42.                 movea.l 12(A1),A1
  43.                 jsr     (A1)
  44.                 rts
  45.  
  46. get_left_spec:
  47.                 movea.l service_struct,A1
  48.                 movea.l 16(A1),A1
  49.                 jsr     (A1)            ;returns in a0 the adress of left spec
  50.                 rts
  51.  
  52. get_right_spec:
  53.                 movea.l service_struct,A1
  54.                 movea.l 20(A1),A1
  55.                 jsr     (A1)            ;returns in a0 the adress of right spec
  56.                 rts
  57.  
  58. get_left_volume:
  59.                 movea.l service_struct,A1
  60.                 movea.l 24(A1),A1
  61.                 jsr     (A1)            ;returns in d0 the left volume value
  62.                 rts
  63.  
  64. get_right_volume:
  65.                 movea.l service_struct,A1
  66.                 movea.l 28(A1),A1
  67.                 jsr     (A1)            ;returns in d0 the right volume value
  68.                 rts
  69.  
  70. get_left_osci:
  71.                 movea.l service_struct,A1
  72.                 movea.l 32(A1),A1
  73.                 jsr     (A1)            ;returns in a0 the adress of osci data
  74.                 rts
  75.  
  76. get_right_osci:
  77.                 movea.l service_struct,A1
  78.                 movea.l 36(A1),A1
  79.                 jsr     (A1)            ;returns in a0 the adress of osci data
  80.                 rts
  81.  
  82. service_struct: DC.L 0          ;must be set in 'init'
  83.  
  84. ********************************************************************************
  85. infotext:       
  86.                 DC.B 'bumpmapper',0
  87.                 DC.B ' author: evil ',0
  88.                 DC.B 'version: 1.0',0
  89.                 DC.B '   date: june 12, 1999',0
  90.                 DC.B 0
  91.                 EVEN
  92.  
  93. settings:       dc.l    6
  94.  
  95.  
  96.         dc.l    stepname
  97.         dc.l    2
  98. steprate:    dc.l    0
  99.         dc.l    stepstruct
  100.  
  101.         dc.l    brightname
  102.         dc.l    3
  103. brightness:    dc.l    256
  104.         dc.l    brightstruct
  105.  
  106.  
  107.         dc.l    colname
  108.         dc.l    2
  109. palette:    dc.l    0
  110.         dc.l    colstruct
  111.  
  112.         dc.l    slicename
  113.         dc.l    3
  114. timeslice:    dc.l    2
  115.         dc.l    slicestruct
  116.  
  117.         dc.l    sinxname
  118.         dc.l    3
  119. sinxadd:    dc.l    5
  120.         dc.l    sinxstruct
  121.  
  122.         dc.l    sinyname
  123.         dc.l    3
  124. sinyadd:    dc.l    4
  125.         dc.l    sinystruct
  126.  
  127.  
  128. slicestruct:    dc.l    1,20
  129. brightstruct:    dc.l    0,768
  130.  
  131. sinxstruct:    dc.l    0,20
  132. sinystruct:    dc.l    0,20
  133.  
  134. stepstruct:    dc.l    3
  135.         dc.b    'NORMAL',0
  136.         dc.b    'INTENSE',0
  137.         dc.b    'EXTREME',0
  138.         even
  139.  
  140. colstruct:    dc.l    5
  141.         dc.b    'PALETTE 1 (BLUE)',0
  142.         dc.b    'PALETTE 2 (RED)',0
  143.         dc.b    'PALETTE 3 (CYAN-BLUE)',0
  144.         dc.b    'PALETTE 4 (MAGNETA)',0
  145.         dc.b    'PALETTE 5 (YELLOW)',0
  146.         even
  147.  
  148. colname:    dc.b    'COLOUR PALETTE:',0
  149.         even
  150. slicename:    dc.b    'TIMESLICE:',0
  151.         even
  152. stepname:    dc.b    'STEPRATE (SENSITIVITY)',0
  153.         even
  154. brightname:    dc.b    'BRIGHTNESS:',0
  155.         even
  156. sinxname:    dc.b    'X-SINUS SPEED:',0
  157.         even
  158. sinyname:    dc.b    'Y-SINUS SPEED:',0
  159.         even
  160.  
  161.  
  162.  
  163.  
  164. init:           
  165. ;a0: service structure
  166.                 move.l  A0,service_struct
  167.  
  168.         bsr.w    bump_init
  169.         bsr.w    clear_screens
  170.  
  171.                 movea.l scradr2,A0      ;set new screen adress
  172.                 bsr     set_scradr
  173.  
  174.                 move.l  #2,D0           ;set resolution to 320x100
  175.                 bsr     set_resolution
  176.                 rts
  177. deinit:         rts
  178.  
  179.  
  180. clear_screens:
  181.         move.l    scradr1,a0
  182.         move.l    scradr2,a1
  183.         move.l    scradr3,a2
  184.         move.w    #320*100*2/64-1,d7
  185. .loop:        rept    16
  186.         clr.l    (a0)+
  187.         clr.l    (a1)+
  188.         clr.l    (a2)+
  189.         endr
  190.         dbra    d7,.loop
  191.         rts
  192.  
  193.  
  194. main:           jsr     wait_vbl
  195.                 jsr     switch_screens
  196.  
  197.         bsr.w    bump_main
  198.  
  199.                 rts                     ;end of the mainroutine
  200.  
  201.  
  202. bump_vbl:    move.l    d0,-(sp)
  203.  
  204.         move.l    sinxadd,d0
  205.         lsl.l    #2,d0
  206.         add.l    d0,xsin
  207.         and.l    #$1fff,xsin
  208.  
  209.         move.l    sinyadd,d0
  210.         lsl.l    #2,d0
  211.         add.l    d0,ysin
  212.         and.l    #$1fff,ysin
  213.  
  214.         tst.l    countdown
  215.         beq.s    .no
  216.         subq.l    #1,countdown
  217. .no:        cmp.l    #8,voladd
  218.         ble.s    .no2
  219.         subq.l    #8,voladd
  220. .no2:
  221.  
  222.         move.l    (sp)+,d0
  223.         rts
  224.  
  225.  
  226. bump_main:
  227.  
  228.         lea.l    sinus,a0
  229.  
  230.                 move.l    xsin,d0
  231.             move.l    (a0,d0.w),d1
  232.                 muls.w    #128,d1
  233.                 asr.l    #8,d1
  234.                 asr.l    #7,d1
  235.         bclr    #0,d1
  236.         move.l    d1,xpos
  237.  
  238.                 move.l    ysin,d0
  239.                 move.l    (a0,d0.w),d1
  240.                 muls.w    #64,d1
  241.                 asr.l    #8,d1
  242.                 asr.l    #7,d1
  243.         asl.l    #8,d1
  244.         move.l    d1,ypos
  245.  
  246.  
  247.  
  248.         tst.l    countdown
  249.         bne.s    .novoladd
  250.         move.l    timeslice,countdown
  251.  
  252.  
  253.         bsr.w    get_left_volume
  254.         move.l    d0,d1
  255.         bsr.w    get_right_volume
  256.         add.l    d0,d1
  257.  
  258.  
  259.         cmp.l    #1,steprate
  260.         beq.s    .normal2
  261.         cmp.l    #2,steprate
  262.         beq.s    .normal4
  263.  
  264. .normal:    lsr.l    #7,d1
  265.         and.l    #%00000000000000000000000111111110,d1
  266.         bra.s    .stepdone
  267. .normal2:    lsr.l    #6,d1
  268.         and.l    #%00000000000000000000001111111110,d1
  269.         bra.s    .stepdone
  270. .normal4:    lsr.l    #5,d1
  271.         and.l    #%00000000000000000000011111111110,d1
  272.  
  273.  
  274.  
  275. .stepdone:    move.l    d1,voladd
  276. .novoladd:
  277.  
  278.  
  279.         move.l    scradr1,a0
  280.         lea.l    64(a0),a0
  281.  
  282.         lea.l    bumpmap,a1
  283.  
  284.         lea.l    flare+788+256*78+64,a2
  285.         add.l    xpos,a2
  286.         add.l    ypos,a2
  287.  
  288.  
  289.         cmp.l    #1,palette
  290.         beq.s    .setpal2
  291.         cmp.l    #2,palette
  292.         beq.s    .setpal3
  293.         cmp.l    #3,palette
  294.         beq.s    .setpal4
  295.         cmp.l    #4,palette
  296.         beq.s    .setpal5
  297.  
  298. .setpal1:    lea.l    pal01,a3
  299.         bra.s    .addit
  300. .setpal2:    lea.l    pal02,a3
  301.         bra.s    .addit
  302. .setpal3:    lea.l    pal03,a3
  303.         bra.s    .addit
  304. .setpal4:    lea.l    pal04,a3
  305.         bra.s    .addit
  306. .setpal5:    lea.l    pal05,a3
  307.  
  308. .addit:        add.l    voladd,a3
  309.         move.l    brightness,d0
  310.         bclr    #0,d0
  311.         add.l    d0,a3
  312.  
  313.  
  314.  
  315.         clr.l    d0
  316.         clr.l    d1
  317.  
  318.         move.w    #100-1,d7
  319. .loop:        swap    d7
  320.         move.w    #128/16-1,d7
  321. .loop2:    
  322.         rept    16
  323.         move.w    (a1)+,d0
  324.         move.b    (a2,d0.w),d1
  325.         addq.l    #1,a2
  326.         move.l    (a3,d1.w*2),(a0)+
  327.         endr
  328.                 
  329.         dbra    d7,.loop2
  330.         lea.l    640-512(a0),a0
  331.         lea.l    256-128(a2),a2
  332.         swap    d7
  333.         dbra    d7,.loop
  334.  
  335.         rts
  336.  
  337.  
  338.  
  339.  
  340. bump_init:
  341.         lea.l    bump_vbl,a0
  342.         bsr.w    set_vblrout
  343.  
  344.         lea.l    pal,a0
  345.         lea.l    pal02+512,a1
  346.         lea.l    pal01+512,a2
  347.         lea.l    pal03+512,a3
  348.         lea.l    pal04+512,a4
  349.         lea.l    pal05+512,a5
  350.         move.w    #256/2-1,d7
  351. .loop:        move.l    512*1(a0),d0
  352.         clr.l    -512(a2)
  353.         move.l    d0,(a2)+
  354.         move.l    512*2(a0),d0
  355.         clr.l    -512(a3)
  356.         move.l    d0,(a3)+
  357.         move.l    512*3(a0),d0
  358.         clr.l    -512(a4)
  359.         move.l    d0,(a4)+
  360.         move.l    512*4(a0),d0
  361.         clr.l    -512(a5)
  362.         move.l    d0,(a5)+
  363.         move.l    (a0)+,d0
  364.         clr.l    -512(a1)
  365.         move.l    d0,(a1)+
  366.         dbra    d7,.loop
  367.  
  368.         lea.l    pal01+1024,a0
  369.         lea.l    pal02+1024,a1
  370.         lea.l    pal03+1024,a2
  371.         lea.l    pal04+1024,a3
  372.         lea.l    pal05+1024,a4
  373.         move.l    #-1,d0
  374.         move.w    #256*6/2-1,d7
  375. .loop2:        move.l    d0,(a0)+
  376.         move.l    d0,(a1)+
  377.         move.l    d0,(a2)+
  378.         move.l    d0,(a3)+
  379.         move.l    d0,(a4)+
  380.         dbra    d7,.loop2
  381.         rts
  382.  
  383.  
  384.  
  385. countdown:    ds.l    1
  386. voladd:        ds.l    1
  387. ysin:        ds.l    1
  388. xsin:        ds.l    1
  389. xpos:        ds.l    1
  390. ypos:        ds.l    1
  391.  
  392.  
  393.  
  394.  
  395.  
  396. ;ROUTINE SWITCHES VISIBLE SCREEN AND CYCLES THE SCREENADRESSES
  397. switch_screens:
  398.                 move.l  scradr3,D0
  399.                 move.l  scradr2,scradr3
  400.                 move.l  scradr1,scradr2
  401.                 move.l  D0,scradr1
  402.                 movea.l scradr2,A0
  403.                 jsr     set_scradr
  404.                 rts
  405.  
  406.         section    data
  407.  
  408.         even
  409.  
  410. bumpmap:    incbin    'bump.dat'
  411.         even
  412. flare:        incbin    'flare.apx'
  413.         even
  414. sinus:        incbin    'sinus.dat'
  415.         even
  416. pal:        incbin    'pal.16b'
  417.         even
  418.  
  419. scradr1:        Dc.L scr1+256
  420. scradr2:        Dc.L scr2+256
  421. scradr3:        Dc.L scr3+256
  422.  
  423.                 section    bss
  424.  
  425.  
  426. pal01:        ds.w    256+256+(256*6)
  427. pal02:        ds.w    256+256+(256*6)
  428. pal03:        ds.w    256+256+(256*6)
  429. pal04:        ds.w    256+256+(256*6)
  430. pal05:        ds.w    256+256+(256*6)
  431.  
  432.  
  433. scr1:        ds.w    320*100
  434. scr2:        ds.w    320*100
  435. scr3:        ds.w    320*100
  436.  
  437.                 END
  438.