home *** CD-ROM | disk | FTP | other *** search
/ Enigma Amiga Life 109 / EnigmaAmiga109CD.iso / software / testi / corsoasm / sorgenti8 / play.s < prev    next >
Text File  |  1995-09-29  |  48KB  |  2,827 lines

  1.  
  2. **    $Filename: Player61.i $
  3. **    $Release: 6.1A $
  4. **    $Revision: 610.1 $
  5. **    $Date: 94/12/23 $
  6. **
  7. **    The Player 6.1A definitions
  8. **
  9. **    (C) Copyright 1992-94 Jarno Paananen
  10. **    All Rights Reserved
  11. **
  12.  
  13. lev6 =    1    ;0 = NonLev6 (non implementato)
  14.         ;1 = Lev6 used
  15.  
  16. channels = 4    ;amount of channels to be played
  17.  
  18.  
  19. STRUCTURE   MACRO        ; structure name, initial offset
  20. \1        EQU     0
  21. SOFFSET     SET     \2
  22.         ENDM
  23.  
  24. UBYTE        MACRO        ; unsigned byte (8 bits)
  25. \1        EQU     SOFFSET
  26. SOFFSET     SET     SOFFSET+1
  27.         ENDM
  28.  
  29. UWORD        MACRO        ; unsigned word (16 bits)
  30. \1        EQU     SOFFSET
  31. SOFFSET     SET     SOFFSET+2
  32.         ENDM
  33.  
  34. ULONG        MACRO        ; unsigned long (32 bits)
  35. \1        EQU     SOFFSET
  36. SOFFSET     SET     SOFFSET+4
  37.         ENDM
  38.  
  39. APTR        MACRO        ; untyped pointer (32 bits - all bits valid)
  40. \1        EQU     SOFFSET
  41. SOFFSET     SET     SOFFSET+4
  42.         ENDM
  43.  
  44. LABEL        MACRO        ; Define a label without bumping the offset
  45. \1        EQU     SOFFSET
  46.         ENDM
  47.  
  48. **************
  49. * The header *
  50. **************
  51.  
  52.   STRUCTURE Player_Header,0
  53. ** Instructions to jump to P61_Init
  54.     ULONG    P61_InitOffset
  55. ** ... to P61_Music (rts, if CIA-Version)
  56.     ULONG    P61_MusicOffset
  57. ** ... to P61_End
  58.     ULONG    P61_EndOffset
  59. ** ... to P61_SetRepeat (if present, otherwise rts)
  60.     ULONG    P61_SetRepeatOffset
  61. ** ... to P61_SetPosition
  62.     ULONG    P61_SetPositionOffset
  63. ** Master volume (used if told to...)
  64.     UWORD    P61_MasterVolume
  65. ** If non-zero, tempo will be used
  66.     UWORD    P61_UseTempo
  67. ** If zero, playing is stopped
  68.     UWORD    P61_PlayFlag
  69. ** Info nybble after command E8
  70.     UWORD    P61_E8_info
  71. ** Vector Base Register VBR passed to the player (default 0)
  72.     APTR    P61_UseVBR
  73. ** Current song position
  74.     UWORD    P61_Position
  75. ** Current pattern
  76.     UWORD    P61_Pattern
  77. ** Current row
  78.     UWORD    P61_Row
  79. ** Offset to channel 0 block from the beginning
  80.     APTR    P61_Cha0Offset
  81. ** Offset to channel 1 block from the beginning
  82.     APTR    P61_Cha1Offset
  83. ** Offset to channel 2 block from the beginning
  84.     APTR    P61_Cha2Offset
  85. ** Offset to channel 3 block from the beginning
  86.     APTR    P61_Cha3Offset
  87.  
  88.     LABEL Player_Header_SIZE
  89.  
  90.  
  91. *********************************************************
  92. ** The structure of the channel blocks (P61_Temp[0-3]) **
  93. *********************************************************
  94.  
  95.   STRUCTURE Channel_Block,0
  96.  
  97. ** Note and the MSB of the sample number
  98.     UBYTE    P61_SN_Note
  99. ** Lower nybble of the sample number and the command
  100.     UBYTE    P61_Command
  101. ** Info byte
  102.     UBYTE    P61_Info
  103. ** Packing info
  104.     UBYTE    P61_Pack
  105. ** Pointer to the sample block of the current sample
  106.     APTR    P61_Sample
  107. ** Current note (offset to the period table)
  108.     UWORD    P61_Note
  109. ** Period
  110.     UWORD    P61_Period
  111. ** Volume (NOT updated in tremolo!)
  112.     UWORD    P61_Volume
  113. ** Current finetune
  114.     UWORD    P61_Fine
  115. ** Sample offset
  116.     UWORD    P61_Offset
  117. ** Last sample Offset
  118.     UWORD    P61_LOffset
  119. ** To period for tone portamento
  120.     UWORD    P61_ToPeriod
  121. ** Speed for tone portamento
  122.     UWORD    P61_TPSpeed
  123. ** Vibrato command
  124.     UBYTE    P61_VibCmd
  125. ** Vibrato position
  126.     UBYTE    P61_VibPos
  127. ** Tremolo command
  128.     UBYTE    P61_TreCmd
  129. ** Tremolo position
  130.     UBYTE    P61_TrePos
  131. ** Retrig note counter
  132.     UWORD    P61_RetrigCount
  133.  
  134. ** Invert loop speed
  135.     UBYTE    P61_Funkspd
  136. ** Invert loop offset
  137.     UBYTE    P61_Funkoff
  138. ** Invert loop offset
  139.     APTR    P61_Wave
  140.  
  141. ** Internal switch to the packing
  142.     UWORD    P61_OnOff
  143. ** Pointer to the current pattern data
  144.     APTR    P61_ChaPos
  145. ** A packing pointer to data elsewhere in the pattern data
  146.     APTR    P61_TempPos
  147. ** Lenght of the temporary positions
  148.     UWORD    P61_TempLen
  149. ** Temp pointers for patternloop
  150.     UWORD    P61_TData
  151.     APTR    P61_TChaPos
  152.     APTR    P61_TTempPos
  153.     UWORD    P61_TTempLen
  154.  
  155. ** Shadow address for fading (updated also in tremolo!)
  156.     UWORD    P61_Shadow
  157.  
  158. ** Bit in DMACON ($DFF096)
  159.     UWORD    P61_DMABit
  160.  
  161.     LABEL Channel_Block_SIZE
  162.  
  163.  
  164.  
  165. ************************************************
  166. ** The structure of the sample block that     **
  167. ** the Player does at the init to P61_Samples **
  168. ************************************************
  169.  
  170.   STRUCTURE Sample_Block,0
  171.  
  172. ** Pointer to the beginning of the sample
  173.     APTR    P61_SampleOffset
  174. ** Lenght of the sample
  175.     UWORD    P61_SampleLength
  176. ** Pointer to the repeat
  177.     APTR    P61_RepeatOffset
  178. ** Lenght of the repeat
  179.     UWORD    P61_RepeatLength
  180. ** Volume of the sample
  181.     UWORD    P61_SampleVolume
  182. ** Finetune (offset to the period table)
  183.     UWORD    P61_FineTune
  184.  
  185.     LABEL Sample_Block_SIZE
  186.  
  187. ************************************************
  188. ** Some internal stuff for the Usecode-system **
  189. ************************************************
  190.  
  191.  
  192. ** if finetune is used
  193. P61_ft = use&1
  194. ** portamento up
  195. P61_pu = use&2
  196. ** portamento down
  197. P61_pd = use&4
  198. ** tone portamento
  199. P61_tp = use&40
  200. ** vibrato
  201. P61_vib = use&80
  202. ** tone portamento and volume slide
  203. P61_tpvs = use&32
  204. ** vibrato and volume slide
  205. P61_vbvs = use&64
  206. ** tremolo
  207. P61_tre = use&$80
  208. ** arpeggio
  209. P61_arp = use&$100
  210. ** sample offset
  211. P61_sof = use&$200
  212. ** volume slide
  213. P61_vs = use&$400
  214. ** position jump
  215. P61_pj = use&$800
  216. ** set volume
  217. P61_vl = use&$1000
  218. ** pattern break
  219. P61_pb = use&$2800
  220. ** set speed
  221. P61_sd = use&$8000
  222.  
  223. ** E-commands
  224. P61_ec = use&$ffff0000
  225.  
  226. ** filter
  227. P61_fi = use&$10000
  228. ** fine slide up
  229. P61_fsu = use&$20000
  230. ** fine slide down
  231. P61_fsd = use&$40000
  232. ** set finetune
  233. P61_sft = use&$200000
  234. ** pattern loop
  235. P61_pl = use&$400000
  236. ** E8 for timing purposes
  237. P61_timing = use&$1000000
  238. ** retrig note
  239. P61_rt = use&$2000000
  240. ** fine volume slide up
  241. P61_fvu = use&$4000000
  242. ** fine volume slide down
  243. P61_fvd = use&$8000000
  244. ** note cut
  245. P61_nc = use&$10000000
  246. ** note delay
  247. P61_nd = use&$20000000
  248. ** pattern delay
  249. P61_pde = 1    ;use&$40000000 buggato, va tenuto sempre ad 1!
  250. ** invert loop
  251. P61_il = use&$80000000
  252.  
  253.  
  254. *-----------------------------------------------*
  255.  
  256.     printt    ""
  257.     printt    "Options used:"
  258.     printt    "-------------"
  259.     ifd    startP
  260. ;    printt    "Starting from position"
  261. ;    printv    startP
  262.     endc
  263.     ifne    fade
  264.     printt    "Mastervolume on"
  265.     else
  266.     printt    "Mastervolume off"
  267.     endc
  268.     ifne    system
  269.     printt    "System friendly"
  270.     else
  271.     printt    "System killer"
  272.     endc
  273.     ifne    CIA
  274.     printt    "CIA-tempo on"
  275.     else
  276.     printt    "CIA-tempo off"
  277.     endc
  278.     ifne    exec
  279.     printt    "ExecBase valid"
  280.     else
  281.     printt    "ExecBase invalid"
  282.     endc
  283.     ifne    lev6
  284.     printt    "Level 6 IRQ on"
  285.     else
  286. ;    printt    "Non-lev6 NOT IMPLEMENTED!"
  287.     if2
  288.     fail
  289.     endc
  290.     endc
  291.     ifne    opt020
  292.     printt    "MC68020 optimizations"
  293.     else
  294.     printt    "Normal MC68000 code"
  295.     endc
  296. ;    printt    "Channels:"
  297. ;    printv    channels
  298.     ifgt    channels-4
  299. ;    printt    "NO MORE THAN 4 CHANNELS!"
  300.     if2
  301.     fail
  302.     endc
  303.     endc
  304.     ifeq    channels
  305. ;    printt    "MUST HAVE AT LEAST 1 CHANNEL!"
  306.     if2
  307.     fail
  308.     endc
  309.     endc
  310. ;    printt    "UseCode:"
  311. ;    printv    use
  312.  
  313. *-----------------------------------------------*
  314.  
  315. *********************************
  316. *        Player 6.1A ®        *
  317. *      All in one-version    *
  318. *        Version 610.1        *
  319. *   © 1992-95 Jarno Paananen    *
  320. *     All rights reserved    *
  321. *********************************
  322.  
  323.  
  324. ******** START OF BINARY FILE **************
  325.  
  326. P61_motuuli
  327.     bra    P61_Init
  328.     ifeq    CIA
  329.     bra    P61_Music
  330.     else
  331.     rts
  332.     rts
  333.     endc
  334.     bra    P61_End
  335.     rts                ;no P61_SetRepeat
  336.     rts
  337.     bra    P61_SetPosition
  338.  
  339. P61_Master    dc    64        ;Master volume (0-64)
  340. P61_Tempo    dc    1        ;Use tempo? 0=no,non-zero=yes
  341. P61_Play    dc    1        ;Stop flag (0=stop)
  342. P61_E8        dc    0        ;Info nybble after command E8
  343. P61_VBR        dc.l    0        ;If you're using non-valid execbase
  344.                     ;put VBR here! (Otherwise 0 assumed)
  345.                     ;You can also get VBR from here, if
  346.                     ;using exec-valid version
  347.  
  348. P61_Pos        dc    0        ;Current song position
  349. P61_Patt    dc    0        ;Current pattern
  350. P61_CRow    dc    0        ;Current pattern row
  351.  
  352. P61_Temp0Offset
  353.     dc.l    P61_temp0-P61_motuuli
  354. P61_Temp1Offset
  355.     dc.l    P61_temp1-P61_motuuli
  356. P61_Temp2Offset
  357.     dc.l    P61_temp2-P61_motuuli
  358. P61_Temp3Offset
  359.     dc.l    P61_temp3-P61_motuuli
  360.  
  361. P61_getnote    macro
  362.     moveq    #$7e,d0
  363.     and.b    (a5),d0
  364.     beq.b    .nonote
  365.     ifne    P61_vib
  366.     clr.b    P61_VibPos(a5)
  367.     endc
  368.     ifne    P61_tre
  369.     clr.b    P61_TrePos(a5)
  370.     endc
  371.  
  372.     ifne    P61_ft
  373.     add    P61_Fine(a5),d0
  374.     endc
  375.     move    d0,P61_Note(a5)
  376.     move    (a2,d0),P61_Period(a5)
  377.  
  378. .nonote
  379.     endm
  380.  
  381.     ifeq    system
  382.     ifne    CIA
  383. P61_intti
  384.     movem.l    d0-a6,-(sp)
  385.     tst.b    $bfdd00
  386.     lea    $dff000,a6
  387.     move    #$2000,$9c(a6)
  388. ;    move    #$fff,$180(a6)
  389.     bsr    P61_Music
  390. ;    move    #0,$180(a6)
  391.     movem.l    (sp)+,d0-a6
  392.     nop
  393.     rte
  394.     endc
  395.     endc
  396.  
  397.     ifne    system
  398. P61_lev6server
  399.     movem.l    d2-d7/a2-a6,-(sp)
  400.     lea    $dff000,a6
  401.  
  402.     move    P61_server(pc),d0
  403.     beq.b    P61_musica
  404.     subq    #1,d0
  405.     beq    P61_dmason
  406.     bra    P61_setrepeat
  407.  
  408. P61_musica
  409.     bsr    P61_Music
  410.  
  411. P61_ohi    movem.l    (sp)+,d2-d7/a2-a6
  412.     moveq    #1,d0
  413.     rts
  414.     endc
  415.  
  416. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  417. ;­ Call P61_Init to initialize the playroutine    ­
  418. ;­ D0 --> Timer detection (for CIA-version)    ­
  419. ;­ A0 --> Address to the module            ­
  420. ;­ A1 --> Address to samples/0            ­
  421. ;­ A2 --> Address to sample buffer        ­
  422. ;­ D0 <-- 0 if succeeded            ­
  423. ;­ A6 <-- $DFF000                ­
  424. ;­         Uses D0-A6            ­
  425. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  426.  
  427. P61_Init
  428.     cmp.l    #"P61A",(a0)+
  429.     beq.b    .modok
  430.     subq.l    #4,a0
  431.  
  432. .modok    basereg    P61_cn,a3
  433.  
  434.     ifne    CIA
  435.     move    d0,-(sp)
  436.     endc
  437.  
  438.     moveq    #0,d0
  439.     cmp.l    d0,a1
  440.     bne.b    .redirect
  441.  
  442.     move    (a0),d0
  443.     lea    (a0,d0.l),a1
  444. .redirect
  445.     move.l    a2,a6
  446.     lea    8(a0),a2
  447.     moveq    #$40,d0
  448.     and.b    3(a0),d0
  449.     bne.b    .buffer
  450.     move.l    a1,a6
  451.     subq.l    #4,a2
  452. .buffer
  453.  
  454.     lea    P61_cn(pc),a3
  455.     moveq    #$1f,d1
  456.     and.b    3(a0),d1
  457.     move.l    a0,-(sp)
  458.     lea    P61_Samples(pc),a4
  459.     subq    #1,d1
  460.     moveq    #0,d4
  461. P61_lopos
  462.     move.l    a6,(a4)+
  463.     move    (a2)+,d4
  464.     bpl.b    P61_kook
  465.     neg    d4
  466.     lea    P61_Samples-16(pc),a5
  467.     ifeq    opt020
  468.     asl    #4,d4
  469.     move.l    (a5,d4),d6
  470.     else
  471.     add    d4,d4
  472.     move.l    (a5,d4*8),d6
  473.     endc
  474.     move.l    d6,-4(a4)
  475.     move    4(a5,d4),d4
  476.     sub.l    d4,a6
  477.     sub.l    d4,a6
  478.     bra.b    P61_jatk
  479.  
  480. P61_kook
  481.     move.l    a6,d6
  482.     tst.b    3(a0)
  483.     bpl.b    P61_jatk
  484.  
  485.     tst.b    (a2)
  486.     bmi.b    P61_jatk
  487.  
  488.     move    d4,d0
  489.     subq    #2,d0
  490.     bmi.b    P61_jatk
  491.  
  492.     move.l    a1,a5
  493.     move.b    (a5)+,d2
  494.     sub.b    (a5),d2
  495.     move.b    d2,(a5)+
  496. .loop    sub.b    (a5),d2
  497.     move.b    d2,(a5)+
  498.     sub.b    (a5),d2
  499.     move.b    d2,(a5)+
  500.     dbf    d0,.loop
  501.  
  502. P61_jatk
  503.     move    d4,(a4)+
  504.     moveq    #0,d2
  505.     move.b    (a2)+,d2
  506.     moveq    #0,d3
  507.     move.b    (a2)+,d3
  508.  
  509.     moveq    #0,d0
  510.     move    (a2)+,d0
  511.     bmi.b    .norepeat
  512.  
  513.     move    d4,d5
  514.     sub    d0,d5
  515.     move.l    d6,a5
  516.  
  517.     add.l    d0,a5
  518.     add.l    d0,a5
  519.  
  520.     move.l    a5,(a4)+
  521.     move    d5,(a4)+
  522.     bra.b    P61_gene
  523. .norepeat
  524.     move.l    d6,(a4)+
  525.     move    #1,(a4)+
  526. P61_gene
  527.     move    d3,(a4)+
  528.     moveq    #$f,d0
  529.     and    d2,d0
  530.     mulu    #74,d0
  531.     move    d0,(a4)+
  532.  
  533.     tst    -6(a2)
  534.     bmi.b    .nobuffer
  535.  
  536.     moveq    #$40,d0
  537.     and.b    3(a0),d0
  538.     beq.b    .nobuffer
  539.  
  540.     move    d4,d7
  541.     tst.b    d2
  542.     bpl.b    .copy
  543.  
  544.     subq    #1,d7
  545.     moveq    #0,d5
  546.     moveq    #0,d4
  547. .lo    move.b    (a1)+,d4
  548.     moveq    #$f,d3
  549.     and    d4,d3
  550.     lsr    #4,d4
  551.  
  552.     sub.b    .table(pc,d4),d5
  553.     move.b    d5,(a6)+
  554.     sub.b    .table(pc,d3),d5
  555.     move.b    d5,(a6)+
  556.     dbf    d7,.lo
  557.     bra.b    .kop
  558.  
  559. .copy    add    d7,d7
  560.     subq    #1,d7
  561. .cob    move.b    (a1)+,(a6)+
  562.     dbf    d7,.cob
  563.     bra.b    .kop
  564.  
  565. .table dc.b    0,1,2,4,8,16,32,64,128,-64,-32,-16,-8,-4,-2,-1
  566.  
  567. .nobuffer
  568.     move.l    d4,d6
  569.     add.l    d6,d6
  570.     add.l    d6,a6
  571.     add.l    d6,a1
  572. .kop    dbf    d1,P61_lopos
  573.  
  574.     move.l    (sp)+,a0
  575.     and.b    #$7f,3(a0)
  576.  
  577.     move.l    a2,-(sp)
  578.  
  579.     lea    P61_temp0(pc),a1
  580.     lea    P61_temp1(pc),a2
  581.     lea    P61_temp2(pc),a4
  582.     lea    P61_temp3(pc),a5
  583.     moveq    #Channel_Block_SIZE/2-2,d0
  584.  
  585.     moveq    #0,d1
  586. .cl    move    d1,(a1)+
  587.     move    d1,(a2)+
  588.     move    d1,(a4)+
  589.     move    d1,(a5)+
  590.     dbf    d0,.cl
  591.  
  592.     move.l    (sp)+,a2
  593.     move.l    a2,P61_positionbase(a3)
  594.  
  595.     moveq    #$7f,d1
  596.     and.b    2(a0),d1
  597.  
  598.     ifeq    opt020
  599.     lsl    #3,d1
  600.     lea    (a2,d1.l),a4
  601.     else
  602.     lea    (a2,d1.l*8),a4
  603.     endc
  604.     move.l    a4,P61_possibase(a3)
  605.  
  606.     move.l    a4,a1
  607.     moveq    #-1,d0
  608. .search    cmp.b    (a1)+,d0
  609.     bne.b    .search
  610.     move.l    a1,P61_patternbase(a3)    
  611.     move.l    a1,d0
  612.     sub.l    a4,d0
  613.     move    d0,P61_slen(a3)
  614.  
  615.     ifd    startP
  616.     lea    startP(a4),a4
  617.     endc
  618.  
  619.     moveq    #0,d0
  620.     move.b    (a4)+,d0
  621.     move.l    a4,P61_spos(a3)
  622.     lsl    #3,d0
  623.     add.l    d0,a2
  624.  
  625.     move.l    a1,a4
  626.     moveq    #0,d0    
  627.     move    (a2)+,d0
  628.     lea    (a4,d0.l),a1
  629.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  630.     move    (a2)+,d0
  631.     lea    (a4,d0.l),a1
  632.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  633.     move    (a2)+,d0
  634.     lea    (a4,d0.l),a1
  635.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  636.     move    (a2)+,d0
  637.     lea    (a4,d0.l),a1
  638.     move.l    a1,P61_ChaPos+P61_temp3(a3)
  639.  
  640.     lea    P61_setrepeat(pc),a0
  641.     move.l    a0,P61_intaddr(a3)
  642.  
  643.     move    #63,P61_rowpos(a3)
  644.     move    #6,P61_speed(a3)
  645.     move    #5,P61_speed2(a3)
  646.     clr    P61_speedis1(a3)
  647.  
  648.     ifne    P61_pl
  649.     clr.l    P61_plcount(a3)
  650.     endc
  651.  
  652.     ifne    P61_pde
  653.     clr    P61_pdelay(a3)
  654.     clr    P61_pdflag(a3)
  655.     endc
  656.     clr    (a3)
  657.  
  658.     moveq    #2,d0
  659.     and.b    $bfe001,d0
  660.     move.b    d0,P61_ofilter(a3)
  661.     bset    #1,$bfe001
  662.  
  663.     ifeq    system
  664.     ifne    exec
  665.     move.l    4.w,a6
  666.     moveq    #0,d0
  667.     btst    d0,297(a6)
  668.     beq.b    .no68010
  669.  
  670.     lea    P61_liko(pc),a5
  671.     jsr    -$1e(a6)
  672.  
  673. .no68010
  674.     move.l    d0,P61_VBR(a3)
  675.     endc
  676.  
  677.     move.l    P61_VBR(a3),a0
  678.     lea    $78(a0),a0
  679.     move.l    a0,P61_vektori(a3)
  680.  
  681.     move.l    (a0),P61_oldlev6(a3)
  682.     lea    P61_dmason(pc),a1
  683.     move.l    a1,(a0)
  684.     endc
  685.  
  686.     moveq    #0,d0
  687.     lea    $dff000,a6
  688.     move    d0,$a8(a6)
  689.     move    d0,$b8(a6)
  690.     move    d0,$c8(a6)
  691.     move    d0,$d8(a6)
  692.     move    #$f,$96(a6)
  693.  
  694.     ifeq    system
  695.     lea    P61_dmason(pc),a1
  696.     move.l    a1,(a0)
  697.     move    #$2000,$9a(a6)
  698.     lea    $bfd000,a0
  699.     lea    P61_Timers(pc),a1
  700.     move.b    #$7f,$d00(a0)
  701.     move.b    #$10,$e00(a0)
  702.     move.b    #$10,$f00(a0)
  703.     move.b    $400(a0),(a1)+
  704.     move.b    $500(a0),(a1)+
  705.     move.b    $600(a0),(a1)+
  706.     move.b    $700(a0),(a1)
  707.     endc
  708.  
  709.     ifeq    system!CIA
  710.     move.b    #$82,$d00(a0)
  711.     endc
  712.  
  713.     ifne    CIA
  714.     move    (sp)+,d0
  715.     subq    #1,d0
  716.     beq.b    P61_ForcePAL
  717.     subq    #1,d0
  718.     beq.b    P61_NTSC
  719.     ifne    exec
  720.     move.l    4.w,a1
  721.     cmp.b    #60,$213(a1)    ;PowerSupplyFrequency
  722.     beq.b    P61_NTSC
  723.     endc
  724. P61_ForcePAL
  725.     move.l    #1773447,d0    ;PAL
  726.     bra.b    P61_setcia
  727. P61_NTSC
  728.     move.l    #1789773,d0    ;NTSC
  729. P61_setcia
  730.     move.l    d0,P61_timer(a3)
  731.     divu    #125,d0
  732.     move    d0,P61_thi2(a3)
  733.     sub    #$1f0*2,d0
  734.     move    d0,P61_thi(a3)
  735.  
  736.     ifeq    system
  737.     move    P61_thi2(a3),d0
  738.     move.b    d0,$400(a0)
  739.     lsr    #8,d0
  740.     move.b    d0,$500(a0)
  741.     lea    P61_intti(pc),a1
  742.     move.l    a1,P61_tintti(a3)
  743.     move.l    P61_vektori(pc),a2
  744.     move.l    a1,(a2)
  745.     move.b    #$83,$d00(a0)
  746.     move.b    #$11,$e00(a0)
  747.     endc
  748.     endc
  749.  
  750.     ifeq    system
  751.     move    #$e000,$9a(a6)
  752.     moveq    #0,d0
  753.     rts
  754.  
  755.     ifne    exec
  756. P61_liko
  757.     dc.l    $4E7A0801        ;MOVEC    VBR,d0
  758.     rte
  759.     endc
  760.     endc
  761.  
  762.     ifne    system
  763.     move.l    a6,-(sp)
  764.  
  765.     ifne    CIA
  766.     clr    P61_server(a3)
  767.     else
  768.     move    #1,P61_server(a3)
  769.     endc
  770.  
  771.     move.l    4.w,a6
  772.     moveq    #-1,d0
  773.     jsr    -$14a(a6)
  774.     move.b    d0,P61_sigbit(a3)
  775.     bmi    P61_err
  776.  
  777.     lea    P61_allocport(pc),a1
  778.     move.l    a1,P61_portti(a3)
  779.     move.b    d0,15(a1)
  780.     move.l    a1,-(sp)
  781.     suba.l    a1,a1
  782.     jsr    -$126(a6)
  783.     move.l    (sp)+,a1
  784.     move.l    d0,16(a1)
  785.     lea    P61_reqlist(pc),a0
  786.     move.l    a0,(a0)
  787.     addq.l    #4,(a0)
  788.     clr.l    4(a0)
  789.     move.l    a0,8(a0)
  790.  
  791.     lea    P61_dat(pc),a1
  792.     move.l    a1,P61_reqdata(a3)
  793.     lea    P61_allocreq(pc),a1
  794.     lea    P61_audiodev(pc),a0
  795.     moveq    #0,d0
  796.     moveq    #0,d1
  797.     jsr    -$1bc(a6)
  798.     tst.b    d0
  799.     bne    P61_err
  800.     st.b    P61_audioopen(a3)
  801.  
  802.     lea    P61_timerint(pc),a1
  803.     move.l    a1,P61_timerdata(a3)
  804.     lea    P61_lev6server(pc),a1
  805.     move.l    a1,P61_timerdata+8(a3)
  806.  
  807.     moveq    #0,d3
  808.     lea    P61_cianame(pc),a1
  809. P61_openciares
  810.     moveq    #0,d0
  811.     move.l    4.w,a6
  812.     jsr    -$1f2(a6)
  813.     move.l    d0,P61_ciares(a3)
  814.     beq.b    P61_err
  815.     move.l    d0,a6
  816.     lea    P61_timerinterrupt(pc),a1
  817.     moveq    #0,d0
  818.     jsr    -6(a6)
  819.     tst.l    d0
  820.     beq.b    P61_gottimer
  821.     addq.l    #4,d3
  822.     lea    P61_timerinterrupt(pc),a1
  823.     moveq    #1,d0
  824.     jsr    -6(a6)
  825.     tst.l    d0
  826.     bne.b    P61_err
  827.  
  828. P61_gottimer
  829.     lea    P61_craddr+8(pc),a6
  830.     move.l    P61_ciaaddr(pc,d3),d0
  831.     move.l    d0,(a6)
  832.     sub    #$100,d0
  833.     move.l    d0,-(a6)
  834.     moveq    #2,d3
  835.     btst    #9,d0
  836.     bne.b    P61_timerB
  837.     subq.b    #1,d3
  838.     add    #$100,d0
  839. P61_timerB
  840.     add    #$900,d0
  841.     move.l    d0,-(a6)
  842.     move.l    d0,a0
  843.     and.b    #%10000000,(a0)
  844.     move.b    d3,P61_timeropen(a3)
  845.     moveq    #0,d0
  846.  
  847.     ifne    CIA
  848.     move.l    P61_craddr+4(pc),a1
  849.     move.b    P61_tlo(pc),(a1)
  850.     move.b    P61_thi(pc),$100(a1)
  851.     endc
  852.     or.b    #$19,(a0)
  853. P61_pois
  854.     move.l    (sp)+,a6
  855.     rts
  856.  
  857. P61_err    moveq    #-1,d0
  858.     bra.b    P61_pois
  859.     rts
  860.  
  861. P61_ciaaddr
  862.     dc.l    $bfd500,$bfd700
  863.     endc
  864.  
  865. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  866. ;­         Call P61_End to stop the music        ­
  867. ;­   A6 --> Customchip baseaddress ($DFF000)    ­
  868. ;­        Uses D0/D1/A0/A1/A3        ­
  869. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  870.  
  871. P61_End    moveq    #0,d0
  872.     move    d0,$a8(a6)
  873.     move    d0,$b8(a6)
  874.     move    d0,$c8(a6)
  875.     move    d0,$d8(a6)
  876.     move    #$f,$96(a6)
  877.  
  878.     and.b    #~2,$bfe001
  879.     move.b    P61_ofilter(pc),d0
  880.     or.b    d0,$bfe001
  881.  
  882.     ifeq    system
  883.     move    #$2000,$9a(a6)
  884.     move.l    P61_vektori(pc),a0
  885.     move.l    P61_oldlev6(pc),(a0)
  886.     lea    $bfd000,a0
  887.     lea    P61_Timers(pc),a1
  888.     move.b    (a1)+,$400(a0)
  889.     move.b    (a1)+,$500(a0)
  890.     move.b    (a1)+,$600(a0)
  891.     move.b    (a1)+,$700(a0)
  892.     move.b    #$10,$e00(a0)
  893.     move.b    #$10,$f00(a0)
  894.  
  895.     else
  896.     move.l    a6,-(sp)
  897.     lea    P61_cn(pc),a3
  898.     moveq    #0,d0
  899.     move.b    P61_timeropen(pc),d0
  900.     beq.b    P61_rem1
  901.     move.l    P61_ciares(pc),a6
  902.     lea    P61_timerinterrupt(pc),a1
  903.     subq.b    #1,d0
  904.     jsr    -12(a6)
  905. P61_rem1
  906.     move.l    4.w,a6
  907.     tst.b    P61_audioopen(a3)
  908.     beq.b    P61_rem2
  909.     lea    P61_allocreq(pc),a1
  910.     jsr    -$1c2(a6)
  911.     clr.b    P61_audioopen(a3)
  912. P61_rem2
  913.     moveq    #0,d0
  914.     move.b    P61_sigbit(pc),d0
  915.     bmi.b    P61_rem3
  916.     jsr    -$150(a6)
  917.     st    P61_sigbit(a3)
  918. P61_rem3
  919.     move.l    (sp)+,a6
  920.     endc
  921.     rts
  922.  
  923.     ifne    fade
  924. P61_mfade
  925.     move    P61_Master(pc),d0
  926.     move    P61_temp0+P61_Shadow(pc),d1
  927.     mulu    d0,d1
  928.     lsr    #6,d1
  929.     move    d1,$a8(a6)
  930.  
  931.     ifgt    channels-1
  932.     move    P61_temp1+P61_Shadow(pc),d1
  933.     mulu    d0,d1
  934.     lsr    #6,d1
  935.     move    d1,$b8(a6)
  936.     endc
  937.  
  938.     ifgt    channels-2
  939.     move    P61_temp2+P61_Shadow(pc),d1
  940.     mulu    d0,d1
  941.     lsr    #6,d1
  942.     move    d1,$c8(a6)
  943.     endc
  944.  
  945.     ifgt    channels-3
  946.     move    P61_temp3+P61_Shadow(pc),d1
  947.     mulu    d0,d1
  948.     lsr    #6,d1
  949.     move    d1,$d8(a6)
  950.     endc
  951.     rts
  952.     endc
  953.     
  954.  
  955. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  956. ;­ Call P61_SetPosition to jump to a specific    ­
  957. ;­          position in the song.        ­
  958. ;­ D0.l --> Position                ­
  959. ;­ Starts from the beginning if out of limits.    ­
  960. ;­              Uses A0/A1/A3/D0-D3        ­
  961. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  962.  
  963. P61_SetPosition
  964.     ifne    jump
  965.     lea    P61_cn(pc),a3
  966.     ifne    P61_pl
  967.     clr    P61_plflag(a3)
  968.     endc
  969.     moveq    #0,d1
  970.     move.b    d0,d1
  971.     move.l    d1,d0
  972.     cmp    P61_slen(a3),d0
  973.     blo.b    .e
  974.     moveq    #0,d0
  975. .e    move    d0,P61_Pos(a3)
  976.     add.l    P61_possibase(pc),d0
  977.     move.l    d0,P61_spos(a3)
  978.  
  979.     moveq    #64,d0
  980.     move    d0,P61_rowpos(a3)
  981.     clr    P61_CRow(a3)
  982.     move.l    P61_spos(pc),a1
  983.     move.l    P61_patternbase(pc),a0
  984.     addq    #1,P61_Pos(a3)
  985.     move.b    (a1)+,d0
  986.     move.l    a1,P61_spos(a3)
  987.     move.l    P61_positionbase(pc),a1
  988.     move    d0,P61_Patt(a3)
  989.     lsl    #3,d0
  990.     add.l    d0,a1
  991.     movem    (a1),d0-d3
  992.     lea    (a0,d0.l),a1
  993.     move    d1,d0
  994.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  995.     lea    (a0,d0.l),a1
  996.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  997.     move    d2,d0
  998.     lea    (a0,d0.l),a1
  999.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  1000.     move    d3,d0
  1001.     add.l    d0,a0
  1002.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  1003.     rts
  1004.     endc
  1005.  
  1006. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  1007. ;­ Call P61_Music every frame to play the music    ­
  1008. ;­      _NOT_ if CIA-version is used!        ­
  1009. ;­ A6 --> Customchip baseaddress ($DFF000)    ­
  1010. ;­              Uses A0-A5/D0-D7        ­
  1011. ;­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
  1012.  
  1013. P61_Music
  1014.     lea    P61_cn(pc),a3
  1015.  
  1016.     tst    P61_Play(a3)
  1017.     bne.b    P61_ohitaaa
  1018.     ifne    CIA
  1019.     ifne    system
  1020.     move.l    P61_craddr+4(pc),a0
  1021.     move.b    P61_tlo2(pc),(a0)
  1022.     move.b    P61_thi2(pc),$100(a0)
  1023.     endc
  1024.     endc
  1025.     rts
  1026.  
  1027. P61_ohitaaa
  1028.     ifne    fade
  1029.     pea    P61_mfade(pc)
  1030.     endc
  1031.  
  1032.     moveq    #Channel_Block_SIZE,d6
  1033.     moveq    #16,d7
  1034.  
  1035.     move    (a3),d4
  1036.     addq    #1,d4
  1037.     cmp    P61_speed(pc),d4
  1038.     beq    P61_playtime
  1039.  
  1040.     move    d4,(a3)
  1041.  
  1042. P61_delay
  1043.     ifne    CIA
  1044.     ifne    system
  1045.     move.l    P61_craddr+4(pc),a0
  1046.     move.b    P61_tlo2(pc),(a0)
  1047.     move.b    P61_thi2(pc),$100(a0)
  1048.     endc
  1049.     endc
  1050.  
  1051.     lea    P61_temp0(pc),a5
  1052.     lea    $a0(a6),a4
  1053.  
  1054.     moveq    #channels-1,d5
  1055. P61_lopas
  1056.     tst    P61_OnOff(a5)
  1057.     beq    P61_contfxdone
  1058.     moveq    #$f,d0
  1059.     and    (a5),d0
  1060.     ifeq    opt020
  1061.     add    d0,d0
  1062.     move    P61_jtab2(pc,d0),d0
  1063.     else
  1064.     move    P61_jtab2(pc,d0*2),d0
  1065.     endc
  1066.     jmp    P61_jtab2(pc,d0)
  1067.  
  1068. P61_jtab2
  1069.     dc    P61_contfxdone-P61_jtab2
  1070.  
  1071.     ifne    P61_pu
  1072.     dc    P61_portup-P61_jtab2
  1073.     else
  1074.     dc    P61_contfxdone-P61_jtab2
  1075.     endc
  1076.  
  1077.     ifne    P61_pd
  1078.     dc    P61_portdwn-P61_jtab2
  1079.     else
  1080.     dc    P61_contfxdone-P61_jtab2
  1081.     endc
  1082.  
  1083.     ifne    P61_tp
  1084.     dc    P61_toneport-P61_jtab2
  1085.     else
  1086.     dc    P61_contfxdone-P61_jtab2
  1087.     endc
  1088.  
  1089.     ifne    P61_vib
  1090.     dc    P61_vib2-P61_jtab2
  1091.     else
  1092.     dc    P61_contfxdone-P61_jtab2
  1093.     endc
  1094.  
  1095.     ifne    P61_tpvs
  1096.     dc    P61_tpochvslide-P61_jtab2
  1097.     else
  1098.     dc    P61_contfxdone-P61_jtab2
  1099.     endc
  1100.  
  1101.     ifne    P61_vbvs
  1102.     dc    P61_vibochvslide-P61_jtab2
  1103.     else
  1104.     dc    P61_contfxdone-P61_jtab2
  1105.     endc
  1106.  
  1107.     ifne    P61_tre
  1108.     dc    P61_tremo-P61_jtab2
  1109.     else
  1110.     dc    P61_contfxdone-P61_jtab2
  1111.     endc
  1112.  
  1113.     ifne    P61_arp
  1114.     dc    P61_arpeggio-P61_jtab2
  1115.     else
  1116.     dc    P61_contfxdone-P61_jtab2
  1117.     endc
  1118.  
  1119.     dc    P61_contfxdone-P61_jtab2
  1120.  
  1121.     ifne    P61_vs
  1122.     dc    P61_volslide-P61_jtab2
  1123.     else
  1124.     dc    P61_contfxdone-P61_jtab2
  1125.     endc
  1126.  
  1127.     dc    P61_contfxdone-P61_jtab2
  1128.     dc    P61_contfxdone-P61_jtab2
  1129.     dc    P61_contfxdone-P61_jtab2
  1130.  
  1131.     ifne    P61_ec
  1132.     dc    P61_contecommands-P61_jtab2
  1133.     else
  1134.     dc    P61_contfxdone-P61_jtab2
  1135.     endc
  1136.     dc    P61_contfxdone-P61_jtab2
  1137.  
  1138.     ifne    P61_ec
  1139. P61_contecommands
  1140.     move.b    P61_Info(a5),d0
  1141.     and    #$f0,d0
  1142.     lsr    #3,d0
  1143.     move    P61_etab2(pc,d0),d0
  1144.     jmp    P61_etab2(pc,d0)
  1145.  
  1146. P61_etab2
  1147.     dc    P61_contfxdone-P61_etab2
  1148.  
  1149.     ifne    P61_fsu
  1150.     dc    P61_fineup2-P61_etab2
  1151.     else
  1152.     dc    P61_contfxdone-P61_etab2
  1153.     endc
  1154.  
  1155.     ifne    P61_fsd
  1156.     dc    P61_finedwn2-P61_etab2
  1157.     else
  1158.     dc    P61_contfxdone-P61_etab2
  1159.     endc
  1160.  
  1161.     dc    P61_contfxdone-P61_etab2
  1162.     dc    P61_contfxdone-P61_etab2
  1163.  
  1164.     dc    P61_contfxdone-P61_etab2
  1165.     dc    P61_contfxdone-P61_etab2
  1166.  
  1167.     dc    P61_contfxdone-P61_etab2
  1168.     dc    P61_contfxdone-P61_etab2
  1169.  
  1170.     ifne    P61_rt
  1171.     dc    P61_retrig-P61_etab2
  1172.     else
  1173.     dc    P61_contfxdone-P61_etab2
  1174.     endc
  1175.  
  1176.     ifne    P61_fvu
  1177.     dc    P61_finevup2-P61_etab2
  1178.     else
  1179.     dc    P61_contfxdone-P61_etab2
  1180.     endc
  1181.  
  1182.     ifne    P61_fvd
  1183.     dc    P61_finevdwn2-P61_etab2
  1184.     else
  1185.     dc    P61_contfxdone-P61_etab2
  1186.     endc
  1187.  
  1188.     ifne    P61_nc
  1189.     dc    P61_notecut-P61_etab2
  1190.     else
  1191.     dc    P61_contfxdone-P61_etab2
  1192.     endc
  1193.  
  1194.     ifne    P61_nd
  1195.     dc    P61_notedelay-P61_etab2
  1196.     else
  1197.     dc    P61_contfxdone-P61_etab2
  1198.     endc
  1199.  
  1200.     dc    P61_contfxdone-P61_etab2
  1201.     dc    P61_contfxdone-P61_etab2
  1202.     endc
  1203.  
  1204.     ifne    P61_fsu
  1205. P61_fineup2
  1206.     tst    (a3)
  1207.     bne    P61_contfxdone
  1208.     moveq    #$f,d0
  1209.     and.b    P61_Info(a5),d0
  1210.     sub    d0,P61_Period(a5)
  1211.     moveq    #113,d0
  1212.     cmp    P61_Period(a5),d0
  1213.     ble.b    .jup
  1214.     move    d0,P61_Period(a5)
  1215. .jup    move    P61_Period(a5),6(a4)
  1216.     bra    P61_contfxdone
  1217.     endc
  1218.  
  1219.     ifne    P61_fsd
  1220. P61_finedwn2
  1221.     tst    (a3)
  1222.     bne    P61_contfxdone
  1223.     moveq    #$f,d0
  1224.     and.b    P61_Info(a5),d0
  1225.     add    d0,P61_Period(a5)
  1226.     cmp    #856,P61_Period(a5)
  1227.     ble.b    .jup
  1228.     move    #856,P61_Period(a5)
  1229. .jup    move    P61_Period(a5),6(a4)
  1230.     bra    P61_contfxdone
  1231.     endc
  1232.  
  1233.     ifne    P61_fvu
  1234. P61_finevup2
  1235.     tst    (a3)
  1236.     bne    P61_contfxdone
  1237.     moveq    #$f,d0
  1238.     and.b    P61_Info(a5),d0
  1239.     add    d0,P61_Volume(a5)
  1240.     moveq    #64,d0
  1241.     cmp    P61_Volume(a5),d0
  1242.     bge.b    .jup
  1243.     move    d0,P61_Volume(a5)
  1244. .jup    move    P61_Volume(a5),8(a4)
  1245.     bra    P61_contfxdone
  1246.     endc
  1247.  
  1248.     ifne    P61_fvd
  1249. P61_finevdwn2
  1250.     tst    (a3)
  1251.     bne    P61_contfxdone
  1252.     moveq    #$f,d0
  1253.     and.b    P61_Info(a5),d0
  1254.     sub    d0,P61_Volume(a5)
  1255.     bpl.b    .jup
  1256.     clr    P61_Volume(a5)
  1257. .jup    move    P61_Volume(a5),8(a4)
  1258.     bra    P61_contfxdone
  1259.     endc
  1260.  
  1261.     ifne    P61_nc
  1262. P61_notecut
  1263.     moveq    #$f,d0
  1264.     and.b    P61_Info(a5),d0
  1265.     cmp    (a3),d0
  1266.     bne    P61_contfxdone
  1267.     ifeq    fade
  1268.     clr    8(a4)
  1269.     else
  1270.     clr    P61_Shadow(a5)
  1271.     endc
  1272.     clr    P61_Volume(a5)
  1273.     bra    P61_contfxdone
  1274.     endc
  1275.  
  1276.     ifne    P61_nd
  1277. P61_notedelay
  1278.     moveq    #$f,d0
  1279.     and.b    P61_Info(a5),d0
  1280.     cmp    (a3),d0
  1281.     bne    P61_contfxdone
  1282.  
  1283.     moveq    #$7e,d0
  1284.     and.b    (a5),d0
  1285.     beq    P61_contfxdone
  1286.     move    P61_DMABit(a5),d0
  1287.     move    d0,$96(a6)
  1288.     or    d0,P61_dma(a3)
  1289.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1290.     move.l    (a1)+,(a4)+            ;Pointer
  1291.     move    (a1),(a4)+            ;Length
  1292.     move    P61_Period(a5),(a4)
  1293.     subq.l    #6,a4
  1294.  
  1295.     ifeq    system
  1296.     lea    P61_dmason(pc),a1
  1297.     move.l    P61_vektori(pc),a0
  1298.     move.l    a1,(a0)
  1299.     move.b    #$f0,$bfd600
  1300.     move.b    #$01,$bfd700
  1301.     move.b    #$19,$bfdf00
  1302.     else
  1303.     move    #1,P61_server(a3)
  1304.     move.l    P61_craddr+4(pc),a1
  1305.     move.b    #$f0,(a1)
  1306.     move.b    #1,$100(a1)
  1307.     endc
  1308.     bra    P61_contfxdone
  1309.     endc
  1310.  
  1311.     ifne    P61_rt
  1312. P61_retrig
  1313.     subq    #1,P61_RetrigCount(a5)
  1314.     bne    P61_contfxdone
  1315.     move    P61_DMABit(a5),d0
  1316.     move    d0,$96(a6)
  1317.     or    d0,P61_dma(a3)
  1318.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1319.     move.l    (a1)+,(a4)            ;Pointer
  1320.     move    (a1),4(a4)            ;Length
  1321.  
  1322.     ifeq    system
  1323.     lea    P61_dmason(pc),a1
  1324.     move.l    P61_vektori(pc),a0
  1325.     move.l    a1,(a0)
  1326.     move.b    #$f0,$bfd600
  1327.     move.b    #$01,$bfd700
  1328.     move.b    #$19,$bfdf00
  1329.     else
  1330.     move    #1,P61_server(a3)
  1331.     move.l    P61_craddr+4(pc),a1
  1332.     move.b    #$f0,(a1)
  1333.     move.b    #1,$100(a1)
  1334.     endc
  1335.  
  1336.     moveq    #$f,d0
  1337.     and.b    P61_Info(a5),d0
  1338.     move    d0,P61_RetrigCount(a5)
  1339.     bra    P61_contfxdone
  1340.     endc
  1341.  
  1342.     ifne    P61_arp
  1343. P61_arplist
  1344.     dc.b 0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1,2,0,1
  1345.  
  1346. P61_arpeggio
  1347.     move    (a3),d0
  1348.     move.b    P61_arplist(pc,d0),d0
  1349.     beq.b    .arp0
  1350.     subq.b    #1,d0
  1351.     beq.b    P61_arp1
  1352.     moveq    #$f,d0
  1353.     and.b    P61_Info(a5),d0
  1354.     bra.b    P61_arp3
  1355.  
  1356. .arp0    move    P61_Note(a5),d0
  1357.     move    P61_periods(pc,d0),6(a4)
  1358.     bra    P61_contfxdone
  1359. P61_arp1
  1360.     move.b    P61_Info(a5),d0
  1361.     lsr    #4,d0
  1362. P61_arp3
  1363.     add    d0,d0
  1364.     add    P61_Note(a5),d0
  1365.     move    P61_periods(pc,d0),6(a4)
  1366.     bra    P61_contfxdone
  1367.     endc
  1368.  
  1369. P61_periods
  1370.     ifne    P61_ft
  1371.  
  1372.     dc.w    $358,$358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A
  1373.     dc.w    $1FC,$1E0,$1C5,$1AC,$194,$17D,$168,$153,$140,$12E
  1374.     dc.w    $11D,$10D,$FE,$F0,$E2,$D6,$CA,$BE,$B4,$AA,$A0,$97
  1375.     dc.w    $8F,$87,$7F,$78,$71,$352,$352,$322,$2F5,$2CB,$2A2
  1376.     dc.w    $27D,$259,$237,$217,$1F9,$1DD,$1C2,$1A9,$191,$17B
  1377.     dc.w    $165,$151,$13E,$12C,$11C,$10C,$FD,$EF,$E1,$D5,$C9
  1378.     dc.w    $BD,$B3,$A9,$9F,$96,$8E,$86,$7E,$77,$71,$34C,$34C
  1379.     dc.w    $31C,$2F0,$2C5,$29E,$278,$255,$233,$214,$1F6,$1DA
  1380.     dc.w    $1BF,$1A6,$18E,$178,$163,$14F,$13C,$12A,$11A,$10A
  1381.     dc.w    $FB,$ED,$E0,$D3,$C7,$BC,$B1,$A7,$9E,$95,$8D,$85
  1382.     dc.w    $7D,$76,$70,$346,$346,$317,$2EA,$2C0,$299,$274
  1383.     dc.w    $250,$22F,$210,$1F2,$1D6,$1BC,$1A3,$18B,$175,$160
  1384.     dc.w    $14C,$13A,$128,$118,$108,$F9,$EB,$DE,$D1,$C6,$BB
  1385.     dc.w    $B0,$A6,$9D,$94,$8C,$84,$7D,$76,$6F,$340,$340
  1386.     dc.w    $311,$2E5,$2BB,$294,$26F,$24C,$22B,$20C,$1EF,$1D3
  1387.     dc.w    $1B9,$1A0,$188,$172,$15E,$14A,$138,$126,$116,$106
  1388.     dc.w    $F7,$E9,$DC,$D0,$C4,$B9,$AF,$A5,$9C,$93,$8B,$83
  1389.     dc.w    $7C,$75,$6E,$33A,$33A,$30B,$2E0,$2B6,$28F,$26B
  1390.     dc.w    $248,$227,$208,$1EB,$1CF,$1B5,$19D,$186,$170,$15B
  1391.     dc.w    $148,$135,$124,$114,$104,$F5,$E8,$DB,$CE,$C3,$B8
  1392.     dc.w    $AE,$A4,$9B,$92,$8A,$82,$7B,$74,$6D,$334,$334
  1393.     dc.w    $306,$2DA,$2B1,$28B,$266,$244,$223,$204,$1E7,$1CC
  1394.     dc.w    $1B2,$19A,$183,$16D,$159,$145,$133,$122,$112,$102
  1395.     dc.w    $F4,$E6,$D9,$CD,$C1,$B7,$AC,$A3,$9A,$91,$89,$81
  1396.     dc.w    $7A,$73,$6D,$32E,$32E,$300,$2D5,$2AC,$286,$262
  1397.     dc.w    $23F,$21F,$201,$1E4,$1C9,$1AF,$197,$180,$16B,$156
  1398.     dc.w    $143,$131,$120,$110,$100,$F2,$E4,$D8,$CC,$C0,$B5
  1399.     dc.w    $AB,$A1,$98,$90,$88,$80,$79,$72,$6C,$38B,$38B
  1400.     dc.w    $358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A,$1FC
  1401.     dc.w    $1E0,$1C5,$1AC,$194,$17D,$168,$153,$140,$12E,$11D
  1402.     dc.w    $10D,$FE,$F0,$E2,$D6,$CA,$BE,$B4,$AA,$A0,$97,$8F
  1403.     dc.w    $87,$7F,$78,$384,$384,$352,$322,$2F5,$2CB,$2A3
  1404.     dc.w    $27C,$259,$237,$217,$1F9,$1DD,$1C2,$1A9,$191,$17B
  1405.     dc.w    $165,$151,$13E,$12C,$11C,$10C,$FD,$EE,$E1,$D4,$C8
  1406.     dc.w    $BD,$B3,$A9,$9F,$96,$8E,$86,$7E,$77,$37E,$37E
  1407.     dc.w    $34C,$31C,$2F0,$2C5,$29E,$278,$255,$233,$214,$1F6
  1408.     dc.w    $1DA,$1BF,$1A6,$18E,$178,$163,$14F,$13C,$12A,$11A
  1409.     dc.w    $10A,$FB,$ED,$DF,$D3,$C7,$BC,$B1,$A7,$9E,$95,$8D
  1410.     dc.w    $85,$7D,$76,$377,$377,$346,$317,$2EA,$2C0,$299
  1411.     dc.w    $274,$250,$22F,$210,$1F2,$1D6,$1BC,$1A3,$18B,$175
  1412.     dc.w    $160,$14C,$13A,$128,$118,$108,$F9,$EB,$DE,$D1,$C6
  1413.     dc.w    $BB,$B0,$A6,$9D,$94,$8C,$84,$7D,$76,$371,$371
  1414.     dc.w    $340,$311,$2E5,$2BB,$294,$26F,$24C,$22B,$20C,$1EE
  1415.     dc.w    $1D3,$1B9,$1A0,$188,$172,$15E,$14A,$138,$126,$116
  1416.     dc.w    $106,$F7,$E9,$DC,$D0,$C4,$B9,$AF,$A5,$9C,$93,$8B
  1417.     dc.w    $83,$7B,$75,$36B,$36B,$33A,$30B,$2E0,$2B6,$28F
  1418.     dc.w    $26B,$248,$227,$208,$1EB,$1CF,$1B5,$19D,$186,$170
  1419.     dc.w    $15B,$148,$135,$124,$114,$104,$F5,$E8,$DB,$CE,$C3
  1420.     dc.w    $B8,$AE,$A4,$9B,$92,$8A,$82,$7B,$74,$364,$364
  1421.     dc.w    $334,$306,$2DA,$2B1,$28B,$266,$244,$223,$204,$1E7
  1422.     dc.w    $1CC,$1B2,$19A,$183,$16D,$159,$145,$133,$122,$112
  1423.     dc.w    $102,$F4,$E6,$D9,$CD,$C1,$B7,$AC,$A3,$9A,$91,$89
  1424.     dc.w    $81,$7A,$73,$35E,$35E,$32E,$300,$2D5,$2AC,$286
  1425.     dc.w    $262,$23F,$21F,$201,$1E4,$1C9,$1AF,$197,$180,$16B
  1426.     dc.w    $156,$143,$131,$120,$110,$100,$F2,$E4,$D8,$CB,$C0
  1427.     dc.w    $B5,$AB,$A1,$98,$90,$88,$80,$79,$72
  1428.  
  1429.     else
  1430.  
  1431.     dc.w    $358,$358,$328,$2FA,$2D0,$2A6,$280,$25C,$23A,$21A
  1432.     dc.w    $1FC,$1E0,$1C5,$1AC,$194,$17D,$168,$153,$140,$12E
  1433.     dc.w    $11D,$10D,$FE,$F0,$E2,$D6,$CA,$BE,$B4,$AA,$A0,$97
  1434.     dc.w    $8F,$87,$7F,$78,$71
  1435.  
  1436.     endc
  1437.  
  1438.     ifne    P61_vs
  1439. P61_volslide
  1440.     move.b    P61_Info(a5),d0
  1441.     sub.b    d0,P61_Volume+1(a5)
  1442.     bpl.b    .test
  1443.     clr    P61_Volume(a5)
  1444.     ifeq    fade
  1445.     clr    8(a4)
  1446.     else
  1447.     clr    P61_Shadow(a5)
  1448.     endc
  1449.     bra    P61_contfxdone
  1450. .test    moveq    #64,d0
  1451.     cmp    P61_Volume(a5),d0
  1452.     bge.b    .ncs
  1453.     move    d0,P61_Volume(a5)
  1454.     ifeq    fade
  1455.     move    d0,8(a4)
  1456.     else
  1457.     move    d0,P61_Shadow(a5)
  1458.     endc
  1459.     bra.b    P61_contfxdone
  1460. .ncs    ifeq    fade
  1461.     move    P61_Volume(a5),8(a4)
  1462.     else
  1463.     move    P61_Volume(a5),P61_Shadow(a5)
  1464.     endc
  1465.     bra.b    P61_contfxdone
  1466.     endc
  1467.  
  1468.     ifne    P61_tpvs
  1469. P61_tpochvslide
  1470.     move.b    P61_Info(a5),d0
  1471.     sub.b    d0,P61_Volume+1(a5)
  1472.     bpl.b    .test
  1473.     clr    P61_Volume(a5)
  1474.     ifeq    fade
  1475.     clr    8(a4)
  1476.     else
  1477.     clr    P61_Shadow(a5)
  1478.     endc
  1479.     bra.b    P61_toneport
  1480. .test    moveq    #64,d0
  1481.     cmp    P61_Volume(a5),d0
  1482.     bge.b    .ncs
  1483.     move    d0,P61_Volume(a5)
  1484. .ncs    ifeq    fade
  1485.     move    P61_Volume(a5),8(a4)
  1486.     else
  1487.     move    P61_Volume(a5),P61_Shadow(a5)
  1488.     endc
  1489.     endc
  1490.  
  1491.     ifne    P61_tp
  1492. P61_toneport
  1493.     move    P61_ToPeriod(a5),d0
  1494.     beq.b    P61_contfxdone
  1495.     move    P61_TPSpeed(a5),d1
  1496.     cmp    P61_Period(a5),d0
  1497.     blt.b    .topoup
  1498.  
  1499.     add    d1,P61_Period(a5)
  1500.     cmp    P61_Period(a5),d0
  1501.     bgt.b    P61_toposetper
  1502.     move    d0,P61_Period(a5)
  1503.     clr    P61_ToPeriod(a5)
  1504.     move    d0,6(a4)
  1505.     bra.b    P61_contfxdone
  1506.  
  1507. .topoup
  1508.     sub    d1,P61_Period(a5)
  1509.     cmp    P61_Period(a5),d0
  1510.     blt.b    P61_toposetper
  1511.     move    d0,P61_Period(a5)
  1512.     clr    P61_ToPeriod(a5)
  1513. P61_toposetper
  1514.     move    P61_Period(a5),6(a4)
  1515.     else
  1516.     nop
  1517.     endc
  1518.  
  1519. P61_contfxdone
  1520.     ifne    P61_il
  1521.     bsr    P61_funk2
  1522.     endc
  1523.  
  1524.     add.l    d6,a5
  1525.     add.l    d7,a4
  1526.     dbf    d5,P61_lopas
  1527.  
  1528.     cmp    P61_speed2(pc),d4
  1529.     beq.b    P61_preplay
  1530.     rts
  1531.  
  1532.     ifne    P61_pu
  1533. P61_portup
  1534.     moveq    #0,D0
  1535.     move.b    P61_Info(a5),d0
  1536.     sub    d0,P61_Period(a5)
  1537.     moveq    #113,d0
  1538.     cmp    P61_Period(a5),d0
  1539.     ble.b    .skip
  1540.     move    d0,P61_Period(a5)
  1541.     move    d0,6(a4)
  1542.     bra.b    P61_contfxdone
  1543. .skip
  1544.     move    P61_Period(a5),6(a4)
  1545.     bra.b    P61_contfxdone
  1546.     endc
  1547.  
  1548.     ifne    P61_pd
  1549. P61_portdwn
  1550.     moveq    #0,d0
  1551.     move.b    P61_Info(a5),d0
  1552.     add    d0,P61_Period(a5)
  1553.     cmp    #856,P61_Period(a5)
  1554.     ble.b    .skip
  1555.     move    #856,d0
  1556.     move    d0,P61_Period(a5)
  1557.     move    d0,6(a4)
  1558.     bra.b    P61_contfxdone
  1559. .skip
  1560.     move    P61_Period(a5),6(a4)
  1561.     bra.b    P61_contfxdone
  1562.     endc
  1563.  
  1564.     ifne    P61_pde
  1565. P61_return
  1566.     rts
  1567.  
  1568. P61_preplay
  1569.     tst    P61_pdflag(a3)
  1570.     bne.b    P61_return
  1571.     else
  1572. P61_preplay
  1573.     endc
  1574.  
  1575.     lea    P61_temp0(pc),a5
  1576.     lea    P61_Samples-16(pc),a0
  1577.  
  1578.     moveq    #channels-1,d5
  1579. P61_loaps
  1580.     ifne    P61_pl
  1581.     lea    P61_TData(a5),a1
  1582.     move    2(a5),(a1)+
  1583.     move.l    P61_ChaPos(a5),(a1)+
  1584.     move.l    P61_TempPos(a5),(a1)+
  1585.     move    P61_TempLen(a5),(a1)
  1586.     endc
  1587.  
  1588.     move.b    P61_Pack(a5),d0
  1589.     and.b    #$3f,d0
  1590.     beq.b    P61_takeone
  1591.  
  1592.     tst.b    P61_Pack(a5)
  1593.     bmi.b    .keepsame
  1594.  
  1595.     subq.b    #1,P61_Pack(a5)
  1596.     clr    P61_OnOff(a5)            ; Empty row
  1597.     add.l    d6,a5
  1598.     dbf    d5,P61_loaps
  1599.     rts
  1600.  
  1601. .keepsame
  1602.     subq.b    #1,P61_Pack(a5)
  1603.     bra    P61_dko
  1604.  
  1605. P61_takeone
  1606.     tst.b    P61_TempLen+1(a5)
  1607.     beq    P61_takenorm
  1608.  
  1609.     subq.b    #1,P61_TempLen+1(a5)
  1610.     move.l    P61_TempPos(a5),a2
  1611.  
  1612. P61_jedi
  1613.     move.b    (a2)+,d0
  1614.     moveq    #%01100000,d1
  1615.     and.b    d0,d1
  1616.     cmp.b    #%01100000,d1
  1617.     bne.b    .all
  1618.  
  1619.     moveq    #%01110000,d1
  1620.     and.b    d0,d1
  1621.     cmp.b    #%01110000,d1
  1622.     bne.b    .cmd
  1623.  
  1624.     moveq    #%01111000,d1
  1625.     and.b    d0,d1
  1626.     cmp.b    #%01111000,d1
  1627.     bne.b    .note
  1628.  
  1629. .empty    clr    P61_OnOff(a5)            ; Empty row
  1630.     clr    (a5)+
  1631.     clr.b    (a5)+
  1632.     tst.b    d0
  1633.     bpl.b    .ex
  1634.     move.b    (a2)+,(a5)            ; Compression info
  1635.     bra.b    .ex
  1636.  
  1637. .all    move.b    d0,(a5)+
  1638.     ifeq    opt020
  1639.     move.b    (a2)+,(a5)+
  1640.     move.b    (a2)+,(a5)+
  1641.     else
  1642.     move    (a2)+,(a5)+
  1643.     endc
  1644.     tst.b    d0
  1645.     bpl.b    .ex
  1646.     move.b    (a2)+,(a5)            ; Compression info
  1647.     bra.b    .ex
  1648.  
  1649. .cmd    moveq    #$f,d1
  1650.     and    d0,d1
  1651.     move    d1,(a5)+            ; cmd
  1652.     move.b    (a2)+,(a5)+            ; info
  1653.     tst.b    d0
  1654.     bpl.b    .ex
  1655.     move.b    (a2)+,(a5)            ; Compression info
  1656.     bra.b    .ex
  1657.  
  1658. .note    moveq    #7,d1
  1659.     and    d0,d1
  1660.     lsl    #8,d1
  1661.     move.b    (a2)+,d1
  1662.     lsl    #4,d1
  1663.     move    d1,(a5)+
  1664.     clr.b    (a5)+    
  1665.     tst.b    d0
  1666.     bpl.b    .ex
  1667.     move.b    (a2)+,(a5)            ; Compression info
  1668. .ex    subq.l    #3,a5
  1669.     move.l    a2,P61_TempPos(a5)
  1670.     bra    P61_dko
  1671.  
  1672.  
  1673. P61_takenorm
  1674.     move.l    P61_ChaPos(a5),a2
  1675.  
  1676.     move.b    (a2)+,d0
  1677.     moveq    #%01100000,d1
  1678.     and.b    d0,d1
  1679.     cmp.b    #%01100000,d1
  1680.     bne.b    .all
  1681.  
  1682.     moveq    #%01110000,d1
  1683.     and.b    d0,d1
  1684.     cmp.b    #%01110000,d1
  1685.     bne.b    .cmd
  1686.  
  1687.     moveq    #%01111000,d1
  1688.     and.b    d0,d1
  1689.     cmp.b    #%01111000,d1
  1690.     bne.b    .note
  1691.  
  1692. .empty    clr    P61_OnOff(a5)            ; Empty row
  1693.     clr    (a5)+
  1694.     clr.b    (a5)+
  1695.     tst.b    d0
  1696.     bpl.b    .proccomp
  1697.     move.b    (a2)+,(a5)            ; Compression info
  1698.     bra.b    .proccomp
  1699.  
  1700.  
  1701. .all    move.b    d0,(a5)+
  1702.     ifeq    opt020
  1703.     move.b    (a2)+,(a5)+
  1704.     move.b    (a2)+,(a5)+
  1705.     else
  1706.     move    (a2)+,(a5)+
  1707.     endc
  1708.     tst.b    d0
  1709.     bpl.b    .proccomp
  1710.     move.b    (a2)+,(a5)            ; Compression info
  1711.     bra.b    .proccomp
  1712.  
  1713. .cmd    moveq    #$f,d1
  1714.     and    d0,d1
  1715.     move    d1,(a5)+            ; cmd
  1716.     move.b    (a2)+,(a5)+            ; info
  1717.     tst.b    d0
  1718.     bpl.b    .proccomp
  1719.     move.b    (a2)+,(a5)            ; Compression info
  1720.     bra.b    .proccomp
  1721.  
  1722. .note    moveq    #7,d1
  1723.     and    d0,d1
  1724.     lsl    #8,d1
  1725.     move.b    (a2)+,d1
  1726.     lsl    #4,d1
  1727.     move    d1,(a5)+
  1728.     clr.b    (a5)+    
  1729.     tst.b    d0
  1730.     bpl.b    .proccomp
  1731.     move.b    (a2)+,(a5)            ; Compression info
  1732.  
  1733. .proccomp
  1734.     subq.l    #3,a5
  1735.     move.l    a2,P61_ChaPos(a5)
  1736.  
  1737.     tst.b    d0
  1738.     bpl.b    P61_dko
  1739.  
  1740.     move.b    3(a5),d0
  1741.     move.b    d0,d1
  1742.     and    #%11000000,d1
  1743.     beq.b    P61_dko                ; Empty datas
  1744.     cmp.b    #%10000000,d1
  1745.     beq.b    P61_dko                ; Same datas
  1746.  
  1747.     clr.b    3(a5)
  1748.     and    #$3f,d0
  1749.     move.b    d0,P61_TempLen+1(a5)
  1750.  
  1751.     cmp.b    #%11000000,d1
  1752.     beq.b    .bit16                ; 16-bit
  1753.  
  1754.     moveq    #0,d0                ; 8-bit
  1755.     move.b    (a2)+,d0
  1756.     move.l    a2,P61_ChaPos(a5)
  1757.     sub.l    d0,a2
  1758.     bra    P61_jedi
  1759.  
  1760. .bit16    moveq    #0,d0
  1761.     ifeq    opt020
  1762.     move.b    (a2)+,d0
  1763.     lsl    #8,d0
  1764.     move.b    (a2)+,d0
  1765.     else
  1766.     move    (a2)+,d0
  1767.     endc
  1768.  
  1769.     move.l    a2,P61_ChaPos(a5)
  1770.     sub.l    d0,a2
  1771.     bra    P61_jedi
  1772.  
  1773.  
  1774. P61_dko    st    P61_OnOff(a5)
  1775.     move    (a5),d0
  1776.     and    #$1f0,d0
  1777.     beq.b    .koto
  1778.     lea    (a0,d0),a1
  1779.     move.l    a1,P61_Sample(a5)
  1780.     ifne    P61_ft
  1781.     move.l    P61_SampleVolume(a1),P61_Volume(a5)
  1782.     else
  1783.     move    P61_SampleVolume(a1),P61_Volume(a5)
  1784.     endc
  1785.     ifne    P61_il
  1786.     move.l    P61_RepeatOffset(a1),P61_Wave(a5)
  1787.     endc
  1788.     ifne    P61_sof
  1789.     clr    P61_Offset(a5)
  1790.     endc
  1791.  
  1792. .koto    add.l    d6,a5
  1793.     dbf    d5,P61_loaps
  1794.     rts
  1795.  
  1796. P61_playtime
  1797.     clr    (a3)
  1798.  
  1799.     ifne    P61_pde
  1800.     tst    P61_pdelay(a3)
  1801.     beq.b    .djdj
  1802.     subq    #1,P61_pdelay(a3)
  1803.     bra    P61_delay
  1804. .djdj
  1805.     endc
  1806.  
  1807.     clr    P61_pdflag(a3)
  1808.  
  1809.     tst    P61_speedis1(a3)
  1810.     beq.b    .mo
  1811.     bsr    P61_preplay
  1812.  
  1813. .mo    lea    P61_temp0(pc),a5
  1814.     lea    $a0(a6),a4
  1815.  
  1816.     ifeq    system
  1817.     lea    P61_dmason(pc),a1
  1818.     move.l    P61_vektori(pc),a0
  1819.     move.l    a1,(a0)
  1820.     move.b    #$f0,$bfd600
  1821.     move.b    #$01,$bfd700
  1822.     move.b    #$19,$bfdf00
  1823.     else
  1824.     move    #1,P61_server(a3)
  1825.     move.l    P61_craddr+4(pc),a1
  1826.     move.b    #$f0,(a1)
  1827.     move.b    #1,$100(a1)
  1828.     endc
  1829.  
  1830.     lea    P61_periods(pc),a2
  1831.  
  1832.     moveq    #0,d4
  1833.     moveq    #channels-1,d5
  1834. P61_los    tst    P61_OnOff(a5)
  1835.     beq    P61_nocha
  1836.  
  1837.     moveq    #$f,d0
  1838.     and    (a5),d0
  1839.     lea    P61_jtab(pc),a1
  1840.     add    d0,d0
  1841.     add.l    d0,a1
  1842.     add    (a1),a1
  1843.     jmp    (a1)
  1844.  
  1845. P61_fxdone
  1846.     moveq    #$7e,d0
  1847.     and.b    (a5),d0
  1848.     beq.b    P61_nocha
  1849.     ifne    P61_vib
  1850.     clr.b    P61_VibPos(a5)
  1851.     endc
  1852.     ifne    P61_tre
  1853.     clr.b    P61_TrePos(a5)
  1854.     endc
  1855.  
  1856.      ifne    P61_ft
  1857.     add    P61_Fine(a5),d0
  1858.     endc
  1859.     move    d0,P61_Note(a5)
  1860.     move    (a2,d0),P61_Period(a5)
  1861.  
  1862. P61_zample
  1863.     ifne    P61_sof
  1864.     tst    P61_Offset(a5)
  1865.     bne    P61_pek
  1866.     endc
  1867.  
  1868.     or    P61_DMABit(a5),d4
  1869.     move    d4,$96(a6)
  1870.     move.l    P61_Sample(a5),a1        ;* Trigger *
  1871.     move.l    (a1)+,(a4)            ;Pointer
  1872.     move    (a1),4(a4)            ;Length
  1873.  
  1874. P61_nocha
  1875.     ifeq    fade
  1876.     move.l    P61_Period(a5),6(a4)
  1877.     else
  1878.     move    P61_Period(a5),6(a4)
  1879.     move    P61_Volume(a5),P61_Shadow(a5)
  1880.     endc
  1881.  
  1882. P61_skip
  1883.     ifne    P61_il
  1884.     bsr    P61_funk2
  1885.     endc
  1886.  
  1887.     add.l    d6,a5
  1888.     add.l    d7,a4
  1889.     dbf    d5,P61_los
  1890.  
  1891.     move.b    d4,P61_dma+1(a3)
  1892.  
  1893.     ifne    P61_pl
  1894.     tst.b    P61_plflag+1(a3)
  1895.     beq.b    P61_ohittaa
  1896.  
  1897.     lea    P61_temp0(pc),a1
  1898.     lea    P61_looppos(pc),a0
  1899.     moveq    #channels-1,d0
  1900. .talt    move.b    1(a0),3(a1)
  1901.     addq.l    #2,a0
  1902.     move.l    (a0)+,P61_ChaPos(a1)
  1903.     move.l    (a0)+,P61_TempPos(a1)
  1904.     move    (a0)+,P61_TempLen(a1)
  1905.     add.l    d6,a1
  1906.     dbf    d0,.talt
  1907.  
  1908.     move    P61_plrowpos(pc),P61_rowpos(a3)
  1909.     clr.b    P61_plflag+1(a3)
  1910.     moveq    #63,d0
  1911.     sub    P61_rowpos(a3),d0
  1912.     move    d0,P61_CRow(a3)
  1913.     rts
  1914.     endc
  1915.  
  1916. P61_ohittaa
  1917.     subq    #1,P61_rowpos(a3)
  1918.     bmi.b    P61_nextpattern
  1919.     moveq    #63,d0
  1920.     sub    P61_rowpos(a3),d0
  1921.     move    d0,P61_CRow(a3)
  1922.     rts
  1923.  
  1924. P61_nextpattern
  1925.     ifne    P61_pl
  1926.     clr    P61_plflag(a3)
  1927.     endc
  1928.     move.l    P61_patternbase(pc),a4
  1929.     moveq    #63,d0
  1930.     move    d0,P61_rowpos(a3)
  1931.     clr    P61_CRow(a3)
  1932.     move.l    P61_spos(pc),a1
  1933.     addq    #1,P61_Pos(a3)
  1934.     move.b    (a1)+,d0
  1935.     bpl.b    P61_dk
  1936.     move.l    P61_possibase(pc),a1
  1937.     move.b    (a1)+,d0
  1938.     clr    P61_Pos(a3)
  1939. P61_dk    move.l    a1,P61_spos(a3)
  1940.     move    d0,P61_Patt(a3)
  1941.     lsl    #3,d0
  1942.     move.l    P61_positionbase(pc),a1
  1943.     add.l    d0,a1
  1944.  
  1945.     move    (a1)+,d0
  1946.     lea    (a4,d0.l),a2
  1947.     move.l    a2,P61_ChaPos+P61_temp0(a3)
  1948.     move    (a1)+,d0
  1949.     lea    (a4,d0.l),a2
  1950.     move.l    a2,P61_ChaPos+P61_temp1(a3)
  1951.     move    (a1)+,d0
  1952.     lea    (a4,d0.l),a2
  1953.     move.l    a2,P61_ChaPos+P61_temp2(a3)
  1954.     move    (a1),d0
  1955.     add.l    d0,a4
  1956.     move.l    a4,P61_ChaPos+P61_temp3(a3)
  1957.     rts
  1958.  
  1959.     ifne    P61_tp
  1960. P61_settoneport
  1961.     move.b    P61_Info(a5),d0
  1962.     beq.b    P61_toponochange
  1963.     move.b    d0,P61_TPSpeed+1(a5)
  1964. P61_toponochange
  1965.     moveq    #$7e,d0
  1966.     and.b    (a5),d0
  1967.     beq    P61_nocha
  1968.     add    P61_Fine(a5),d0
  1969.     move    d0,P61_Note(a5)
  1970.     move    (a2,d0),P61_ToPeriod(a5)
  1971.     bra    P61_nocha
  1972.     endc
  1973.  
  1974.     ifne    P61_sof
  1975. P61_sampleoffse
  1976.     moveq    #$7e,d0
  1977.     and.b    (a5),d0
  1978.     beq    P61_nocha
  1979.     ifne    P61_vib
  1980.     clr.b    P61_VibPos(a5)
  1981.     endc
  1982.     ifne    P61_tre
  1983.     clr.b    P61_TrePos(a5)
  1984.     endc
  1985.  
  1986.     ifne    P61_ft
  1987.     add    P61_Fine(a5),d0
  1988.     endc
  1989.     move    d0,P61_Note(a5)
  1990.     move    (a2,d0),P61_Period(a5)
  1991.  
  1992.     moveq    #0,d1
  1993.     move    #$ff00,d1
  1994.     and    2(a5),d1
  1995.     bne.b    .deq
  1996.     move    P61_LOffset(a5),d1
  1997. .deq    move    d1,P61_LOffset(a5)
  1998.     add    d1,P61_Offset(a5)
  1999.     move    P61_Offset(a5),d2
  2000.  
  2001.     add    d1,P61_Offset(a5)        ; THIS IS A PT-FEATURE!
  2002.     bra.b    P61_hup
  2003.  
  2004. P61_pek    moveq    #0,d1
  2005.     move    P61_Offset(a5),d1
  2006. P61_hup    or    P61_DMABit(a5),d4
  2007.     move    d4,$96(a6)
  2008.     move.l    P61_Sample(a5),a1        ;* Trigger *
  2009.     move.l    (a1)+,d0
  2010.     add.l    d1,d0
  2011.     move.l    d0,(a4)                ;Pointer
  2012.     lsr    #1,d1
  2013.     move    (a1),d0
  2014.     sub    d1,d0
  2015.     bpl.b    P61_offok
  2016.     move.l    -4(a1),(a4)            ;Pointer is over the end
  2017.     moveq    #1,d0
  2018. P61_offok
  2019.     move    d0,4(a4)            ;Length
  2020.     bra    P61_nocha
  2021.     endc
  2022.  
  2023.     ifne    P61_vl
  2024. P61_volum
  2025.     move.b    P61_Info(a5),P61_Volume+1(a5)
  2026.     bra    P61_fxdone
  2027.     endc
  2028.  
  2029.     ifne    P61_pj
  2030. P61_posjmp
  2031.     moveq    #0,d0
  2032.     move.b    P61_Info(a5),d0
  2033.     cmp    P61_slen(a3),d0
  2034.     blo.b    .e
  2035.     moveq    #0,d0
  2036. .e    move    d0,P61_Pos(a3)
  2037.     add.l    P61_possibase(pc),d0
  2038.     move.l    d0,P61_spos(a3)
  2039.     endc
  2040.  
  2041.     ifne    P61_pb
  2042. P61_pattbreak
  2043.     moveq    #64,d0
  2044.     move    d0,P61_rowpos(a3)
  2045.     clr    P61_CRow(a3)
  2046.     move.l    P61_spos(pc),a1
  2047.     move.l    P61_patternbase(pc),a0
  2048.     addq    #1,P61_Pos(a3)
  2049.     move.b    (a1)+,d0
  2050.     bpl.b    P61_dk2
  2051.     move.l    P61_possibase(pc),a1
  2052.     move.b    (a1)+,d0
  2053.     clr    P61_Pos(a3)
  2054. P61_dk2    move.l    a1,P61_spos(a3)
  2055.     move.l    P61_positionbase(pc),a1
  2056.     move    d0,P61_Patt(a3)
  2057.     lsl    #3,d0
  2058.     add.l    d0,a1
  2059.     movem    (a1),d0-d3
  2060.     lea    (a0,d0.l),a1
  2061.     move    d1,d0
  2062.     move.l    a1,P61_ChaPos+P61_temp0(a3)
  2063.     lea    (a0,d0.l),a1
  2064.     move.l    a1,P61_ChaPos+P61_temp1(a3)
  2065.     move    d2,d0
  2066.     lea    (a0,d0.l),a1
  2067.     move.l    a1,P61_ChaPos+P61_temp2(a3)
  2068.     move    d3,d0
  2069.     add.l    d0,a0
  2070.     move.l    a0,P61_ChaPos+P61_temp3(a3)
  2071.     bra    P61_fxdone
  2072.     endc
  2073.  
  2074.     ifne    P61_vib
  2075. P61_vibrato
  2076.     move.b    P61_Info(a5),d0
  2077.     beq    P61_fxdone
  2078.     move.b    d0,d1
  2079.     move.b    P61_VibCmd(a5),d2
  2080.     and.b    #$f,d0
  2081.     beq.b    P61_vibskip
  2082.     and.b    #$f0,d2
  2083.     or.b    d0,d2
  2084. P61_vibskip
  2085.     and.b    #$f0,d1
  2086.     beq.b    P61_vibskip2
  2087.     and.b    #$f,d2
  2088.     or.b    d1,d2
  2089. P61_vibskip2
  2090.     move.b    d2,P61_VibCmd(a5)
  2091.     bra    P61_fxdone
  2092.     endc
  2093.  
  2094.     ifne    P61_tre
  2095. P61_settremo
  2096.     move.b    P61_Info(a5),d0
  2097.     beq    P61_fxdone
  2098.     move.b    d0,d1
  2099.     move.b    P61_TreCmd(a5),d2
  2100.     moveq    #$f,d3
  2101.     and.b    d3,d0
  2102.     beq.b    P61_treskip
  2103.     and.b    #$f0,d2
  2104.     or.b    d0,d2
  2105. P61_treskip
  2106.     and.b    #$f0,d1
  2107.     beq.b    P61_treskip2
  2108.     and.b    d3,d2
  2109.     or.b    d1,d2
  2110. P61_treskip2
  2111.     move.b    d2,P61_TreCmd(a5)
  2112.     bra    P61_fxdone
  2113.     endc
  2114.  
  2115.     ifne    P61_ec
  2116. P61_ecommands
  2117.     move.b    P61_Info(a5),d0
  2118.     and.b    #$f0,d0
  2119.     lsr    #3,d0
  2120.     move    P61_etab(pc,d0),d0
  2121.     jmp    P61_etab(pc,d0)
  2122.  
  2123. P61_etab
  2124.     ifne    P61_fi
  2125.     dc    P61_filter-P61_etab
  2126.     else
  2127.     dc    P61_fxdone-P61_etab
  2128.     endc
  2129.  
  2130.     ifne    P61_fsu
  2131.     dc    P61_fineup-P61_etab
  2132.     else
  2133.     dc    P61_fxdone-P61_etab
  2134.     endc
  2135.  
  2136.     ifne    P61_fsd
  2137.     dc    P61_finedwn-P61_etab
  2138.     else
  2139.     dc    P61_fxdone-P61_etab
  2140.     endc
  2141.  
  2142.     dc    P61_fxdone-P61_etab
  2143.     dc    P61_fxdone-P61_etab
  2144.  
  2145.     ifne    P61_sft
  2146.     dc    P61_setfinetune-P61_etab
  2147.     else
  2148.     dc    P61_fxdone-P61_etab
  2149.     endc
  2150.  
  2151.     ifne    P61_pl
  2152.     dc    P61_patternloop-P61_etab
  2153.     else
  2154.     dc    P61_fxdone-P61_etab
  2155.     endc
  2156.  
  2157.     dc    P61_fxdone-P61_etab
  2158.  
  2159.     ifne    P61_timing
  2160.     dc    P61_sete8-P61_etab
  2161.     else
  2162.     dc    P61_fxdone-P61_etab
  2163.     endc
  2164.  
  2165.     ifne    P61_rt
  2166.     dc    P61_setretrig-P61_etab
  2167.     else
  2168.     dc    P61_fxdone-P61_etab
  2169.     endc
  2170.  
  2171.     ifne    P61_fvu
  2172.     dc    P61_finevup-P61_etab
  2173.     else
  2174.     dc    P61_fxdone-P61_etab
  2175.     endc
  2176.  
  2177.     ifne    P61_fvd
  2178.     dc    P61_finevdwn-P61_etab
  2179.     else
  2180.     dc    P61_fxdone-P61_etab
  2181.     endc
  2182.  
  2183.     dc    P61_fxdone-P61_etab
  2184.  
  2185.     ifne    P61_nd
  2186.     dc    P61_ndelay-P61_etab
  2187.     else
  2188.     dc    P61_fxdone-P61_etab
  2189.     endc
  2190.  
  2191.     ifne    P61_pde
  2192.     dc    P61_pattdelay-P61_etab
  2193.     else
  2194.     dc    P61_fxdone-P61_etab
  2195.     endc
  2196.  
  2197.     ifne    P61_il
  2198.     dc    P61_funk-P61_etab
  2199.     else
  2200.     dc    P61_fxdone-P61_etab
  2201.     endc
  2202.     endc
  2203.  
  2204.     ifne    P61_fi
  2205. P61_filter
  2206.     move.b    P61_Info(a5),d0
  2207.     and.b    #$fd,$bfe001
  2208.     or.b    d0,$bfe001
  2209.     bra    P61_fxdone
  2210.     endc
  2211.  
  2212.     ifne    P61_fsu
  2213. P61_fineup
  2214.     P61_getnote
  2215.  
  2216.     moveq    #$f,d0
  2217.     and.b    P61_Info(a5),d0
  2218.     sub    d0,P61_Period(a5)
  2219.     moveq    #113,d0
  2220.     cmp    P61_Period(a5),d0
  2221.     ble.b    .jup
  2222.     move    d0,P61_Period(a5)
  2223. .jup    moveq    #$7e,d0
  2224.     and.b    (a5),d0
  2225.     bne    P61_zample
  2226.     bra    P61_nocha
  2227.     endc
  2228.  
  2229.     ifne    P61_fsd
  2230. P61_finedwn
  2231.     P61_getnote
  2232.  
  2233.     moveq    #$f,d0
  2234.     and.b    P61_Info(a5),d0
  2235.     add    d0,P61_Period(a5)
  2236.     cmp    #856,P61_Period(a5)
  2237.     ble.b    .jup
  2238.     move    #856,P61_Period(a5)
  2239. .jup    moveq    #$7e,d0
  2240.     and.b    (a5),d0
  2241.     bne    P61_zample
  2242.     bra    P61_nocha
  2243.     endc
  2244.  
  2245.     ifne    P61_sft
  2246. P61_setfinetune
  2247.     moveq    #$f,d0
  2248.     and.b    P61_Info(a5),d0
  2249.     ifeq    opt020
  2250.     add    d0,d0
  2251.     move    P61_mulutab(pc,d0),P61_Fine(a5)
  2252.     else
  2253.     move    P61_mulutab(pc,d0*2),P61_Fine(a5)
  2254.     endc
  2255.     bra    P61_fxdone
  2256.  
  2257. P61_mulutab
  2258.     dc    0,74,148,222,296,370,444,518,592,666,740,814,888,962,1036,1110
  2259.     endc
  2260.  
  2261.     ifne    P61_pl
  2262. P61_patternloop
  2263.     moveq    #$f,d0
  2264.     and.b    P61_Info(a5),d0
  2265.     beq.b    P61_setloop
  2266.  
  2267.     tst.b    P61_plflag(a3)
  2268.     bne.b    P61_noset
  2269.  
  2270.     move    d0,P61_plcount(a3)
  2271.     st.b    P61_plflag(a3)
  2272. P61_noset
  2273.     tst    P61_plcount(a3)
  2274.     bne.b    P61_looppaa
  2275.     clr.b    P61_plflag(a3)
  2276.     bra    P61_fxdone
  2277.     
  2278. P61_looppaa
  2279.     st.b    P61_plflag+1(a3)
  2280.     subq    #1,P61_plcount(a3)
  2281.     bra    P61_fxdone
  2282.  
  2283. P61_setloop
  2284.     tst.b    P61_plflag(a3)
  2285.     bne    P61_fxdone
  2286.     move    P61_rowpos(pc),P61_plrowpos(a3)
  2287.     lea    P61_temp0+P61_TData(pc),a1
  2288.     lea    P61_looppos(pc),a0
  2289.     moveq    #channels-1,d0
  2290. .talt    move.l    (a1)+,(a0)+
  2291.     move.l    (a1)+,(a0)+
  2292.     move.l    (a1),(a0)+
  2293.     subq.l    #8,a1
  2294.     add.l    d6,a1
  2295.     dbf    d0,.talt
  2296.     bra    P61_fxdone
  2297.     endc
  2298.  
  2299.     ifne    P61_fvu
  2300. P61_finevup
  2301.     moveq    #$f,d0
  2302.     and.b    P61_Info(a5),d0
  2303.     add    d0,P61_Volume(a5)
  2304.     moveq    #64,d0
  2305.     cmp    P61_Volume(a5),d0
  2306.     bge    P61_fxdone
  2307.     move    d0,P61_Volume(a5)
  2308.     bra    P61_fxdone
  2309.     endc
  2310.  
  2311.     ifne    P61_fvd
  2312. P61_finevdwn
  2313.     moveq    #$f,d0
  2314.     and.b    P61_Info(a5),d0
  2315.     sub    d0,P61_Volume(a5)
  2316.     bpl    P61_fxdone
  2317.     clr    P61_Volume(a5)
  2318.     bra    P61_fxdone
  2319.     endc
  2320.  
  2321.     ifne    P61_timing
  2322. P61_sete8
  2323.     moveq    #$f,d0
  2324.     and.b    P61_Info(a5),d0
  2325.     move    d0,P61_E8(a3)
  2326.     bra    P61_fxdone
  2327.     endc
  2328.  
  2329.     ifne    P61_rt
  2330. P61_setretrig
  2331.     moveq    #$f,d0
  2332.     and.b    P61_Info(a5),d0
  2333.     move    d0,P61_RetrigCount(a5)
  2334.     bra    P61_fxdone
  2335.     endc
  2336.  
  2337.     ifne    P61_nd
  2338. P61_ndelay
  2339.     moveq    #$7e,d0
  2340.     and.b    (a5),d0
  2341.     beq    P61_skip
  2342.     ifne    P61_vib
  2343.     clr.b    P61_VibPos(a5)
  2344.     endc
  2345.     ifne    P61_tre
  2346.     clr.b    P61_TrePos(a5)
  2347.     endc
  2348.     ifne    P61_ft
  2349.     add    P61_Fine(a5),d0
  2350.     endc
  2351.     move    d0,P61_Note(a5)
  2352.     move    (a2,d0),P61_Period(a5)
  2353.     ifeq    fade
  2354.     move    P61_Volume(a5),8(a4)
  2355.     else
  2356.     move    P61_Volume(a5),P61_Shadow(a5)
  2357.     endc
  2358.     bra    P61_skip
  2359.     endc
  2360.  
  2361.     ifne    P61_pde
  2362. P61_pattdelay
  2363.     moveq    #$f,d0
  2364.     and.b    P61_Info(a5),d0
  2365.     move    d0,P61_pdelay(a3)
  2366.     st    P61_pdflag(a3)
  2367.     bra    P61_fxdone
  2368.     endc
  2369.  
  2370.     ifne    P61_sd
  2371. P61_cspeed
  2372.     moveq    #0,d0
  2373.     move.b    P61_Info(a5),d0
  2374.  
  2375.     ifne    CIA
  2376.     tst    P61_Tempo(a3)
  2377.     beq.b    P61_VBlank
  2378.     cmp.b    #32,d0
  2379.     bhs.b    P61_STempo
  2380.     endc
  2381.  
  2382. P61_VBlank
  2383.     cmp.b    #1,d0
  2384.     beq.b    P61_jkd
  2385.  
  2386.     move.b    d0,P61_speed+1(a3)
  2387.     subq.b    #1,d0
  2388.     move.b    d0,P61_speed2+1(a3)
  2389.     clr    P61_speedis1(a3)
  2390.     bra    P61_fxdone
  2391.  
  2392. P61_jkd    move.b    d0,P61_speed+1(a3)
  2393.     move.b    d0,P61_speed2+1(a3)
  2394.     st    P61_speedis1(a3)
  2395.     bra    P61_fxdone
  2396.  
  2397.  
  2398.     ifne    CIA
  2399. P61_STempo
  2400.     move.l    P61_timer(pc),d1
  2401.     divu    d0,d1
  2402.     move    d1,P61_thi2(a3)
  2403.     sub    #$1f0*2,d1
  2404.     move    d1,P61_thi(a3)
  2405.  
  2406.     ifeq    system
  2407.     move    P61_thi2(a3),d1
  2408.     move.b    d1,$bfd400
  2409.     lsr    #8,d1
  2410.     move.b    d1,$bfd500
  2411.     endc
  2412.  
  2413.     bra    P61_fxdone
  2414.     endc
  2415.     endc
  2416.  
  2417.  
  2418.  
  2419.     ifne    P61_vbvs
  2420. P61_vibochvslide
  2421.     move.b    P61_Info(a5),d0
  2422.     sub.b    d0,P61_Volume+1(a5)
  2423.     bpl.b    P61_test62
  2424.     clr    P61_Volume(a5)
  2425.     ifeq    fade
  2426.     clr    8(a4)
  2427.     else
  2428.     clr    P61_Shadow(a5)
  2429.     endc
  2430.     bra.b    P61_vib2
  2431. P61_test62
  2432.     moveq    #64,d0
  2433.     cmp    P61_Volume(a5),d0
  2434.     bge.b    .ncs2
  2435.     move    d0,P61_Volume(a5)
  2436. .ncs2    ifeq    fade
  2437.     move    P61_Volume(a5),8(a4)
  2438.     else
  2439.     move    P61_Volume(a5),P61_Shadow(a5)
  2440.     endc
  2441.     endc
  2442.  
  2443.     ifne    P61_vib
  2444. P61_vib2
  2445.     move    #$f00,d0
  2446.     move    P61_VibCmd(a5),d1
  2447.     and    d1,d0
  2448.     lsr    #3,d0
  2449.  
  2450.     lsr    #2,d1
  2451.     and    #$1f,d1
  2452.     add    d1,d0
  2453.  
  2454.     move    P61_Period(a5),d1
  2455.     moveq    #0,d2
  2456.     move.b    P61_vibtab(pc,d0),d2
  2457.  
  2458.     tst.b    P61_VibPos(a5)
  2459.     bmi.b    .vibneg
  2460.     add    d2,d1
  2461.     bra.b    P61_vib4
  2462.  
  2463. .vibneg    sub    d2,d1
  2464.  
  2465. P61_vib4
  2466.     move    d1,6(a4)
  2467.     move.b    P61_VibCmd(a5),d0
  2468.     lsr.b    #2,d0
  2469.     and    #$3c,d0
  2470.     add.b    d0,P61_VibPos(a5)
  2471.     bra    P61_contfxdone
  2472.     endc
  2473.  
  2474.     ifne    P61_tre
  2475. P61_tremo
  2476.     move    #$f00,d0
  2477.     move    P61_TreCmd(a5),d1
  2478.     and    d1,d0
  2479.     lsr    #3,d0
  2480.     
  2481.     lsr    #2,d1
  2482.     and    #$1f,d1
  2483.     add    d1,d0
  2484.  
  2485.     move    P61_Volume(a5),d1
  2486.     moveq    #0,d2
  2487.     move.b    P61_vibtab(pc,d0),d2
  2488.  
  2489.     tst.b    P61_TrePos(a5)
  2490.     bmi.b    .treneg
  2491.     add    d2,d1
  2492.     cmp    #64,d1
  2493.     ble.b    P61_tre4
  2494.     moveq    #64,d1
  2495.     bra.b    P61_tre4
  2496.  
  2497. .treneg    sub    d2,d1
  2498.     bpl.b    P61_tre4
  2499.     moveq    #0,d1
  2500. P61_tre4
  2501.     ifeq    fade
  2502.     move    d1,8(a4)
  2503.     else
  2504.     move    d1,P61_Shadow(a5)
  2505.     endc
  2506.  
  2507.     move.b    P61_TreCmd(a5),d0
  2508.     lsr.b    #2,d0
  2509.     and    #$3c,d0
  2510.     add.b    d0,P61_TrePos(a5)
  2511.     bra    P61_contfxdone
  2512.     endc
  2513.  
  2514.     ifne    P61_vib!P61_tre
  2515. P61_vibtab:
  2516.  
  2517.  
  2518.     dc.w    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,$101,$101
  2519.     dc.w    $101,$101,$101,$101,$101,$101,$101,$101,$100,0,0
  2520.     dc.w    0,1,$101,$202,$203,$303,$303,$303,$303,$303,$303
  2521.     dc.w    $303,$202,$201,$101,0,0,$101,$202,$303,$404,$405
  2522.     dc.w    $505,$505,$505,$505,$505,$404,$403,$302,$201,$100
  2523.     dc.w    0,$102,$303,$405,$506,$607,$707,$707,$707,$707
  2524.     dc.w    $707,$606,$505,$403,$302,$100,0,$102,$304,$506
  2525.     dc.w    $707,$808,$909,$909,$909,$909,$908,$807,$706,$504
  2526.     dc.w    $302,$100,1,$203,$405,$607,$809,$90A,$B0B,$B0B
  2527.     dc.w    $B0B,$B0B,$B0A,$909,$807,$605,$403,$201,1,$204
  2528.     dc.w    $506,$708,$90A,$B0C,$C0D,$D0D,$D0D,$D0D,$C0C,$B0A
  2529.     dc.w    $908,$706,$504,$201,1,$304,$607,$80A,$B0C,$D0E
  2530.     dc.w    $E0F,$F0F,$F0F,$F0F,$E0E,$D0C,$B0A,$807,$604,$301
  2531.     dc.w    1,$305,$608,$90B,$C0D,$E0F,$1011,$1111,$1111
  2532.     dc.w    $1111,$100F,$E0D,$C0B,$908,$605,$301,1,$305,$709
  2533.     dc.w    $B0C,$E0F,$1011,$1213,$1313,$1313,$1313,$1211
  2534.     dc.w    $100F,$E0C,$B09,$705,$301,2,$406,$80A,$C0D,$F10
  2535.     dc.w    $1213,$1414,$1515,$1515,$1514,$1413,$1210,$F0D
  2536.     dc.w    $C0A,$806,$402,2,$406,$90B,$D0F,$1012,$1315,$1616
  2537.     dc.w    $1717,$1717,$1716,$1615,$1312,$100F,$D0B,$906
  2538.     dc.w    $402,2,$407,$90C,$E10,$1214,$1516,$1718,$1919
  2539.     dc.w    $1919,$1918,$1716,$1514,$1210,$E0C,$907,$402,2
  2540.     dc.w    $508,$A0D,$F11,$1315,$1718,$191A,$1B1B,$1B1B
  2541.     dc.w    $1B1A,$1918,$1715,$1311,$F0D,$A08,$502,2,$508
  2542.     dc.w    $B0E,$1012,$1517,$181A,$1B1C,$1D1D,$1D1D,$1D1C
  2543.     dc.w    $1B1A,$1817,$1512,$100E,$B08,$502
  2544.  
  2545.     endc
  2546.  
  2547.     ifne    P61_il
  2548. P61_funk
  2549.     moveq    #$f,d0
  2550.     and.b    P61_Info(a5),d0
  2551.     move.b    d0,P61_Funkspd(a5)
  2552.     bra    P61_fxdone
  2553.  
  2554. P61_funk2
  2555.     moveq    #0,d0
  2556.     move.b    P61_Funkspd(a5),d0
  2557.     beq.b    P61_funkend
  2558.     move.b    P61_FunkTable(pc,d0),d0
  2559.     add.b    d0,P61_Funkoff(a5)
  2560.     bpl.b    P61_funkend
  2561.     clr.b    P61_Funkoff(a5)
  2562.  
  2563.     move.l    P61_Sample(a5),a1
  2564.     move.l    P61_RepeatOffset(a1),d1
  2565.     move    P61_RepeatLength(a1),d0
  2566.     add.l    d0,d0
  2567.     add.l    d1,d0
  2568.     move.l    P61_Wave(a5),a0
  2569.     addq.l    #1,a0
  2570.     cmp.l    d0,a0
  2571.     blo.b    P61_funkok
  2572.     move.l    d1,a0
  2573. P61_funkok
  2574.     move.l    a0,P61_Wave(a5)
  2575.     not.b    (a0)
  2576. P61_funkend
  2577.     rts
  2578.  
  2579. P61_FunkTable dc.b 0,5,6,7,8,10,11,13,16,19,22,26,32,43,64,128
  2580.     endc
  2581.  
  2582. P61_jtab
  2583.     dr    P61_fxdone
  2584.     dr    P61_fxdone
  2585.     dr    P61_fxdone
  2586.  
  2587.     ifne    P61_tp
  2588.     dr    P61_settoneport
  2589.     else
  2590.     dr    P61_fxdone
  2591.     endc
  2592.  
  2593.     ifne    P61_vib
  2594.     dr    P61_vibrato
  2595.     else
  2596.     dr    P61_fxdone
  2597.     endc
  2598.  
  2599.     ifne    P61_tpvs
  2600.     dr    P61_toponochange
  2601.     else
  2602.     dr    P61_fxdone
  2603.     endc
  2604.  
  2605.     dr    P61_fxdone
  2606.  
  2607.     ifne    P61_tre
  2608.     dr    P61_settremo
  2609.     else
  2610.     dr    P61_fxdone
  2611.     endc
  2612.  
  2613.     dr    P61_fxdone
  2614.  
  2615.     ifne    P61_sof
  2616.     dr    P61_sampleoffse
  2617.     else
  2618.     dr    P61_fxdone
  2619.     endc
  2620.     dr    P61_fxdone
  2621.  
  2622.     ifne    P61_pj
  2623.     dr    P61_posjmp
  2624.     else
  2625.     dr    P61_fxdone
  2626.     endc
  2627.  
  2628.     ifne    P61_vl
  2629.     dr    P61_volum
  2630.     else
  2631.     dr    P61_fxdone
  2632.     endc
  2633.  
  2634.     ifne    P61_pb
  2635.     dr    P61_pattbreak
  2636.     else
  2637.     dr    P61_fxdone
  2638.     endc
  2639.  
  2640.     ifne    P61_ec
  2641.     dr    P61_ecommands
  2642.     else
  2643.     dr    P61_fxdone
  2644.     endc
  2645.     
  2646.     ifne    P61_sd
  2647.     dr    P61_cspeed
  2648.     else
  2649.     dr    P61_fxdone
  2650.     endc
  2651.  
  2652.  
  2653. P61_dmason
  2654.     ifeq    system
  2655.     tst.b    $bfdd00
  2656.     move    #$2000,$dff09c
  2657.     move.b    #$19,$bfdf00
  2658.     move.l    a0,-(sp)
  2659.     move.l    P61_vektori(pc),a0
  2660.     move.l    P61_intaddr(pc),(a0)
  2661.     move.l    (sp)+,a0
  2662.     move    P61_dma(pc),$dff096
  2663.     nop
  2664.     rte
  2665.  
  2666.     else
  2667.  
  2668.     move    P61_dma(pc),$96(a6)
  2669.     lea    P61_server(pc),a3
  2670.     addq    #1,(a3)
  2671.     move.l    P61_craddr(pc),a0
  2672.     move.b    #$19,(a0)
  2673.     bra    P61_ohi
  2674.     endc
  2675.  
  2676.  
  2677. P61_setrepeat
  2678.     ifeq    system
  2679.     tst.b    $bfdd00
  2680.     movem.l    a0/a1,-(sp)
  2681.     lea    $dff0a0,a1
  2682.     move    #$2000,-4(a1)
  2683.     else
  2684.     lea    $a0(a6),a1
  2685.     endc
  2686.  
  2687.     move.l    P61_Sample+P61_temp0(pc),a0
  2688.     addq.l    #6,a0
  2689.     move.l    (a0)+,(a1)+
  2690.     move    (a0),(a1)
  2691.  
  2692.     ifgt    channels-1
  2693.     move.l    P61_Sample+P61_temp1(pc),a0
  2694.     addq.l    #6,a0
  2695.     move.l    (a0)+,12(a1)
  2696.     move    (a0),16(a1)
  2697.     endc
  2698.     
  2699.     ifgt    channels-2
  2700.     move.l    P61_Sample+P61_temp2(pc),a0
  2701.     addq.l    #6,a0
  2702.     move.l    (a0)+,28(a1)
  2703.     move    (a0),32(a1)
  2704.     endc
  2705.  
  2706.     ifgt    channels-3
  2707.     move.l    P61_Sample+P61_temp3(pc),a0
  2708.     addq.l    #6,a0
  2709.     move.l    (a0)+,44(a1)
  2710.     move    (a0),48(a1)
  2711.     endc
  2712.  
  2713.     ifne    system
  2714.     ifne    CIA
  2715.     lea    P61_server(pc),a3
  2716.     clr    (a3)
  2717.     move.l    P61_craddr+4(pc),a0
  2718.     move.b    P61_tlo(pc),(a0)
  2719.     move.b    P61_thi(pc),$100(a0)
  2720.     endc
  2721.     bra    P61_ohi
  2722.     endc
  2723.  
  2724.     ifeq    system
  2725.     ifne    CIA
  2726.     move.l    P61_vektori(pc),a0
  2727.     move.l    P61_tintti(pc),(a0)
  2728.     endc
  2729.     movem.l    (sp)+,a0/a1
  2730.     nop
  2731.     rte
  2732.     endc
  2733.  
  2734. P61_temp0    dcb.b    Channel_Block_SIZE-2
  2735.         dc    1
  2736.  
  2737. P61_temp1    dcb.b    Channel_Block_SIZE-2
  2738.         dc    2
  2739.  
  2740. P61_temp2    dcb.b    Channel_Block_SIZE-2
  2741.         dc    4
  2742.  
  2743. P61_temp3    dcb.b    Channel_Block_SIZE-2
  2744.         dc    8
  2745.  
  2746. P61_cn        dc    0
  2747. P61_dma        dc    $8200
  2748. P61_rowpos    dc    0
  2749. P61_slen    dc    0
  2750. P61_speed    dc    0
  2751. P61_speed2    dc    0
  2752. P61_speedis1    dc    0
  2753. P61_spos    dc.l    0
  2754.  
  2755.     ifeq    system
  2756. P61_vektori    dc.l    0
  2757. P61_oldlev6    dc.l    0
  2758.     endc
  2759.  
  2760. P61_ofilter    dc    0
  2761. P61_Timers    dc.l    0
  2762.  
  2763.     ifne    CIA
  2764. P61_tintti    dc.l    0
  2765. P61_thi        dc.b    0
  2766. P61_tlo        dc.b    0
  2767. P61_thi2    dc.b    0
  2768. P61_tlo2    dc.b    0
  2769. P61_timer    dc.l    0
  2770.     endc
  2771.  
  2772.     ifne    P61_pl
  2773. P61_plcount    dc    0
  2774. P61_plflag    dc    0
  2775. P61_plreset    dc    0
  2776. P61_plrowpos    dc    0
  2777. P61_looppos    dcb.b    12*channels
  2778.     endc
  2779.  
  2780.     ifne    P61_pde
  2781. P61_pdelay    dc    0
  2782. P61_pdflag    dc    0
  2783.     endc
  2784.  
  2785. P61_Samples    dcb.b    16*31
  2786. P61_positionbase dc.l    0
  2787. P61_possibase    dc.l    0
  2788. P61_patternbase    dc.l    0
  2789. P61_intaddr    dc.l    0
  2790.  
  2791.     ifne    system
  2792. P61_server    dc    0
  2793. P61_miscbase    dc.l    0
  2794. P61_audioopen    dc.b    0
  2795. P61_sigbit    dc.b    -1
  2796. P61_ciares    dc.l    0
  2797. P61_craddr    dc.l    0,0,0
  2798. P61_dat        dc    $f00
  2799. P61_timerinterrupt dc    0,0,0,0,127
  2800. P61_timerdata    dc.l    0,0,0
  2801.  
  2802. P61_allocport    dc.l    0,0
  2803.         dc.b    4,0
  2804.         dc.l    0
  2805.         dc.b    0,0
  2806.         dc.l    0
  2807. P61_reqlist    dc.l    0,0,0
  2808.         dc.b    5,0
  2809. P61_allocreq    dc.l    0,0
  2810.         dc    127
  2811.         dc.l    0
  2812. P61_portti    dc.l    0
  2813.         dc    68
  2814.         dc.l    0,0,0
  2815.         dc    0
  2816. P61_reqdata    dc.l    0
  2817.         dc.l    1,0,0,0,0,0,0
  2818.         dc    0
  2819. P61_audiodev    dc.b    'audio.device',0
  2820.  
  2821. P61_cianame    dc.b    'ciab.resource',0
  2822. P61_timeropen    dc.b    0
  2823. P61_timerint    dc.b    'P61_TimerInterrupt',0,0
  2824.     endc
  2825. P61_etu
  2826.  
  2827.