⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tgasm.cpp

📁 This R2.9 revision of the CLID detector provides the TYPE 1 (on-hook, between first and second ring,
💻 CPP
字号:
/*------------------------------------------------------------------------*
*                                                                         *
*   THIS IS AN UNPUBLISHED WORK CONTAINING CONFIDENTIAL AND PROPRIETARY   *
*   INFORMATION.  IF PUBLICATION OCCURS, THE FOLLOWING NOTICE APPLIES:    *
*      "COPYRIGHT 2001 MICHAEL TSIROULNIKOV, ALL RIGHTS RESERVED"         *
*                                                                         *
*-------------------------------------------------------------------------*
    .include "tg.h55"
    .mmregs
    .arms_on
    .cpl_on
	.model call=c55_std
	.model mem=large
	
   	.sect ".tg_data"              
    .include "tgsin.h55"
    .text
    .if 0
    */

#include "stddefs.h"
#include "tg.h"
#include "tgsin.cc"

/*--------------------- local defs ----------------------------------------*/
/*--------------------- public vars ---------------------------------------*/
/*--------------------- local vars ----------------------------------------*/
/*--------------------- local functions -----------------------------------*/
/*--------------------- public  functions ---------------------------------*/
/*-------------------------------------------------------------------------*/
void                        tg_add_sine
/*-------------------------------------------------------------------------*/
(
TG_tTone *pTone,
S16 *pTo
)
{
    S32 ac0;
    S32 ac1 = pTone->sPhase;
    S32 ac2;
    S16 t0;

    int k;

    for (k = 0; k < STD_FR_SZ; k++)
    {
        ac1 = ac1 + pTone->sFreq;
        ac2 = ac1 >> 8;
        t0  = (S16)(ac2 & 0xff);
        ac0 = ((S32)*pTo)<<15;
        ac0 = ac0 + TG_asSin[t0] * (S32) (pTone->sAmp);
        *pTo++ = (S16)(ac0>>15);
    }
    pTone->sPhase = (S16)ac1;
}
/*
    .endif
    .global _tg_add_sine
_tg_add_sine
;
; input:
;   ar0 = pwave
;   ar1 = pTo
;   
; local vars
;   t0 = idx to sin table
;   ar2 = &TG_asSin[0]
;   ac1 = current phase
;
; assumes
;   TG_tTone is 
;       sPhase  (offset 0)
;       sFreq   (offset 1)
;       sAmp    (offset 2)
;
    xar2 = #_TG_asSin;
    ac1 = *ar0+;                        ; load initial phase

    brc0 = #(STD_FR_SZ-1);
    localrepeat {
        ac1 = ac1 + *ar0+;
        ac2 = ac1 << #-8;
        t0  = ac2 & #0xff;
        ac0 = *ar1 << #15;
                                        ; there will be nops due to *ar2(t0) access
        ac0 = ac0 + (*ar2(t0) * *ar0-)	;
        *ar1+ = HI(ac0 << #1)
    }
    mar(*ar0-);
    *ar0 = ac1;
    return;

    .if 0
*/
/*-------------------------------------------------------------------------*/
void                        tg_add_sine2
/*-------------------------------------------------------------------------*/
(
TG_tTone *pTone,
S16 *pTo
)
{
    S32 ac0;
    S32 ac1;
    S32 ac2;
    S32 ac3 = pTone->sPhase;
    S16 t0, t1;

    int k;

    for (k = 0; k < STD_FR_SZ/2; k++)
    {
        ac3 = ac3 + pTone->sFreq;
        ac2 = ac3 >> 8;
        t0  = (S16)(ac2 & 0xff);

        ac3 = ac3 + pTone->sFreq;
        ac2 = ac3 >> 8;
        t1  = (S16)(ac2 & 0xff);

        ac0 = ((S32)*pTo++)<<15;
        ac1 = ((S32)*pTo--)<<15;

        ac0 = ac0 + TG_asSin[t0] * (S32) (pTone->sAmp);
        ac1 = ac1 + TG_asSin[t1] * (S32) (pTone->sAmp);

        *pTo++ = (S16)(ac0>>15);
        *pTo++ = (S16)(ac1>>15);
    }
    pTone->sPhase = (S16)ac3;
}
/*
    .endif
    .global _tg_add_sine2
_tg_add_sine2
;
; input:
;   ar0 = pwave
;   ar1 = pTo
;   
; local vars
;   t0,t1 = idx to sin table
;   ar2 = &TG_asSin[0]
;   ac1 = current phase
;
; assumes
;   TG_tTone is 
;       sPhase  (offset 0)
;       sAmp    (offset 1)
;       sFreq   (offset 2)
;
    .arms_off
    push    (t3)
    bit(ST2, #st2_arms) = #0;
    bit(ST1, #st1_frct) = #1;

    xar2 = #_TG_asSin;
    ac3 = *ar0+;                        ; load initial phase
    t3  = *ar0+;                        ; load amplitude

    brc0 = #(STD_FR_SZ/2-1);
    localrepeat {
        ac3 = ac3 + *ar0;
        t0  = field_extract(ac3, #0xff00);
        ac3 = ac3 + *ar0;
        t1  = field_extract(ac3, #0xff00);

        pair(HI(ac0)) = *ar1;           ; 
                                        ; there will be nops due to *ar2(t0) access
        ac0 = ac0 + (t3 * *ar2(t0)) 
        ac1 = ac1 + (t3 * *ar2(t1));    ; 

        *ar1+ = pair(HI(ac0));          ; 
    }
    *ar0(#-2) = ac3;
    bit(ST1, #st1_frct) = #0;
    bit(ST2, #st2_arms) = #1;
    t3 = pop();
    return;
    .arms_on
*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -