📄 tonegen32b.s
字号:
;*********************************************************************
; *
; Software License Agreement *
; *
; The software supplied herewith by Microchip Technology *
; Incorporated (the "Company") for its dsPIC controller *
; is intended and supplied to you, the Company's customer, *
; for use solely and exclusively on Microchip dsPIC *
; products. The software is owned by the Company and/or its *
; supplier, and is protected under applicable copyright laws. All *
; rights are reserved. Any use in violation of the foregoing *
; restrictions may subject the user to criminal sanctions under *
; applicable laws, as well as to civil liability for the breach of *
; the terms and conditions of this license. *
; *
; THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO *
; WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, *
; BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND *
; FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE *
; COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, *
; INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. *
; *
; (c) Copyright 2007 Microchip Technology, All rights reserved. *
;*********************************************************************
; Local inclusions.
.nolist
.include "dspcommon.inc" ; MODCON, XBREV
.list
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
.section .libdsp, code
.global _toneGen32b
.equ TF_FFT_SIZE,1024 ; 10stage, 1024 point complex FFT
.text
;............................................................................
_toneGen32b:
;............................................................................
; Context Save
PUSH CORCON
PUSH PSVPAG
LNK #20
;............................................................................
;............................................................................
;; PSVPAG = __builtin_psvpage(&twiddleFactor);
;; CORCONbits.PSV = 1;
MOV w4,PSVPAG
BSET CORCON,#2
MOV #4,w4
MUL.UU w4,w1,w4 ; 4*tone
MUL.UU w4,w0,w4 ; 4*tone*sample
SL w2,#2,w1 ; 2*phase
ADD w4,w1,w4
MOV #(TF_FFT_SIZE*2),w6
DEC w6,w6
AND w6,w4,w7
MOV #ACCAL,w5
ADD w7,w3,w7
LAC [++w7],A
MOV [--w7],[w5]
INC w6,w6
AND w6,w4,w6
BRA nz,NEG_VAL
BRA EXIT
NEG_VAL:
NEG A
EXIT:
MOV [w5++],w0
MOV [w5],w1
;............................................................................
; Context Restore
ULNK
POP PSVPAG
POP CORCON
;............................................................................
RETURN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -