;======================================================================== ;= = ;= Fast Hartley Transform demo for KolibriOS = ;= = ;= Copyright (C) 2010, Artem Jerdev = ;= = ;= refer to wiki.kolibtios.org for all details = ;= = ;======================================================================== use32 org 0x0 db 'MENUET01' ; 8 byte id dd 0x01 ; header version dd START ; start of code dd I_END ; size of image dd 0x100000 ; memory for app dd 0xbfffc ; esp dd 0x0 , 0x0 ; I_Param , I_Icon include '../../macros.inc' include '../debug.inc' include 'fht4code.asm' START: ; start of execution call main mov eax,-1 ; close this program int 0x40 ;============================================================= ;Func: calculates a simple function ; ff = (512*2^(-t) * cos (2.5*t)) ; uses: eax, ebx ;------------ Func: ; 9 : { ; 10 : double x,t; ; 11 : int f; ; 12 : ; 13 : x = (i < N2) ? i : i - NUM_POINTS; mov eax, [ii] cmp eax, 512 jge .index_negative jmp .index_correct .index_negative: sub eax, 1024 .index_correct: mov [temp], eax ; fild [temp] ; 14 : t = x / 16.0; ; f2xm1 argument (abs) must be less than 1, so mov [t_mod], eax and [t_mod], 0x0F ; x % 16 shr eax, 4 ; x / 16 mov [t_div], eax fild [temp] ; 15 : if (t<0) t = -t; fabs exp_ok: ; 16 : f = (512*2^(-t) * cos (2.5*t)); fchs f2xm1 fmul [f500] fstp [tv93] fld [f2_5] fmul [tt] fcos fmul [tv93] fstp [tt] mov bx, word[tt+6] shr bx,4 and bx,0x07FF add ax,bx shl ax,4 and word[tt+6], 0x800F or word[tt+6], ax fld [tt] fstp [ff] ; 17 : return f; ; 18 : } ret ;--------------------------------------------------------- ; test data filler ; ; uses eax, ebx, ecx FillData: ; 29 : for (i=0; i