home *** CD-ROM | disk | FTP | other *** search
/ YPA: Your Privacy Assured / YPA.ISO / other_goodies / music / ep154b_1.dms / ep154b_1.adf / EagleplayerDeveloper / Examples / NoisePackerII.s < prev    next >
Text File  |  1995-01-17  |  18KB  |  796 lines

  1.     **************************************************************
  2.     ** EaglePlayer/DelitrackerV1.3+ Noisepackerplayroutine      **
  3.     ** Eagleplayer Adaption by Buggs & Eagleeye of Defect       **
  4.     **************************************************************
  5.  
  6.         incdir    Include:
  7.         include "misc/EaglePlayer.i"
  8.  
  9.     PLAYERHEADER    Tags
  10.  
  11.     dc.b '$VER: NoisePacker V2.02 Eagleplayer V1.3 (July/21/93)',0,0
  12.         even
  13.  
  14. Tags:        dc.l    DTP_PlayerVersion,3
  15.         dc.l    DTP_PlayerName,NP_Player
  16.         dc.l    DTP_Creator,NP_Name
  17.         dc.l    DTP_Check2,NP_Check
  18.         dc.l    DTP_Interrupt,NP_Music
  19.         dc.l    DTP_InitPlayer,NP_InitPlay
  20.         dc.l    DTP_EndPlayer,NP_EndPlay
  21.         dc.l    DTP_InitSound,NP_Init
  22.         dc.l    DTP_EndSound,NP_RemSnd
  23.         dc.l    DTP_NextPatt,NP_NextPattern
  24.         dc.l    DTP_PrevPatt,NP_PrevPattern
  25.         dc.l    DTP_Volume,SetVol
  26.         dc.l    DTP_Balance,SetVol
  27.         dc.l    EP_Voices,SetVoices
  28.         dc.l    EP_Get_ModuleInfo,NP_GetInfos
  29.         dc.l    EP_GetPositionNr,NP_GetPosNr
  30.         dc.l    EP_StructInit,StrukInit
  31.         dc.l    EP_Flags,EPB_Save!EPB_Restart!EPB_Songend!EPB_Volume!EPB_Balance!EPB_Voices!EPB_Analyzer!EPB_Moduleinfo!EPB_Nextpatt!EPB_Prevpatt
  32.         dc.l    0
  33.  
  34. *------------------------------------------------------------------------*
  35. NP_Structadr:    ds.b    UPS_sizeof
  36. NP_Data:    dc.l    0    
  37. NP_RightVol    dc.w    0
  38. NP_LeftVol    dc.w    0
  39. NP_SndVol    dc.w    0
  40.  
  41. NP_Voice1    dc.w    1
  42. NP_Voice2    dc.w    1
  43. NP_Voice3    dc.w    1
  44. NP_Voice4    dc.w    1
  45. NP_OldVoice1    dc.w    0
  46. NP_OldVoice2    dc.w    0
  47. NP_OldVoice3    dc.w    0
  48. NP_OldVoice4    dc.w    0
  49. NP_SongEndAdr:    dc.l    0
  50.  
  51. *-----------------------------------------------------------------------*
  52. NP_Name:    dc.b    "Twins of Phenomena,",10
  53.         dc.b    "adapted by DEFECT",0
  54. NP_Player:    dc.b    "NoisePacker 2.x",0
  55.         even
  56. *------------------- Tag-Item Struktur fⁿr Module-Info -----------------*
  57. NP_InfoBuffer:    dc.l    MI_Samples,0            ;4
  58.         dc.l    MI_Length,0            ;12
  59.         dc.l    MI_Pattern,0            ;20
  60.         dc.l    MI_SongSize,0            ;28
  61.         dc.l    MI_SamplesSize,0        ;36
  62.         dc.l    MI_Calcsize,0            ;44
  63.         dc.l    MI_Unpacked,0            ;52
  64.         dc.l    MI_Unpackedsystem,MIUS_Noisetracker
  65.         dc.l    0
  66.  
  67. *----------------- Get Infos (Create InfoTag-Itemliste) ----------------*
  68. NP_GetInfos:    move.l    NP_data(pc),a0
  69.         lea    NP_InfoBuffer(pc),a4
  70.         moveq    #16,d3    
  71.         moveq    #0,d0
  72.         moveq    #0,d2
  73.         move.l    a0,a1
  74.         move.w    (a0)+,d0
  75.         move.l    d0,d6
  76.         move.w    (a0)+,d2
  77.         add.l    d2,d6
  78.         add.w    (a0)+,d6
  79.         add.w    (a0)+,d6
  80.         move.l    d6,28(a4)            ;SongSize
  81.         move.l    d6,44(a4)            ;CalcSize
  82.  
  83.         moveq    #0,d6
  84.         add.l    d0,a1                ;Patternliste
  85.         lsr.w    #4,d0
  86.         move.l    d0,d1
  87.         move.l    d1,4(a4)            ;SamplesAnz
  88.         subq.l    #1,d1
  89.         addq.l    #4,a0                ;Adr auf Sampleliste
  90. .SucheSample    move.w    (a0),d0
  91.         add.l    d0,d0
  92.         add.l    d0,d6
  93.         add.l    d3,a0
  94.         dbf    d1,.SucheSample
  95.         lsr.w    #1,d2
  96.         move.l    d2,12(a4)            ;Length setzen
  97.  
  98.         move.l    d6,36(a4)            ;Samplessize
  99.         move.l    d6,52(a4)            ;Unpacked
  100.         add.l    d6,44(a4)            ;CalcSize
  101.  
  102.         subq.l    #1,d2
  103.         moveq    #0,d0
  104. .NextPattern:    cmp.w    (a1),d0
  105.         bge.s    .AddAdr
  106.         move.w    (a1),d0
  107. .AddAdr:    addq.l    #2,a1
  108.         dbf    d2,.NextPattern
  109.         lsr.w    #3,d0
  110.         addq.l    #1,d0
  111.         move.l    d0,20(a4)            ;Pattern
  112.         mulu    #1024,d0
  113.         add.l    #$43c,d0
  114.         add.l    d0,52(a4)
  115.  
  116.         move.l    a4,a0
  117. NP_Return:    rts
  118.  
  119. *------------------------ Test auf Noisepacker II ---------------------------*
  120. NP_Check:    move.l    dtg_ChkData(a5),a0
  121.         moveq    #-1,d0
  122.         move.l    a0,a1
  123.  
  124.         move.w    (a0),d5        ;Anzahl der Samples
  125.         move.w    d5,d1        ;merken
  126.         and.w    #$f,d5        ;jedes NP Modul beginnt mit
  127.                     ;(Anzahl der Samples*16) OR 12
  128.         cmp.w    #$c,d5        ;ist die 12 vorhanden ?
  129.         bne    .NP_Fail    ;n÷
  130.         lsr.w    #4,d1        ;$c rausrotieren
  131.         cmp.w    #$1f,d1        ;Anzahl der Samples > 32 (0..31)
  132.         bhi    .NP_Fail    ;ja,Fehler
  133.  
  134.         move.w    4(a0),d2    ;Offset Patterns
  135.         btst    #0,d2        ;Ungerade ?
  136.         bne    .np_fail    ;->Fehler
  137.         add.w    (a0),a1        ;auf Pointer addieren
  138.         move.w    -4(a1),d5    ;H÷chste Patternnummer ist 2 mal eingetragen
  139.         btst    #0,d5        ;Ungerade ?
  140.         bne    .np_fail    ;->Fehler
  141.         cmp.w    2(a0),d5    ;Vergleich
  142.         bne    .NP_fail    ;Unstimmigkeit,Ende der Vorstellung
  143.  
  144.         move.l    a0,a1        ;Pointer auf Modul saven
  145.         add.w    (a1),a0        ;Liste der Patterns fⁿr jeweilige Songposition
  146.         move.w    -4(a0),d1    ;LΣnge des Songs
  147.         asr.w    #1,d1        ;durch 2 dividieren
  148.         subq.w    #1,d1
  149.                     ;in A0 Zeiger auf Tabelle fⁿr die
  150.                     ;Zeiger auf die Patternnummer fⁿr die
  151.                     ;jeweilige Songposition
  152.  
  153.         moveq    #0,d5
  154.         move.w    d1,d4        ;brauchen wir noch
  155. .check2:    move.w    (a0)+,d3    ;Patternnummer
  156.         cmp.w    d5,d3        ;mit derzeit h÷chster vergleichen
  157.         bls.s    .check1        ;kleiner -> weiter
  158.         move.w    d3,d5        ;h÷chste Patternnr. merken
  159. .check1        dbf    d1,.check2    ;alle Patterns
  160.         addq.l    #8,d5        ;+8
  161.         cmp.w    d5,d2        ;Gegenvergleich
  162.         bne    .np_fail    ;passt nicht -> Fehler
  163.         and.w    #7,d5        ;ausmaskieren (Patternnummer mu▀ durch 8 
  164.                     ;teilbar sein)
  165.         bne    .np_fail    ;nein->Fehler
  166.  
  167.             ;A0 mu▀ hier auf dem Anfang der Offsettabelle der
  168.             ;Patterns stehen
  169.  
  170.         moveq    #0,d5        ;d5 killen
  171.         move.w    (a1),d5        ;Pointer auf Patternliste
  172.         add.w    2(a1),a1    ;LΣnge dieser Patternliste
  173.         add.l    d5,a1        ;zusammenaddieren = Pointer auf Patternoffsets
  174.  
  175.         cmp.l    a0,a1        ;stimmt das ?
  176.         bne    .np_fail    ;wieso auch ?
  177.  
  178.             ;an dieser Stelle kann als gesichert gelten,da▀
  179.             ;es sich um ein Noisepackermodul handelt,es bleibt
  180.             ;nur die Unterscheidung zum Noisepacker 3
  181.  
  182.         move.w    #$c0,d1        ;die Patternoffsets bei NP2.02 
  183.                 ;sind Vielfache von 192
  184. .Untersch:    moveq    #0,d5        ;d5 l÷schen
  185.         move.w    (a1)+,d5    ;Offset holen
  186.         divu    d1,d5        ;durch 192 dividieren
  187.         clr.w    d5        ;Ergebnis l÷schen (unteres Wort)
  188.         tst.l    d5        ;Rest (oberes Wort) = 0 ,d.h. Offset durch 192
  189.                     ;teilbar
  190.         bne.s    .np_fail    ;nein,ertappt
  191.         dbf    d4,.Untersch    ;alle testen
  192. .NP_ok:        moveq    #0,d0        ;alles klar
  193. .NP_Fail:    tst.l    d0
  194.         rts
  195.  
  196.  
  197. *-----------------------------------------------------------------------*
  198. NP_InitPlay:    lea    NP_OldVoice1(pc),a0    ;Voices 0 setzen=alle an
  199.         clr.l    (a0)+            ; Old Voice l÷schen
  200.         clr.l    (a0)+
  201.  
  202.         moveq    #0,d0
  203.         move.l    dtg_GetListData(a5),a0    ; Function
  204.         jsr    (a0)
  205.         lea    NP_Data(pc),a1
  206.         move.l    a0,(a1)
  207.         move.l    DTG_SongEnd(a5),NP_SongEndAdr-NP_Data(a1)
  208.         move.l    dtg_AudioAlloc(a5),a0    ; Function
  209.         jmp    (a0)            ; returncode is already set !
  210.  
  211. *-----------------------------------------------------------------------*
  212. NP_EndPlay:    move.l    dtg_AudioFree(a5),a0        ; Function
  213.         jmp    (a0)
  214.  
  215.  
  216. *-----------------------------------------------------------------------*
  217. NP_RemSnd:    lea    $dff000,a0
  218.         moveq    #0,d0
  219.         move.w    d0,$a8(a0)
  220.         move.w    d0,$b8(a0)
  221.         move.w    d0,$c8(a0)
  222.         move.w    d0,$d8(a0)
  223.         move.w    #$F,$96(a0)            ; End Sound
  224.         rts
  225.  
  226. *------------------------- Struktur ⁿbergeben ---------------------------*
  227. Strukinit:    lea    NP_StructAdr(pc),a0
  228.         rts
  229.  
  230. *----------------- Daten in die Userprogramm-Struktur ⁿbergeben ---------*
  231. NP_Getvoice:    movem.l    d0-d1/a1,-(sp)
  232.         lea    NP_Structadr(pc),a1    ;1.Kanal
  233.         cmp.l    #$dff0a0,a4
  234.         beq.s    .yes
  235.         lea    NP_Structadr+ups_modulo(pc),a1    ;2.Kanal
  236.         cmp.l    #$dff0b0,a4
  237.         beq.s    .yes
  238.         lea    NP_Structadr+ups_modulo*2(pc),a1    ;3.Kanal
  239.         cmp.l    #$dff0c0,a4
  240.         beq.s    .yes
  241.         lea    NP_Structadr+ups_modulo*3(pc),a1    ;4.Kanal
  242. .yes:        move.w    24(a2),UPS_Voice1Per(a1)    ;Sampleperiode
  243.         move.l    (a3),UPS_Voice1Adr(a1)        ;Sampleadresse
  244.         moveq    #0,d1
  245.         cmp.w    #1,12(a3)    ;Repeat on ?
  246.         bne.s    .ok
  247.         moveq    #1,d1        ;nein,Repeat "off" setzen
  248. .ok        move.w    d1,UPS_Voice1Repeat(a1)
  249.         move.w    4(a3),UPS_Voice1len(a1)    ;LΣnge
  250.         movem.l    (sp)+,d0-d1/a1
  251.         rts
  252.  
  253. *-----------------------------------------------------------------------*
  254. *        d0 Bit 0-3 = Set Voices Bit=1 Voice on            *
  255. SetVoices:    lea    NP_Voice1(pc),a0
  256.         lea    NP_StructAdr(pc),a1
  257.         moveq    #1,d1
  258.         move.w    d1,(a0)+            Voice1=0 setzen
  259.         btst    #0,d0
  260.         bne.s    .NoVoice1
  261.         clr.w    -2(a0)
  262.         clr.w    $dff0a8
  263.         clr.w    UPS_Voice1Vol(a1)
  264. .NoVoice1:    move.w    d1,(a0)+            Voice2=0 setzen
  265.         btst    #1,d0
  266.         bne.s    .NoVoice2
  267.         clr.w    -2(a0)
  268.         clr.w    $dff0b8
  269.         clr.w    UPS_Voice2Vol(a1)
  270. .NoVoice2:    move.w    d1,(a0)+            Voice3=0 setzen
  271.         btst    #2,d0
  272.         bne.s    .NoVoice3
  273.         clr.w    -2(a0)
  274.         clr.w    $dff0c8
  275.         clr.w    UPS_Voice3Vol(a1)
  276. .NoVoice3:    move.w    d1,(a0)+            Voice4=0 setzen
  277.         btst    #3,d0
  278.         bne.s    .NoVoice4
  279.         clr.w    -2(a0)
  280.         clr.w    $dff0d8
  281.         clr.w    UPS_Voice4Vol(a1)
  282. .NoVoice4:    move.w    d0,UPS_DMACON(a1)
  283.         moveq    #0,d0
  284.         rts
  285.  
  286. *-----------------------------------------------------------------------*
  287. SetVol:        move.w    DTG_SndLBal(a5),d0
  288.         mulu    DTG_SndVol(a5),d0
  289.         lsr.w    #6,d0                ; durch 64
  290.         move.w    d0,NP_LeftVol            ; Left Volume
  291.  
  292.         move.w    DTG_SndRBal(a5),d0
  293.         mulu    DTG_SndVol(a5),d0
  294.         lsr.w    #6,d0                ; durch 64
  295.         move.w    d0,NP_RightVol            ; Right Volume
  296.  
  297.  
  298.         lea    NP_OldVoice1(pc),a0
  299.         lea    $dff0a0,a5
  300.         moveq    #3,d1
  301. .SetNew        move.w    (a0)+,d0
  302.         bsr.s    NP_SetVoices
  303.         addq.l    #8,a5
  304.         addq.l    #8,a5
  305.         dbf    d1,.SetNew
  306.         rts
  307.  
  308. *-----------------------------------------------------------------------*
  309. NP_SetVolume:    movem.l    d0/a5,-(a7)
  310.         move.w    4(a2),d0
  311.         bra.s    NP_SetVolume3
  312. NP_SetVolume2:    movem.l    d0/a5,-(a7)
  313.         move.w    4(a0),d0
  314. NP_SetVolume3:    move.l    a4,a5
  315.         bsr.s    NP_SetVoices
  316.         movem.l    (a7)+,d0/a5
  317.         rts
  318.  
  319. *-----------------------------------------------------------------------*
  320. NP_SetVoices:    and.w    #$7f,d0
  321.         cmp.l    #$dff0a0,a5            ;Left Volume
  322.         bne.s    .NoVoice1
  323.         move.w    d0,NP_OldVoice1
  324.         tst.w    NP_Voice1
  325.         bne.s    .Voice1On
  326.         moveq    #0,d0
  327. .Voice1On:    move.w    d0,NP_StructAdr+UPS_Voice1Vol
  328.         mulu.w    NP_LeftVol(pc),d0
  329.         lsr.w    #6,d0
  330.         move.w    d0,8(a5)
  331.         rts
  332. .NoVoice1:    cmp.l    #$dff0b0,a5            ;Right Volume
  333.         bne.s    .NoVoice2
  334.         move.w    d0,NP_OldVoice2
  335.         tst.w    NP_Voice2
  336.         bne.s    .Voice2On
  337.         moveq    #0,d0
  338. .Voice2On:    move.w    d0,NP_StructAdr+UPS_Voice2Vol
  339.         mulu.w    NP_RightVol(pc),d0
  340.         lsr.w    #6,d0
  341.         move.w    d0,8(a5)
  342.         rts
  343. .NoVoice2:    cmp.l    #$dff0c0,a5            ;Right Volume
  344.         bne.s    .NoVoice3
  345.         move.w    d0,NP_OldVoice3
  346.         tst.w    NP_Voice3
  347.         bne.w    .Voice3On
  348.         moveq    #0,d0
  349. .Voice3On:    move.w    d0,NP_StructAdr+UPS_Voice3Vol
  350.         mulu.w    NP_RightVol(pc),d0
  351.         lsr.w    #6,d0
  352.         move.w    d0,8(a5)
  353.         rts
  354. .NoVoice3:    move.w    d0,NP_OldVoice4
  355.         tst.w    NP_Voice4
  356.         bne.w    .Voice4On
  357.         moveq    #0,d0
  358. .Voice4On:    move.w    d0,NP_StructAdr+UPS_Voice4Vol
  359.         mulu.w    NP_LeftVol(pc),d0
  360.         lsr.w    #6,d0
  361.         move.w    d0,8(a5)
  362. .Return:    rts
  363.  
  364. *-----------------------------------------------------------------------*
  365. NP_NextPattern:    lea    np_block(pc),a6
  366.         move.l    np_position(pc),a0
  367.         addq    #2,6(a6)
  368.         move    6(a6),d0
  369.         cmp    -4(a0),d0
  370.         bne.s    .next
  371.         move    -2(a0),6(a6)    ;End
  372.         move.l    NP_SongendAdr(pc),a0
  373.         jsr    (a0)
  374. .next        clr.w    8(a6)        ;PattPos l÷schen
  375.         move.w    6(a6),d0
  376.         asr.w    #1,d0
  377.         rts
  378.  
  379. *-----------------------------------------------------------------------*
  380. NP_PrevPattern:    lea    np_block(pc),a6
  381.         move.l    np_position(pc),a0
  382.         move.w    6(a6),d0
  383.         subq.w    #2,d0
  384.         bgt.s    .no
  385.         move.w    -4(a0),d0
  386.         subq.w    #2,d0
  387. .no:        move.w    d0,6(a6)
  388.         move.w    #0,8(A6)    
  389.         asr.w    #1,d0
  390.         rts
  391.  
  392. *-----------------------------------------------------------------------*
  393. NP_GetPosNr:    move.w    np_block+6(pc),d0
  394.         asr.w    #1,d0
  395.         rts
  396.  
  397.  
  398. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  399. * NoisePacker V2.02 PlayRoutine ⌐1990 Twins of Phenomena. *
  400. * Used registers are d0-d7/a0-a6.     Not using lev6irq.  *
  401. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  402. np_init:    move.l    NP_data(pc),a0
  403.         move.l    a0,a4
  404.         lea    $dff000,a5
  405.         lea    np_position(pc),a6
  406.         moveq    #2,d0
  407.         moveq    #0,d1
  408.         move.l    a4,a3
  409. np_init1:    add    (a4)+,a3
  410.         move.l    a3,(a6)+
  411.         dbf    d0,np_init1
  412.         move    (a4)+,d0
  413.         add.l    d0,a3
  414.  
  415.         move.l    #$01060100,(a6)+
  416.         move    #$8200,(a6)+
  417.         move.l    d1,(a6)+
  418.         move.l    #np_portup,(a6)+
  419.         move.l    #np_portdown,(a6)+
  420.         move.l    #np_port,(a6)+
  421.         move.l    #np_vib,(a6)+
  422.         move.l    #np_port2,(a6)+
  423.         move.l    #np_vib2,(a6)+
  424.         move.l    #np_volslide,(a6)+
  425.         move.l    #np_arp,(a6)+
  426.         move.l    #np_songjmp,(a6)+
  427.         move.l    #np_setvol,(a6)+
  428.         move.l    #np_pattbreak,(a6)+
  429.         move.l    #np_filter,(a6)+
  430.         move.l    #np_setspeed,(a6)+
  431.  
  432.         moveq    #0,d0
  433.         move.l    a4,a6
  434.         add    -8(a4),a6
  435.         sub    #12,a6
  436. np_init2:    move.l    a3,(a4)
  437.         move.l    a3,a2
  438.         move    14(a4),d0
  439.         add    d0,d0
  440.         add.l    d0,a2
  441.         move.l    a2,8(a4)
  442.         move    4(a4),d0
  443.         add    d0,d0
  444.         add.l    d0,a3
  445.         add    #16,a4
  446.         cmp.l    a4,a6
  447.         bne.s    np_init2
  448.         rts
  449.  
  450. *--------------------------------------------------------------------------*
  451. NP_Music:    movem.l    d1-a6,-(a7)
  452.         lea    NP_StructAdr(pc),a0
  453.         move.w    #UPSB_Adr!UPSB_LEN!UPSB_Per!UPSB_Vol!UPSB_DMACON,UPS_Flags(a0)
  454.         clr.w    UPS_Voice1per(a0)
  455.         clr.w    UPS_Voice2per(a0)
  456.         clr.w    UPS_Voice3per(a0)
  457.         clr.w    UPS_Voice4per(a0)
  458.         move.w    #1,UPS_Enabled(A0)
  459.  
  460.         bsr.s    NP_Music2
  461.         lea    NP_StructAdr(pc),a0
  462.         clr.w    UPS_Enabled(A0)
  463.         movem.l    (a7)+,d1-a6
  464.         moveq    #0,d0
  465.         rts
  466.         
  467. NP_Music2:    moveq    #0,d6
  468.         lea    $dff000,a5
  469.         lea    $d0(a5),a4
  470.         lea    np_block(pc),a6
  471.         subq.b    #1,(a6)            ;SpeedCounter
  472.         bhi.w    np_nonew
  473.  
  474.         lea    np_position(pc),a3
  475.         move.l    (a3)+,a0        ;Position Adresse
  476.         add    6(a6),a0
  477.         move    (a0),d0            ;Patternnummer
  478.         move.l    (a3)+,a0        ;Pattern Adresse
  479.         add    d0,a0
  480.         move.l    (a3)+,a1        ;Voice Adresse
  481.         add    8(a6),a1
  482.         lea    np_voidat1(pc),a2
  483.  
  484.         moveq    #8,d0
  485.         moveq    #0,d5
  486. np_loop1:    moveq    #0,d1
  487.         move    (a0)+,d1
  488.         lea    (a1,d1.l),a3
  489.         move.b    (a3)+,d1
  490.         move.b    (a3)+,d3
  491.         move.b    (a3)+,d4
  492.  
  493.         move.b    d3,d7
  494.         lsr.b    #4,d7
  495.         move.b    d1,d2
  496.         and    #1,d2
  497.         beq.s    np_loop2
  498.         moveq    #$10,d2
  499. np_loop2:    move.l    NP_data(pc),a3        ;hier aufpassen
  500.         subq.l    #8,a3
  501.         or.b    d7,d2
  502.         bne.s    np_loop3
  503.  
  504.         move.b    1(a2),d2
  505.         lsl    #4,d2
  506.         add    d2,a3
  507.         bra.s    np_loop4
  508.  
  509. np_loop3:    move.b    d2,1(a2)
  510.         lsl    #4,d2
  511.         add    d2,a3
  512.         move    6(a3),4(a2)
  513. np_loop4:    and    #$f,d3
  514.         move.b    d3,2(a2)
  515.         move.b    d4,3(a2)
  516.  
  517.         and    #$fe,d1
  518.         beq.s    np_loop5
  519.  
  520.         move    np_periods-2(pc,d1.w),d7
  521.  
  522.         subq    #3,d3
  523.         beq.w    np_setport
  524.         subq    #2,d3
  525.         beq.w    np_setport
  526.  
  527.         or    d0,d5
  528.         move.b    d1,(a2)
  529.         move.b    d6,49(a2)
  530.         move    d7,24(a2)    ;
  531.     bsr    np_getvoice
  532.         move.l    (a3)+,(a4)    ;Adresse           (a3)
  533.         move    (a3)+,4(a4)    ;LΣnge/2=Anzahl der Worte 4(a3)
  534.         addq.l    #2,a3        ;LautstΣrke          6(a3)
  535.         move.l    (a3)+,72(a2)    ;Repeatadresse          8(a3)
  536.         move    (a3)+,76(a2)    ;RepeatlΣnge/2         12(a3)
  537.  
  538.         subq    #6,d3
  539.         bmi.s    np_loop6
  540.         add    d3,d3
  541.         add    d3,d3
  542.         move.l    42(a6,d3.w),a3
  543.         jmp    (a3)
  544.  
  545. np_loop5:    sub    #11,d3
  546.         bmi.s    np_loop6
  547.         add    d3,d3
  548.         add    d3,d3
  549.         move.l    42(a6,d3.w),a3
  550.         jmp    (a3)
  551.  
  552. np_periods:    dc.w    $0358,$0328,$02fa,$02d0,$02a6,$0280,$025c,$023a,$021a
  553.         dc.w    $01fc,$01e0,$01c5,$01ac,$0194,$017d,$0168,$0153,$0140
  554.         dc.w    $012e,$011d,$010d,$00fe,$00f0,$00e2,$00d6,$00ca,$00be
  555.         dc.w    $00b4,$00aa,$00a0,$0097,$008f,$0087,$007f,$0078,$0071
  556.  
  557. np_loop6:    move    24(a2),6(a4)            ;Sampleperiode
  558.  
  559. np_loop7:    bsr.w    NP_SetVolume
  560.  
  561.     ;    move    4(a2),8(a4)            ;Vol 1
  562.  
  563.         addq    #6,a2
  564.         sub    #$10,a4
  565.         lsr    #1,d0
  566.         bne.w    np_loop1
  567.  
  568.         move    d5,$96(a5)
  569.         move.b    d5,5(a6)
  570.         move.b    1(a6),(a6)
  571.  
  572.     bsr    NP_Waitdma
  573.  
  574. ;        move    #270,d0        ;hΣtte auf Turbokarten keinen Sinn !
  575. ;np_wait1:    dbf    d0,np_wait1
  576.  
  577.         move    4(a6),$96(a5)
  578.  
  579.     bsr    NP_Waitdma
  580.  
  581. ;        moveq    #80,d0        ;Turbokarten und sogar 68010-er
  582. ;np_wait2:    dbf    d0,np_wait2    ;Prozessoren versagen hier;
  583.                     ;typischer A500 Code
  584.                     ;aber ich hab ja selber einen :-)
  585.  
  586.         move.l    np_position(pc),a0
  587.         bset    #0,2(a6)
  588.         beq.w    np_break
  589.         addq    #3,8(a6)
  590.         cmp    #192,8(a6)
  591.         bne.s    np_next
  592. np_break:    move    d6,8(a6)
  593.         addq    #2,6(a6)
  594.         move    6(a6),d0
  595.         cmp    -4(a0),d0
  596.         bne.s    np_next
  597.         move    -2(a0),6(a6)
  598.  
  599.         move.l    NP_SongEndAdr(pc),a0
  600.         jsr    (a0)
  601.  
  602. np_next:    lea    np_voidat2(pc),a0
  603.         move.l    (a0)+,$d0(a5)
  604.         move    (a0)+,$d4(a5)
  605.         move.l    (a0)+,$c0(a5)
  606.         move    (a0)+,$c4(a5)
  607.         move.l    (a0)+,$b0(a5)
  608.         move    (a0)+,$b4(a5)
  609.         move.l    (a0)+,$a0(a5)
  610.         move    (a0)+,$a4(a5)
  611.         rts
  612.  
  613. np_setvol:    move.b    d4,5(a2)
  614.         bra.w    np_loop6
  615.  
  616. np_pattbreak:    move    d6,2(a6)
  617.         bra.w    np_loop6
  618.  
  619. np_songjmp:    move    d6,2(a6)
  620.         move.b    d4,7(a6)
  621.         bra.w    np_loop6
  622.  
  623. np_setspeed:    move.b    d4,1(a6)
  624.         bra.w    np_loop6
  625.  
  626. np_filter:
  627. ;        and.b    #$fd,$bfe001
  628. ;        or.b    d4,$bfe001
  629.         bra.w    np_loop6
  630.  
  631. np_setport:    move.b    d6,50(a2)
  632.         move    d7,26(a2)
  633.         cmp    24(a2),d7
  634.         beq.s    np_clrport
  635.         bge.w    np_loop7
  636.         move.b    #1,50(a2)
  637.         bra.w    np_loop7
  638.  
  639. np_clrport:    move    d6,26(a2)
  640.         bra.w    np_loop7
  641.  
  642. np_nonew:    lea    np_voidat1(pc),a0
  643.         moveq    #3,d0
  644. np_lop1:    moveq    #0,d1
  645.         move.b    2(a0),d1
  646.         beq.s    np_lop2
  647.         subq    #8,d1
  648.         bhi.s    np_lop2
  649.         addq    #7,d1
  650.         add    d1,d1
  651.         add    d1,d1
  652.         move.l    10(a6,d1.w),a3
  653.         jmp    (a3)
  654. np_lop2:    addq    #6,a0
  655.         sub    #$10,a4
  656.         dbf    d0,np_lop1
  657.         rts
  658.  
  659. np_portup:    moveq    #0,d2
  660.         move.b    3(a0),d2
  661.         sub    d2,24(a0)
  662.         cmp    #$71,24(a0)
  663.         bpl.s    np_portup2
  664.         move    #$71,24(a0)
  665. np_portup2:    move    24(a0),6(a4)
  666.         bra.s    np_lop2
  667.  
  668. np_portdown:    moveq    #0,d2
  669.         move.b    3(a0),d2
  670.         add    d2,24(a0)
  671.         cmp    #$358,24(a0)
  672.         bmi.s    np_portdown2
  673.         move    #$358,24(a0)
  674. np_portdown2:    move    24(a0),6(a4)
  675.         bra.s    np_lop2
  676.  
  677. np_arp:        moveq    #0,d2
  678.         move.b    (a6),d2
  679.         sub.b    1(a6),d2
  680.         neg.b    d2
  681.         move.b    np_arplist(pc,d2.w),d2
  682.         beq.s    np_arp0
  683.         subq.b    #2,d2
  684.         beq.s    np_arp2
  685. np_arp1:    move.b    3(a0),d2
  686.         lsr    #3,d2
  687.         and    #$e,d2
  688.         bra.s    np_arp3
  689.  
  690. np_arp2:    move.b    3(a0),d2
  691.         and    #$f,d2
  692.         add    d2,d2
  693. np_arp3:    add.b    (a0),d2
  694.         cmp    #$48,d2
  695.         bls.s    np_arp4
  696.         moveq    #$48,d2
  697. np_arp4:    lea    np_periods-2(pc),a3
  698.         move    (a3,d2.w),6(a4)
  699.         bra.w    np_lop2
  700. np_arp0:    move    24(a0),6(a4)
  701.         bra.w    np_lop2
  702.  
  703. np_arplist: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
  704.  
  705. np_sin:    dc.b $00,$18,$31,$4a,$61,$78,$8d,$a1,$b4,$c5,$d4,$e0,$eb,$f4,$fa,$fd
  706.     dc.b $ff,$fd,$fa,$f4,$eb,$e0,$d4,$c5,$b4,$a1,$8d,$78,$61,$4a,$31,$18
  707.  
  708. np_vib:        move.b    3(a0),d3
  709.         beq.s    np_vib2
  710.         move.b    d3,48(a0)
  711. np_vib2:    move.b    49(a0),d3
  712.         lsr.b    #2,d3
  713.         and    #$1f,d3
  714.         moveq    #0,d2
  715.         move.b    np_sin(pc,d3.w),d2
  716.         move.b    48(a0),d3
  717.         and    #$f,d3
  718.         mulu    d3,d2
  719.         lsr    #7,d2
  720.         move    24(a0),d3
  721.         tst.b    49(a0)
  722.         bmi.s    np_vibsub
  723.         add    d2,d3
  724.         bra.s    np_vib3
  725. np_vibsub:    sub    d2,d3
  726. np_vib3:    move    d3,6(a4)
  727.         move.b    48(a0),d3
  728.         lsr.b    #2,d3
  729.         and    #$3c,d3
  730.         add.b    d3,49(a0)
  731.         cmp.b    #20,d1
  732.         bne.w    np_lop2
  733.  
  734. np_volslide:    move.b    3(a0),d2
  735.         add.b    d2,5(a0)
  736.         bmi.s    np_vol3
  737.         cmp.b    #$40,5(a0)
  738.         bmi.s    np_vol2
  739.         move    #$40,4(a0)
  740. np_vol2:    bsr.w    NP_SetVolume2
  741.     ;    move    4(a0),8(a4)            ;Vol2
  742.         bra.w    np_lop2
  743.  
  744. np_vol3:    move    d6,4(a0)
  745.         bsr.w    NP_SetVolume2
  746.     ;    move    4(a0),8(a4)            ;Vol3
  747.         bra.w    np_lop2
  748.  
  749. np_port:    move.b    3(a0),d2
  750.         beq.s    np_port2
  751.         move.b    d2,29(a0)
  752.  
  753. np_port2:    move    26(a0),d2
  754.         beq.s    np_rts
  755.         move    28(a0),d3
  756.         tst.b    50(a0)
  757.         bne.s    np_sub
  758.         add    d3,24(a0)
  759.         cmp    24(a0),d2
  760.         bgt.s    np_portok
  761.         move    d2,24(a0)
  762.         move    d6,26(a0)
  763. np_portok:    move    24(a0),6(a4)
  764. np_rts:        cmp.b    #16,d1
  765.         beq.s    np_volslide
  766.         bra.w    np_lop2
  767.  
  768. np_sub:        sub    d3,24(a0)
  769.         cmp    24(a0),d2
  770.         blt.s    np_portok
  771.         move    d2,24(a0)
  772.         move    d6,26(a0)
  773.         move    24(a0),6(a4)
  774.         cmp.b    #16,d1
  775.         beq.w    np_volslide
  776.         bra.w    np_lop2
  777.  
  778. NP_waitdma
  779.     movem.l    d0-d1,-(sp)
  780.     moveq    #8,d0
  781. .dma1    move.b    $dff006,d1
  782. .dma2    cmp.b    $dff006,d1
  783.     beq    .dma2
  784.     dbeq    d0,.dma1
  785.     movem.l    (sp)+,d0-d1
  786.     rts    
  787.  
  788. np_position:    dc.l    0
  789. np_pattern:    dc.l    0
  790.  
  791. np_voice:    dc.l    0
  792. np_block:    blk.w    31,0
  793. np_voidat1:    blk.l    18,0
  794. np_voidat2:    blk.l    6,0
  795.  
  796.