home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / Assembler / dse-src5.dms / in.adf / col.S < prev    next >
Encoding:
Text File  |  1990-05-07  |  8.5 KB  |  438 lines

  1. mainloop:
  2.         jsr    music
  3.         jsr    scroller
  4.         jsr    stop_muzak
  5.         rts
  6.  
  7. music:    bne.s    start_muzak
  8.  
  9. main:    btst    #6,$bfe001
  10.     bne.s    main
  11.  
  12.     bsr.L    stop_muzak
  13.     moveq    #0,d0
  14.     rts
  15.  
  16. start_muzak:
  17.     move.l    #data,muzakoffset    ;** get offset
  18.  
  19. init0:    move.l    muzakoffset,a0        ;** get highest used pattern
  20.     add.l    #472,a0
  21.     move.l    #$80,d0
  22.     clr.l    d1
  23. init1:    move.l    d1,d2
  24.     subq.w    #1,d0
  25. init2:    move.b    (a0)+,d1
  26.     cmp.b    d2,d1
  27.     bgt.s    init1
  28.     dbf    d0,init2
  29.     addq.b    #1,d2
  30.  
  31. init3:    move.l    muzakoffset,a0        ;** calc samplepointers
  32.     lea    pointers(pc),a1
  33.     lsl.l    #8,d2
  34.     lsl.l    #2,d2
  35.     add.l    #600,d2
  36.     add.l    a0,d2
  37.     moveq    #14,d0
  38. init4:    move.l    d2,(a1)+
  39.     clr.l    d1
  40.     move.w    42(a0),d1
  41.     lsl.l    #1,d1
  42.     add.l    d1,d2
  43.     add.l    #30,a0
  44.     dbf    d0,init4
  45.  
  46. init5:    clr.w    $dff0a8            ;** clear used values
  47.     clr.w    $dff0b8
  48.     clr.w    $dff0c8
  49.     clr.w    $dff0d8
  50.     clr.w    timpos
  51.     clr.l    trkpos
  52.     clr.l    patpos
  53.  
  54. init6:    move.l    muzakoffset,a0        ;** initialize timer irq
  55.     move.b    470(a0),numpat+1    ;number of patterns
  56.     move.l    $6c.w,lev3save+2
  57.     move.l    #lev3interrupt,$6c.w
  58.     rts
  59.  
  60. stop_muzak:
  61.     move.l    lev3save+2,$6c.w
  62.     clr.w    $dff0a8
  63.     clr.w    $dff0b8
  64.     clr.w    $dff0c8
  65.     clr.w    $dff0d8
  66.     move.w    #$f,$dff096
  67.     rts
  68.  
  69. lev3interrupt:
  70.     bsr.s    replay_muzak
  71. lev3save:
  72.     jmp    $0
  73.  
  74. replay_muzak:
  75.     movem.l    d0-d7/a0-a6,-(a7)
  76.     addq.w    #1,timpos
  77. speed:    cmp.w    #6,timpos
  78.     beq.L    replaystep
  79.  
  80. chaneleffects:                ;** seek effects
  81.     lea    datach0(pc),a6
  82.     tst.b    3(a6)
  83.     beq.s    ceff1
  84.     lea    $dff0a0,a5
  85.     bsr.s    ceff5
  86. ceff1:    lea    datach1(pc),a6
  87.     tst.b    3(a6)
  88.     beq.s    ceff2
  89.     lea    $dff0b0,a5
  90.     bsr.s    ceff5
  91. ceff2:    lea    datach2(pc),a6
  92.     tst.b    3(a6)
  93.     beq.s    ceff3
  94.     lea    $dff0c0,a5
  95.     bsr.s    ceff5
  96. ceff3:    lea    datach3(pc),a6
  97.     tst.b    3(a6)
  98.     beq.s    ceff4
  99.     lea    $dff0d0,a5
  100.     bsr.s    ceff5
  101. ceff4:    movem.l    (a7)+,d0-d7/a0-a6
  102.     rts
  103.  
  104. ceff5:    move.b    2(a6),d0        ;room for some more
  105.     and.b    #$f,d0            ;implementations below
  106.     tst.b    d0
  107.     beq.s    arpreggiato
  108.     cmp.b    #1,d0
  109.     beq.L    pitchup
  110.     cmp.b    #2,d0
  111.     beq.L    pitchdown
  112.     cmp.b    #12,d0
  113.     beq.L    setvol
  114.     cmp.b    #14,d0
  115.     beq.L    setfilt
  116.     cmp.b    #15,d0
  117.     beq.L    setspeed
  118.     rts
  119.  
  120. arpreggiato:                ;** spread by time
  121.     cmp.w    #1,timpos
  122.     beq.s    arp1
  123.     cmp.w    #2,timpos
  124.     beq.s    arp2
  125.     cmp.w    #3,timpos
  126.     beq.s    arp3
  127.     cmp.w    #4,timpos
  128.     beq.s    arp1
  129.     cmp.w    #5,timpos
  130.     beq.s    arp2
  131.     rts
  132.  
  133. arp1:    clr.l    d0            ;** get higher note-values
  134.     move.b    3(a6),d0        ;   or play original
  135.     lsr.b    #4,d0
  136.     bra.s    arp4
  137. arp2:    clr.l    d0
  138.     move.b    3(a6),d0
  139.     and.b    #$f,d0
  140.     bra.s    arp4
  141. arp3:    move.w    16(a6),d2
  142.     bra.s    arp6
  143. arp4:    lsl.w    #1,d0
  144.     clr.l    d1
  145.     move.w    16(a6),d1
  146.     lea    notetable,a0
  147. arp5:    move.w    (a0,d0.w),d2
  148.     cmp.w    (a0),d1
  149.     beq.s    arp6
  150.     addq.l    #2,a0
  151.     bra.s    arp5
  152. arp6:    move.w    d2,6(a5)
  153.     rts
  154.  
  155. pitchdown:
  156.     bsr.s    newrou
  157.     clr.l    d0
  158.     move.b    3(a6),d0
  159.     and.b    #$f,d0
  160.     add.w    d0,(a4)
  161.     cmp.w    #$358,(a4)
  162.     bmi.s    ok1
  163.     move.w    #$358,(a4)
  164. ok1:    move.w    (a4),6(a5)
  165.     rts
  166.  
  167. pitchup:bsr.s    newrou
  168.     clr.l    d0
  169.     move.b    3(a6),d0
  170.     and.b    #$f,d0
  171.     sub.w    d0,(a4)
  172.     cmp.w    #$71,(a4)
  173.     bpl.s    ok2
  174.     move.w    #$71,(a4)
  175. ok2:    move.w    (a4),6(a5)
  176.     rts
  177.  
  178. setvol:    move.b    3(a6),8(a5)
  179.     rts
  180.  
  181. setfilt:move.b    3(a6),d0
  182.     and.b    #1,d0
  183.     lsl.b    #1,d0
  184.     and.b    #$fd,$bfe001
  185.     or.b    d0,$bfe001
  186.     rts
  187.  
  188. setspeed:
  189.     clr.l    d0
  190.     move.b    3(a6),d0
  191.     and.b    #$f,d0
  192.     move.w    d0,speed+2
  193.     rts
  194.  
  195. newrou:    cmp.l    #datach0,a6
  196.     bne.s    next1
  197.     lea    voi1(pc),a4
  198.     rts
  199. next1:    cmp.l    #datach1,a6
  200.     bne.s    next2
  201.     lea    voi2(pc),a4
  202.     rts
  203. next2:    cmp.l    #datach2,a6
  204.     bne.s    next3
  205.     lea    voi3(pc),a4
  206.     rts
  207. next3:    lea    voi4(pc),a4
  208.     rts
  209.  
  210. replaystep:                ;** work next pattern-step
  211.     clr.w    timpos
  212.     move.l    muzakoffset,a0
  213.     move.l    a0,a3
  214.     add.l    #12,a3            ;ptr to soundprefs
  215.     move.l    a0,a2
  216.     add.l    #472,a2            ;ptr to pattern-table
  217.     add.l    #600,a0            ;ptr to first pattern
  218.     clr.l    d1
  219.     move.l    trkpos,d0        ;get ptr to current pattern
  220.     move.b    (a2,d0),d1
  221.     lsl.l    #8,d1
  222.     lsl.l    #2,d1
  223.     add.l    patpos,d1        ;get ptr to current step
  224.     clr.w    enbits
  225.     lea    $dff0a0,a5        ;chanel 0
  226.     lea    datach0(pc),a6
  227.     bsr.L    chanelhandler
  228.     lea    $dff0b0,a5        ;chanel 1
  229.     lea    datach1(pc),a6
  230.     bsr.L    chanelhandler
  231.     lea    $dff0c0,a5        ;chanel 2
  232.     lea    datach2(pc),a6
  233.     bsr.L    chanelhandler
  234.     lea    $dff0d0,a5        ;chanel 3
  235.     lea    datach3(pc),a6
  236.     bsr.L    chanelhandler
  237.     move.w    #400,d0            ;** wait a while and set len
  238. rep1:    dbf    d0,rep1            ;   of oneshot to 1 word
  239.     move.w    #$8000,d0
  240.     or.w    enbits,d0
  241.     move.w    d0,$dff096
  242.     cmp.w    #1,datach0+14
  243.     bne.s    rep2
  244.     clr.w    datach0+14
  245.     move.w    #1,$dff0a4
  246. rep2:    cmp.w    #1,datach1+14
  247.     bne.s    rep3
  248.     clr.w    datach1+14
  249.     move.w    #1,$dff0b4
  250. rep3:    cmp.w    #1,datach2+14
  251.     bne.s    rep4
  252.     clr.w    datach2+14
  253.     move.w    #1,$dff0c4
  254. rep4:    cmp.w    #1,datach3+14
  255.     bne.s    rep5
  256.     clr.w    datach3+14
  257.     move.w    #1,$dff0d4
  258.  
  259. rep5:    add.l    #16,patpos        ;next step
  260.     cmp.l    #64*16,patpos        ;pattern finished ?
  261.     bne.s    rep6
  262.     clr.l    patpos
  263.     addq.l    #1,trkpos        ;next pattern in table
  264.     clr.l    d0
  265.     move.w    numpat,d0
  266.     cmp.l    trkpos,d0        ;song finished ?
  267.     bne.s    rep6
  268.     clr.l    trkpos
  269. rep6:    movem.l    (a7)+,d0-d7/a0-a6
  270.     rts
  271.  
  272. chanelhandler:
  273.     move.l    (a0,d1.l),(a6)        ;get period & action-word
  274.     addq.l    #4,d1            ;point to next chanel
  275.     clr.l    d2
  276.     move.b    2(a6),d2        ;get nibble for soundnumber
  277.     lsr.b    #4,d2
  278.     beq.s    chan2            ;no soundchange !
  279.     move.l    d2,d4            ;** calc ptr to sample
  280.     lsl.l    #2,d2
  281.     mulu    #30,d4
  282.     lea    pointers-4(pc),a1
  283.     move.l    (a1,d2.l),4(a6)        ;store sample-address
  284.     move.w    (a3,d4.l),8(a6)        ;store sample-len in words
  285.     move.w    2(a3,d4.l),18(a6)    ;store sample-volume
  286.  
  287.     move.l    d0,-(a7)
  288.     move.b    2(a6),d0
  289.     and.b    #$f,d0
  290.     cmp.b    #$c,d0
  291.     bne.s    ok3
  292.     move.b    3(a6),8(a5)
  293.     bra.s    ok4
  294. ok3:    move.w    2(a3,d4.l),8(a5)    ;change chanel-volume
  295. ok4:    move.l    (a7)+,d0
  296.  
  297.     clr.l    d3
  298.     move.w    4(a3,d4),d3        ;** calc repeatstart
  299.     add.l    4(a6),d3
  300.     move.l    d3,10(a6)        ;store repeatstart
  301.     move.w    6(a3,d4),14(a6)        ;store repeatlength
  302.     cmp.w    #1,14(a6)
  303.     beq.s    chan2            ;no sustainsound !
  304.     move.l    10(a6),4(a6)        ;repstart  = sndstart
  305.     move.w    6(a3,d4),8(a6)        ;replength = sndlength
  306. chan2:    tst.w    (a6)
  307.     beq.s    chan4            ;no new note set !
  308.     move.w    22(a6),$dff096        ;clear dma
  309.     tst.w    14(a6)
  310.     bne.s    chan3            ;no oneshot-sample
  311.     move.w    #1,14(a6)        ;allow resume (later)
  312. chan3:    bsr.L    newrou
  313.     move.w    (a6),(a4)
  314.     move.w    (a6),16(a6)        ;save note for effect
  315.     move.l    4(a6),0(a5)        ;set samplestart
  316.     move.w    8(a6),4(a5)        ;set samplelength
  317.     move.w    (a6),6(a5)        ;set period
  318.     move.w    22(a6),d0
  319.     or.w    d0,enbits        ;store dma-bit
  320.     move.w    18(a6),20(a6)        ;volume trigger
  321. chan4:    rts
  322.  
  323. datach0:    blk.w    11,0
  324.         dc.w    1
  325. datach1:    blk.w    11,0
  326.         dc.w    2
  327. datach2:    blk.w    11,0
  328.         dc.w    4
  329. datach3:    blk.w    11,0
  330.         dc.w    8
  331. voi1:        dc.w    0
  332. voi2:        dc.w    0
  333. voi3:        dc.w    0
  334. voi4:        dc.w    0
  335. pointers:    blk.l    15,0
  336. notetable:    dc.w    856,808,762,720,678,640,604,570
  337.         dc.w    538,508,480,453,428,404,381,360
  338.         dc.w    339,320,302,285,269,254,240,226  
  339.         dc.w    214,202,190,180,170,160,151,143
  340.         dc.w    135,127,120,113,000
  341. muzakoffset:    dc.l    0
  342. trkpos:        dc.l    0
  343. patpos:        dc.l    0
  344. numpat:        dc.w    0
  345. enbits:        dc.w    0
  346. timpos:        dc.w    0
  347. data:        blk.b    52112,0
  348.  
  349. scroller:
  350.     move.l    $04,a6
  351.     lea    gfxname,a1
  352.     jsr    -408(a6)    ;OldOpenLibrary
  353.     move.l    d0,gfxbase
  354.     move.l    d0,a0
  355.     move.l    50(a0),oldclist        ;remember CList
  356.     move.l    #newclist,50(a0)    ;setnew CList
  357.     move.l    gfxbase,a6
  358.     lea    bitmap,a0
  359.     move.l    #$01,d0        ;bitplanes
  360.     move.l    #336,d1        ;width
  361.     move.l    #200,d2        ;hight
  362.     jsr    -390(a6)    ;InitBitMap
  363.     move.l    #$60000,plane1
  364.     lea    rastport,a1
  365.     jsr    -198(a6)    ;InitRastPort
  366.     move.l    #bitmap,r_bitmap
  367.     lea    rastport,a1
  368.     jsr    -48(a6)        ;ClearScreen
  369.     move.l    #scrollm,zeiger
  370.     move.l    $6c,oldirq+2    ;set backjump
  371.     move.l    #newirq,$6c    ;set new to jump
  372. wait:    btst    #6,$bfe001
  373.     bne.s    wait
  374.     move.l    oldirq+2,$6c    ;restore to jump
  375.     move.l    gfxbase,a0
  376.     move.l    oldclist,50(a0)    ;restore old CList
  377.     move.l    $04,a6
  378.     move.l    gfxbase,a1
  379.     jsr    -414(a6)    ;CloseLibrary
  380.     move.l    #0,d0
  381.     rts
  382.  
  383. newirq:
  384.     movem.l    d0-d7/a0-a6,-(sp)    ;store registers
  385.     move.l    gfxbase,a6
  386.     lea    rastport,a1
  387.     move.l    #01,d0        ;delta X
  388.     move.l    #00,d1        ;delta Y
  389.     move.l    #000,d2        ;minX
  390.     move.l    #000,d3        ;minY
  391.     move.l    #336,d4        ;maxX
  392.     move.l    #200,d5        ;maxY
  393.     jsr    -396(a6)    ;ScrollRaster
  394.     sub.b    #$01,rows
  395.     bne.s    exit        ;branch if no new char
  396.     move.b    #$08,rows
  397.     lea    rastport,a1
  398.     move.l    #320,d0        ;Xpos
  399.     move.l    #110,d1        ;Ypos
  400.     jsr    -240(a6)    ;Move
  401.     lea    rastport,a1
  402.     move.l    zeiger,a0    ;pointer to tekst
  403.     move.l    #$01,d0        ;# of chars
  404.     jsr    -60(a6)        ;Text
  405.     addq.l    #$01,zeiger
  406.     cmp.l    #end,zeiger
  407.     blt.s    exit        ;do not zero ZEIGER
  408.     move.l    #scrollm,zeiger
  409. exit:    movem.l    (sp)+,d0-d7/a0-a6
  410. oldirq:    jmp    $00000000
  411.  
  412. newclist:
  413. dc.w    $008e,$2c81,$0090,$f4f0,$0092,$0038,$0094,$00d0
  414. dc.w    $0102,$0000,$0104,$0000,$0108,$0002,$010a,$0002
  415. dc.w    $0100,$1200,$0180,$0000,$0182,$0fff
  416. dc.w    $00e0,$0006,$00e2,$0000
  417. dc.w    $900f,$fffe,$0180,$0f00,$910f,$fffe,$0180,$000f
  418. dc.w    $9e0f,$fffe,$0180,$0f00,$9f0f,$fffe,$0180,$0000
  419. dc.w    $ffff,$fffe
  420.  
  421. zeiger:        dc.l    0
  422. oldclist:    dc.l    0
  423. gfxbase:    dc.l    0
  424. bitmap:        blk.l    2,0
  425. plane1:        blk.l    20,0
  426. rastport:    dc.l    0
  427. r_bitmap:    blk.l    30,0
  428. rows:        dc.b    2
  429. gfxname:    dc.b    "graphics.library",0
  430. scrollm:    dc.b    "WELCOME TO CHEATER DISK -NO.1- BY "
  431.         dc.b    "-=>INFECTION<=-.  THE CHEATS ARE FROM ALL "
  432.         dc.b    "NEWSPAPER I HAVE READ!  THE DATE IS: 90/10/23. "
  433.         dc.b    " THIS LITTLE INTRO (MUSIC+CODING) BY "
  434.         dc.b    "-INFECTION-.  I HOPE YOU GONNA LIKE THIS "
  435.         dc.b    "DISK,SEE YOU LATER (ALEGATER).... PRESS LEFT "
  436.         dc.b    "MOUSE BUTTON                                   "
  437. end:
  438.