home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
326.lha
/
KFFT_v1.1
/
makewtable
< prev
next >
Wrap
Text File
|
1989-12-23
|
2KB
|
70 lines
version# 2000 >= constant jforth2?
jforth2?
.IF include? float ju:float.ffp
fpinit
include? logto ju:logto
.ELSE include? float ju:floating
also floating
open-float
.THEN
ANEW task-make-wtab
14 CONSTANT wscale
1 wscale +SHIFT FLOAT CONSTANT fwscale
jforth2?
.IF 3.14159265 CONSTANT pi_wtab
: FROUNDFIX compile FIX ; immediate
.ELSE 3.14159265+0 CONSTANT pi-wtab
: fcos compile cos ; immediate
: fsin compile sin ; immediate
: FROUNDFIX ( float -- rounded-fixed )
DUP TST FLOAT 0.5+0 F* F+ FIX ;
.THEN
VARIABLE logging?
: INPUT$ ( -- $string )
PAD 1+ 128 EXPECT SPAN @ PAD C! PAD ;
: INPUT# ( -- N true | false )
INPUT$ NUMBER? IF DROP TRUE ELSE FALSE THEN ;
: makewtable ( -- )
CR CR ." Input number of (cos,sin) pairs to generate ( 1-20 ). >"
INPUT#
IF DUP 1 20 WITHIN? ELSE FALSE THEN
NOT IF ABORT THEN
CR CR ." Create new WTABLE file?" y/n
DUP logging? !
IF " WTABLE" $LOGTO THEN
DUP CR CR . ." CONSTANT max_log2_fft"
CR CR CR ." float_fft? .IF"
CR CR ." ( floating point cos, sin table )"
CR ." CREATE w-table-fft"
DUP
0 DO I 1 AND NOT IF CR THEN
pi_wtab 1 I +SHIFT FLOAT F/ DUP
FSIN SWAP FCOS
2 0 DO ." $ " .HEX ." ," LOOP
LOOP
CR CR ." .ELSE
CR CR ." ( fixed point cos, sin table )"
CR ." CREATE w-table-fft"
0 DO I 1 AND NOT IF CR THEN
pi_wtab 1 I +SHIFT FLOAT F/ DUP
FSIN fwscale F* FROUNDFIX SWAP FCOS fwscale F* FROUNDFIX
2 0 DO ." $ " .HEX ." ," LOOP
LOOP
CR CR ." .THEN" CR CR CR
logging? @ IF logend THEN
;
cr ." Enter makewtable to run." cr cr