	;macro XNI_NOT
;------ Decode position by one channel ------
Xni_not=$
	LD   (IY+ds_note),A          ;Xs_note
        XOR  A

        ;LD   (IY+ds_Vsl),#10        ;Xs_Vsl
        ;LD   (IY+ds_Nsl),A          ;Xs_Nsl
        ;LD   (IY+ds_Esl),A          ;Xs_Esl
        ;LD   (IY+ds_dtn),A          ;Xs_dtn  low
        ;LD   (IY+ds_dtn+1),A          ;Xs_dtn  High
        ;LD   (IY+ds_dsp),A          ;Xs_dsp
        ;LD   (IY+do_dsp),A          ;Xo_dsp
        ;LD   (IY+dsl_dsp),A          ;Xsl_dsp low
        ;LD   (IY+dsl_dsp+1),A          ;Xsl_dsp High
        ;LD   (IY+dsl_stp),A          ;Xsl_stp

	ld hl,(curiy)
	ld b,clblocksize
	dec hl
	ld (hl),a
	djnz $-2
	if pt3_smpfix
	ld (hl),#10
	endif
Xni_vol=$
	JR   NZ,Xni_v0
	 if pt3_vib6
        LD   (IY+dvb_stp),A          ;Xvb_stp=#00
	 endif
        sbc a,a ;DEC  A ;because CY=1 after JR C,Xni_vol, CY=0 after XOR A
        LD   (IY+dvb_lok),A          ;Xvb_lok=#FF
        RET 
Xni_v0=$
	if pt3_vol
	ADD  A,A
        ADD  A,A
        ADD  A,A
        ADD  A,A
	else
	add a,minvol
	endif
        LD   (IY+dg_vol),A          ;Xg_vol=A*16
        JR   Xn_clc2
Xni_s_o=$
	 CALL ornPP
         ;LD   (IY+do_adr),L          ;Xo_adr=HL
         ;LD   (IY+do_adr+1),H
Xni_vse=$
	CALL NZ,EiPP
Xni_sm0=$
	LD   (IY+dm_vol),A          ;Xm_vol
        XOR  A
        LD   (IY+do_dsp),A          ;Xo_dsp=0
        LD   A,(DE)
        INC  DE
	rrca
Xni_smp=$
	CALL smpPPmul2
        LD   (IY+ds_adr),L           ;Xs_adr
        LD   (IY+ds_adr+1),H
Xn_clc1=$
	LD   BC,#1020
Xn_clc2=$
	LD   A,(DE)
        INC  DE
        ADD  A,B
        JR   C,Xni_s_o
        ADD  A,C
	ret z
        JR   C,Xni_smp
        ADD  A,B
        JR   C,Xni_vol
        ADD  A,B
        JR   C,Xni_vqe
        ADD  A,96
        JR   C,Xni_not
        ADD  A,B
        JR   C,Xni_orn
        ADD  A,C
	 if pt3_noi
        JR   C,Xni_noi
	 endif
        ADD  A,B
        JR   C,Xni_vse
	 if pt3_commands
        ADD  A,B
        LD   HL,X_eff-2
        ADD  A,A
        ADD  A,L
        LD   L,A
        LD   C,(HL)
        INC  L
        LD   B,(HL)
        PUSH BC ;putting all the effects in stack, they will be used after Xni_not or Xni_vol or RETZ in Xni_smp
		;(1 effect is allowed in the editor)
        LD   A,(IY+ds_note)          ;Xs_note
        EXA 
        JR   Xn_clc1
	 endif
Xni_noi=$
	 if pt3_noi
	LD   (N_frq),A        ;GLOBALnoise
        JR   Xn_clc2
	 endif
Xni_vqe=$
	JR   Z,Xni_v1
        DEC  A
        JR   NZ,Xni_e0
        LD   A,(DE)
        LD   (IY+di_qty),A          ;Xi_qty
        INC  DE
        JR   Xn_clc2
Xni_e0=$
	CALL EiPP
Xni_v1=$
	LD   (IY+dm_vol),A          ;Xm_vol
        JR   Xn_clc2
Xni_orn=$
	 CALL ornPP
         ;LD   (IY+do_adr),L          ;Xo_adr=HL
         ;LD   (IY+do_adr+1),H
        LD   (IY+do_dsp),A          ;Xo_dsp=0
        JR   Xn_clc1
	;endm

	;macro EFFECTS
;------ Special Effects COM.XXXX ------
Xef_slT=$
	if pt3_sld12
Off_PRT=Xsl_sts-Xsl_plk
	LD   A,(DE)
        INC  DE
        LD   (IY+dsl_stp),A          ;Xsl_stp
        LD   (IY+dsl_sts),A          ;Xsl_sts
        LD   A,(DE)
        INC  DE
        LD   (IY+dsl_tfr),A          ;Xsl_tfr (LOW)
        LD   A,(DE)
        INC  DE
        LD   (IY+dsl_tfr+1),A          ;Xsl_tfr (HIGH)
	 if pt3_vib6
        LD   (IY+dvb_stp),0          ;Xvb_stp
	 endif
        LD   (IY+dsl_plk),Off_PRT    ;Xsl_plk=PORT_OFF
        RET 
	endif
Xef_nsT=$
	if pt3_port3
Off_PRT=Xsl_sts-Xsl_plk
	CALL Xef_slT
        LD   A,(DE)
        INC  DE
        LD   (IY+dsl_tfr),A          ;Xsl_tfr (LOW)
        LD   A,(DE)
        INC  DE
        LD   (IY+dsl_tfr+1),A          ;Xsl_tfr (HIGH)
        LD   (IY+dsl_plk),0          ;Xsl_plk=PORT_ON
        LD   A,(IY+ds_note)          ;Xs_note
        LD   (IY+dsl_not),A          ;Xsl_not
        EXA 
        LD   (IY+ds_note),A
        RET
	endif
Xef_dSm=$
	if pt3_dsmp4
	LD   A,(DE)
        INC  DE
        LD   (IY+ds_dsp),A          ;Xs_dsp
        RET
	endif
Xef_dOr=$
	if pt3_dorn5
	LD   A,(DE)
        INC  DE
        LD   (IY+do_dsp),A          ;Xo_dsp
        RET 
	endif
Xef_vib=$
	if pt3_vib6
	LD   A,(DE)
        INC  DE
        LD   (IY+dvb_stp),A
        LD   (IY+dvb_sts),A
        LD   A,(DE)
        INC  DE
        LD   (IY+dvb_frq),A
        LD   (IY+dsl_stp),0          ;Xsl_stp switsh off SLIDE
        RET
	endif
eff_tmp=$
	if pt3_tempoB
	LD   A,(DE)
        INC  DE
        LD   (curtempo),A
        RET
	endif
	;endm

