www.pudn.com > fft_iccavr.rar > fft2.s
.module fft2.c .area text(rom, con, rel) .dbfile D:\HJN\Design\AVR\fft\fft2.c .dbfunc e FFT _FFT fV ; l0 -> y+36 ; vi -> y+32 ; vr -> y+28 ; is -> y+26 ; i -> y+24 ; poddi -> y+20 ; poddr -> y+16 ; q -> y+12 ; p -> y+8 ; s -> y+4 ; m -> y+2 ; nv -> y+0 ; it -> R20,R21 ; j -> R10,R11 ; il -> y+70 ; l -> y+68 ; fi -> R12,R13 ; fr -> R14,R15 ; k -> y+62 ; n -> y+60 ; pi -> y+58 ; pr -> y+56 .even _FFT:: xcall push_arg4 xcall push_gset5 sbiw R28,46 movw R30,R28 subi R30,192 ; addi 64 sbci R31,255 ldd R14,z+0 ldd R15,z+1 movw R30,R28 subi R30,190 ; addi 66 sbci R31,255 ldd R12,z+0 ldd R13,z+1 .dbline -1 .dbline 10 ; #include; ; /*pr:输入实部 ; pi:输入虚部 ; n为2^k,n不小于数据个数 ; l:为0表示正变换,1表示反变换 ; il:1表示fr为取模结果。0表示fr输出实部fi输出虚部 ; */ ; void FFT(double* pr, double* pi, int n, int k, double* fr, double* fi, int l, int il) ; { .dbline 13 ; int it,m,is,i,j,nv,l0; ; double p,q,s,vr,vi,poddr,poddi; ; for(it = 0;it <= n - 1;it ++) clr R20 clr R21 xjmp L5 L2: .dbline 14 ; { .dbline 15 ; m = it; std y+3,R21 std y+2,R20 .dbline 16 ; is = 0; clr R2 clr R3 std y+27,R3 std y+26,R2 .dbline 17 ; for(i = 0;i <= k - 1;i ++) std y+25,R3 std y+24,R2 xjmp L9 L6: .dbline 18 .dbline 19 ldi R18,2 ldi R19,0 ldd R16,y+2 ldd R17,y+3 xcall div16s movw R10,R16 .dbline 20 ldi R16,2 ldi R17,0 movw R18,R10 xcall empy16s ldd R2,y+2 ldd R3,y+3 sub R2,R16 sbc R3,R17 ldd R18,y+26 ldd R19,y+27 ldi R16,2 ldi R17,0 xcall empy16s movw R4,R16 add R4,R2 adc R5,R3 std y+27,R5 std y+26,R4 .dbline 21 std y+3,R11 std y+2,R10 .dbline 22 L7: .dbline 17 ldd R24,y+24 ldd R25,y+25 adiw R24,1 std y+25,R25 std y+24,R24 L9: .dbline 17 ldd R24,y+62 ldd R25,y+63 sbiw R24,1 ldd R2,y+24 ldd R3,y+25 cp R24,R2 cpc R25,R3 brge L6 .dbline 23 ldd R18,y+26 ldd R19,y+27 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R30,R16 add R30,R14 adc R31,R15 std z+0,R2 std z+1,R3 std z+2,R4 std z+3,R5 .dbline 24 ldd R18,y+26 ldd R19,y+27 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R30,R16 add R30,R12 adc R31,R13 std z+0,R2 std z+1,R3 std z+2,R4 std z+3,R5 .dbline 25 L3: .dbline 13 subi R20,255 ; offset = 1 sbci R21,255 L5: .dbline 13 ldd R24,y+60 ldd R25,y+61 sbiw R24,1 cp R24,R20 cpc R25,R21 brlt X3 xjmp L2 X3: .dbline 26 ; { ; j = m / 2; ; is = 2 * is + (m - 2 * j); ; m = j; ; } ; fr[it] = pr[is]; ; fi[it] = pi[is]; ; } ; pr[0] = 1.0; ldi R16, L10 xcall lpm32 movw R2,R16 movw R4,R18 ldd R30,y+56 ldd R31,y+57 std z+0,R2 std z+1,R3 std z+2,R4 std z+3,R5 .dbline 27 ; pi[0] = 0.0; ldi R16, L11 xcall lpm32 movw R2,R16 movw R4,R18 ldd R30,y+58 ldd R31,y+59 std z+0,R2 std z+1,R3 std z+2,R4 std z+3,R5 .dbline 28 ; p = 6.283185306 / (1.0 * n); ldi R16, L12 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 ldi R16, L10 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 ; stack offset 8 movw R30,R28 subi R30,188 ; addi 68 sbci R31,255 ldd R16,z+0 ldd R17,z+1 xcall int2fp st -y,R19 st -y,R18 st -y,R17 st -y,R16 xcall empy32fs xcall div32f movw R30,R28 std z+8,R16 std z+9,R17 std z+10,R18 std z+11,R19 .dbline 29 ; pr[1] = cos(p); movw R30,R28 ldd R16,z+8 ldd R17,z+9 ldd R18,z+10 ldd R19,z+11 xcall _cos movw R2,R16 movw R4,R18 ldd R30,y+56 ldd R31,y+57 std z+4,R2 std z+5,R3 std z+6,R4 std z+7,R5 .dbline 30 ; pi[1] = -sin(p); movw R30,R28 ldd R16,z+8 ldd R17,z+9 ldd R18,z+10 ldd R19,z+11 xcall _sin st -y,R19 st -y,R18 st -y,R17 st -y,R16 xcall neg32f ldd R30,y+58 ldd R31,y+59 std z+4,R16 std z+5,R17 std z+6,R18 std z+7,R19 .dbline 31 ; if(l != 0) movw R30,R28 subi R30,188 ; addi 68 sbci R31,255 ldd R0,z+0 ldd R1,z+1 tst R0 brne X0 tst R1 breq L13 X0: .dbline 32 ; pi[1] = -pi[1]; ldd R24,y+58 ldd R25,y+59 adiw R24,4 movw R2,R24 movw R30,R24 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall neg32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 L13: .dbline 33 ; for(i = 2;i <= n - 1;i ++) ldi R24,2 ldi R25,0 std y+25,R25 std y+24,R24 xjmp L18 L15: .dbline 34 .dbline 35 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 sbiw R30,4 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R0 ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall empy32f movw R30,R28 std z+8,R16 std z+9,R17 std z+10,R18 std z+11,R19 .dbline 36 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 sbiw R30,4 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R0 ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall empy32f movw R30,R28 std z+12,R16 std z+13,R17 std z+14,R18 std z+15,R19 .dbline 37 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R24,R16 sbiw R24,4 movw R30,R24 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R24 ; stack offset 4 ldd R0,y+62 ldd R1,y+63 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall add32fs ; stack offset 4 ldd R30,y+60 ldd R31,y+61 ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 ; stack offset 8 movw R26,R28 subi R26,190 ; addi 66 sbci R27,255 ld R30,x+ ld R31,x ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall add32fs xcall empy32f movw R30,R28 std z+4,R16 std z+5,R17 std z+6,R18 std z+7,R19 .dbline 38 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 movw R26,R28 adiw R26,8 ld R2,x+ ld R3,x+ ld R4,x+ ld R5,x st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R26,R28 ; stack offset 4 adiw R26,16 ld R2,x+ ld R3,x+ ld R4,x+ ld R5,x st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32f std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 39 movw R30,R28 ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R28 ; stack offset 4 ldd R2,z+12 ldd R3,z+13 ldd R4,z+14 ldd R5,z+15 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32fs movw R30,R28 ; stack offset 4 ldd R2,z+16 ldd R3,z+17 ldd R4,z+18 ldd R5,z+19 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32f ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 40 L16: .dbline 33 ldd R24,y+24 ldd R25,y+25 adiw R24,1 std y+25,R25 std y+24,R24 L18: .dbline 33 ldd R24,y+60 ldd R25,y+61 sbiw R24,1 ldd R2,y+24 ldd R3,y+25 cp R24,R2 cpc R25,R3 brlt X4 xjmp L15 X4: .dbline 41 ; { ; p = pr[i - 1] * pr[1]; ; q = pi[i - 1] * pi[1]; ; s = (pr[i - 1] + pi[i - 1]) * (pr[1] + pi[1]); ; pr[i] = p - q; ; pi[i] = s - p - q; ; } ; for(it = 0;it <= n - 2;it = it + 2) clr R20 clr R21 xjmp L22 L19: .dbline 42 .dbline 43 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R30,R16 add R30,R14 adc R31,R15 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 movw R30,R28 std z+28,R2 std z+29,R3 std z+30,R4 std z+31,R5 .dbline 44 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R30,R16 add R30,R12 adc R31,R13 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 movw R30,R28 std z+32,R2 std z+33,R3 std z+34,R4 std z+35,R5 .dbline 45 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R2,R16 add R2,R14 adc R3,R15 movw R30,R28 ldd R4,z+28 ldd R5,z+29 ldd R6,z+30 ldd R7,z+31 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R2 ldd R4,z+4 ldd R5,z+5 ldd R6,z+6 ldd R7,z+7 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall add32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 46 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R2,R16 add R2,R12 adc R3,R13 movw R30,R28 ldd R4,z+32 ldd R5,z+33 ldd R6,z+34 ldd R7,z+35 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R2 ldd R4,z+4 ldd R5,z+5 ldd R6,z+6 ldd R7,z+7 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall add32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 47 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R24,R16 add R24,R14 adc R25,R15 adiw R24,4 movw R2,R24 movw R30,R28 ldd R4,z+28 ldd R5,z+29 ldd R6,z+30 ldd R7,z+31 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R24 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall sub32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 48 ldi R16,4 ldi R17,0 movw R18,R20 xcall empy16s movw R24,R16 add R24,R12 adc R25,R13 adiw R24,4 movw R2,R24 movw R30,R28 ldd R4,z+32 ldd R5,z+33 ldd R6,z+34 ldd R7,z+35 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R24 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall sub32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 49 L20: .dbline 41 subi R20,254 ; offset = 2 sbci R21,255 L22: .dbline 41 ldd R24,y+60 ldd R25,y+61 sbiw R24,2 cp R24,R20 cpc R25,R21 brlt X5 xjmp L19 X5: .dbline 50 ; { ; vr = fr[it]; ; vi = fi[it]; ; fr[it] = vr + fr[it + 1]; ; fi[it] = vi + fi[it + 1]; ; fr[it + 1] = vr - fr[it + 1]; ; fi[it + 1] = vi - fi[it + 1]; ; } ; m = n / 2; ldi R18,2 ldi R19,0 ldd R16,y+60 ldd R17,y+61 xcall div16s std y+3,R17 std y+2,R16 .dbline 51 ; nv = 2; ldi R24,2 ldi R25,0 std y+1,R25 std y+0,R24 .dbline 52 ; for(l0 = k - 2;l0 >= 0;l0 --) ldd R24,y+62 ldd R25,y+63 sbiw R24,2 std y+37,R25 std y+36,R24 xjmp L26 L23: .dbline 53 ; { .dbline 54 ; m = m / 2; ldi R18,2 ldi R19,0 ldd R16,y+2 ldd R17,y+3 xcall div16s std y+3,R17 std y+2,R16 .dbline 55 ; nv = 2 * nv; ldd R18,y+0 ldd R19,y+1 ldi R16,2 ldi R17,0 xcall empy16s std y+1,R17 std y+0,R16 .dbline 56 ; for(it = 0;it <= (m - 1) * nv;it = it + nv) clr R20 clr R21 xjmp L30 L27: .dbline 57 ; for(j = 0;j <= (nv / 2) - 1;j ++) clr R10 clr R11 xjmp L34 L31: .dbline 58 .dbline 59 ldd R16,y+2 ldd R17,y+3 movw R18,R10 xcall empy16s movw R18,R16 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 ldi R18,2 ldi R19,0 ; stack offset 4 ldd R16,y+4 ldd R17,y+5 xcall div16s movw R18,R20 add R18,R10 adc R19,R11 add R18,R16 adc R19,R17 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 add R30,R14 adc R31,R15 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall empy32f movw R30,R28 std z+8,R16 std z+9,R17 std z+10,R18 std z+11,R19 .dbline 60 ldd R16,y+2 ldd R17,y+3 movw R18,R10 xcall empy16s movw R18,R16 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 ldi R18,2 ldi R19,0 ; stack offset 4 ldd R16,y+4 ldd R17,y+5 xcall div16s movw R18,R20 add R18,R10 adc R19,R11 add R18,R16 adc R19,R17 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 add R30,R12 adc R31,R13 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall empy32f movw R30,R28 std z+12,R16 std z+13,R17 std z+14,R18 std z+15,R19 .dbline 61 ldd R16,y+2 ldd R17,y+3 movw R18,R10 xcall empy16s movw R18,R16 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 movw R30,R2 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R2 ; stack offset 4 ldd R0,y+62 ldd R1,y+63 add R30,R0 adc R31,R1 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall add32f movw R30,R28 std z+4,R16 std z+5,R17 std z+6,R18 std z+7,R19 .dbline 62 ldi R18,2 ldi R19,0 ldd R16,y+0 ldd R17,y+1 xcall div16s movw R18,R20 add R18,R10 adc R19,R11 add R18,R16 adc R19,R17 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R28 ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R16 add R30,R14 adc R31,R15 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R16 add R30,R12 adc R31,R13 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall add32fs xcall empy32f movw R30,R28 std z+4,R16 std z+5,R17 std z+6,R18 std z+7,R19 .dbline 63 movw R30,R28 ldd R2,z+8 ldd R3,z+9 ldd R4,z+10 ldd R5,z+11 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R28 ; stack offset 4 ldd R2,z+16 ldd R3,z+17 ldd R4,z+18 ldd R5,z+19 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32f movw R30,R28 std z+16,R16 std z+17,R17 std z+18,R18 std z+19,R19 .dbline 64 movw R30,R28 ldd R2,z+4 ldd R3,z+5 ldd R4,z+6 ldd R5,z+7 st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R30,R28 ; stack offset 4 ldd R2,z+12 ldd R3,z+13 ldd R4,z+14 ldd R5,z+15 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32fs movw R30,R28 ; stack offset 4 ldd R2,z+16 ldd R3,z+17 ldd R4,z+18 ldd R5,z+19 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32f movw R30,R28 std z+20,R16 std z+21,R17 std z+22,R18 std z+23,R19 .dbline 65 movw R2,R20 add R2,R10 adc R3,R11 ldi R18,2 ldi R19,0 ldd R16,y+0 ldd R17,y+1 xcall div16s movw R18,R2 add R18,R16 adc R19,R17 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 add R30,R14 adc R31,R15 ldi R16,4 ldi R17,0 movw R18,R2 xcall empy16s movw R26,R16 add R26,R14 adc R27,R15 ld R2,x+ ld R3,x+ ld R4,x+ ld R5,x st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R26,R28 ; stack offset 4 adiw R26,20 ld R2,x+ ld R3,x+ ld R4,x+ ld R5,x st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32f std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 66 movw R2,R20 add R2,R10 adc R3,R11 ldi R18,2 ldi R19,0 ldd R16,y+0 ldd R17,y+1 xcall div16s movw R18,R2 add R18,R16 adc R19,R17 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 add R30,R12 adc R31,R13 ldi R16,4 ldi R17,0 movw R18,R2 xcall empy16s movw R26,R16 add R26,R12 adc R27,R13 ld R2,x+ ld R3,x+ ld R4,x+ ld R5,x st -y,R5 st -y,R4 st -y,R3 st -y,R2 movw R26,R28 ; stack offset 4 adiw R26,24 ld R2,x+ ld R3,x+ ld R4,x+ ld R5,x st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall sub32f std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 67 movw R18,R20 add R18,R10 adc R19,R11 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 add R2,R14 adc R3,R15 movw R30,R2 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R28 ; stack offset 4 ldd R4,z+20 ldd R5,z+21 ldd R6,z+22 ldd R7,z+23 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall add32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 68 movw R18,R20 add R18,R10 adc R19,R11 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 add R2,R12 adc R3,R13 movw R30,R2 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R28 ; stack offset 4 ldd R4,z+24 ldd R5,z+25 ldd R6,z+26 ldd R7,z+27 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall add32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 69 L32: .dbline 57 movw R24,R10 adiw R24,1 movw R10,R24 L34: .dbline 57 ldi R18,2 ldi R19,0 ldd R16,y+0 ldd R17,y+1 xcall div16s movw R24,R16 sbiw R24,1 cp R24,R10 cpc R25,R11 brlt X6 xjmp L31 X6: L28: .dbline 56 ldd R2,y+0 ldd R3,y+1 add R20,R2 adc R21,R3 L30: .dbline 56 ldd R18,y+0 ldd R19,y+1 ldd R16,y+2 ldd R17,y+3 subi R16,1 sbci R17,0 xcall empy16s cp R16,R20 cpc R17,R21 brlt X7 xjmp L27 X7: .dbline 70 L24: .dbline 52 ldd R24,y+36 ldd R25,y+37 sbiw R24,1 std y+37,R25 std y+36,R24 L26: .dbline 52 ldd R24,y+36 ldd R25,y+37 cpi R24,0 ldi R30,0 cpc R25,R30 brlt X8 xjmp L23 X8: .dbline 71 ; { ; p = pr[m * j] * fr[it + j + nv / 2]; ; q = pi[m * j] * fi[it + j + nv / 2]; ; s = pr[m * j] + pi[m * j]; ; s = s * (fr[it + j + nv / 2] + fi[it + j + nv / 2]); ; poddr = p - q; ; poddi = s - p - q; ; fr[it + j + nv / 2] = fr[it + j] - poddr; ; fi[it + j + nv / 2] = fi[it + j] - poddi; ; fr[it + j] = fr[it + j] + poddr; ; fi[it + j] = fi[it + j] + poddi; ; } ; } ; if(l != 0) movw R30,R28 subi R30,188 ; addi 68 sbci R31,255 ldd R0,z+0 ldd R1,z+1 tst R0 brne X1 tst R1 brne X9 xjmp L35 X9: X1: .dbline 72 ; for(i = 0;i <= n - 1;i ++) clr R2 clr R3 std y+25,R3 std y+24,R2 xjmp L40 L37: .dbline 73 .dbline 74 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 add R2,R14 adc R3,R15 movw R30,R2 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 ldi R16, L10 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 ; stack offset 8 movw R30,R28 subi R30,188 ; addi 68 sbci R31,255 ldd R16,z+0 ldd R17,z+1 xcall int2fp st -y,R19 st -y,R18 st -y,R17 st -y,R16 xcall empy32fs xcall div32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 75 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 add R2,R12 adc R3,R13 movw R30,R2 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 ldi R16, L10 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 ; stack offset 8 movw R30,R28 subi R30,188 ; addi 68 sbci R31,255 ldd R16,z+0 ldd R17,z+1 xcall int2fp st -y,R19 st -y,R18 st -y,R17 st -y,R16 xcall empy32fs xcall div32f movw R30,R2 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 76 L38: .dbline 72 ldd R24,y+24 ldd R25,y+25 adiw R24,1 std y+25,R25 std y+24,R24 L40: .dbline 72 ldd R24,y+60 ldd R25,y+61 sbiw R24,1 ldd R2,y+24 ldd R3,y+25 cp R24,R2 cpc R25,R3 brlt X10 xjmp L37 X10: L35: .dbline 77 ; { ; fr[i] = fr[i] / (1.0 * n); ; fi[i] = fi[i] / (1.0 * n); ; } ; if(il != 0) movw R30,R28 subi R30,186 ; addi 70 sbci R31,255 ldd R0,z+0 ldd R1,z+1 tst R0 brne X2 tst R1 brne X11 xjmp L41 X11: X2: .dbline 78 ; for(i = 0;i <= n - 1;i ++) clr R2 clr R3 std y+25,R3 std y+24,R2 xjmp L46 L43: .dbline 79 ; { .dbline 80 ; pr[i] = sqrt(fr[i] * fr[i] + fi[i] * fi[i]); ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 movw R30,R2 add R30,R14 adc R31,R15 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 movw R30,R28 std z+38,R4 std z+39,R5 std z+40,R6 std z+41,R7 movw R30,R2 add R30,R12 adc R31,R13 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 movw R30,R28 std z+42,R4 std z+43,R5 std z+44,R6 std z+45,R7 movw R30,R28 ldd R4,z+38 ldd R5,z+39 ldd R6,z+40 ldd R7,z+41 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R28 ; stack offset 4 ldd R4,z+42 ldd R5,z+43 ldd R6,z+44 ldd R7,z+45 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall empy32fs movw R30,R28 ; stack offset 4 ldd R4,z+46 ldd R5,z+47 ldd R6,z+48 ldd R7,z+49 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R28 ; stack offset 8 ldd R4,z+50 ldd R5,z+51 ldd R6,z+52 ldd R7,z+53 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall empy32fs xcall add32f push R2 push R3 xcall _sqrt pop R3 pop R2 movw R4,R16 movw R6,R18 movw R30,R2 ldd R0,y+56 ldd R1,y+57 add R30,R0 adc R31,R1 std z+0,R4 std z+1,R5 std z+2,R6 std z+3,R7 .dbline 81 ; if(fabs(fr[i]) < 0.000001 * fabs(fi[i])) ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 add R30,R14 adc R31,R15 ldd R16,z+0 ldd R17,z+1 ldd R18,z+2 ldd R19,z+3 xcall _fabs movw R2,R16 movw R4,R18 ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 add R30,R12 adc R31,R13 ldd R16,z+0 ldd R17,z+1 ldd R18,z+2 ldd R19,z+3 push R2 push R3 push R4 push R5 xcall _fabs pop R5 pop R4 pop R3 pop R2 movw R6,R16 movw R8,R18 st -y,R5 st -y,R4 st -y,R3 st -y,R2 ldi R16, L49 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 st -y,R9 st -y,R8 st -y,R7 st -y,R6 xcall empy32fs xcall cmp32f brlt X12 xjmp L47 X12: .dbline 82 ; { .dbline 83 ; if((fi[i] * fr[i]) > 0) ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 ldi R16, L11 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 movw R30,R2 add R30,R12 adc R31,R13 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R2 add R30,R14 adc R31,R15 ldd R2,z+0 ldd R3,z+1 ldd R4,z+2 ldd R5,z+3 st -y,R5 st -y,R4 st -y,R3 st -y,R2 xcall empy32fs xcall cmp32f brge L50 .dbline 84 ; pi[i] = 90.0; ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 ldi R16, L52 xcall lpm32 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 xjmp L48 L50: .dbline 86 ; else ; pi[i] = -90.0; ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R30,R16 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 ldi R16, L53 xcall lpm32 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 .dbline 87 ; } xjmp L48 L47: .dbline 89 ; else ; pi[i] = atan(fi[i] / fr[i]) * 360.0 / 6.283185306; ldd R18,y+24 ldd R19,y+25 ldi R16,4 ldi R17,0 xcall empy16s movw R2,R16 movw R30,R2 add R30,R12 adc R31,R13 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 movw R30,R2 add R30,R14 adc R31,R15 ldd R4,z+0 ldd R5,z+1 ldd R6,z+2 ldd R7,z+3 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall div32f push R2 push R3 xcall _atan pop R3 pop R2 movw R4,R16 movw R6,R18 ldi R16, L54 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 st -y,R7 st -y,R6 st -y,R5 st -y,R4 xcall empy32fs ldi R16, L12 xcall lpm32 st -y,R19 st -y,R18 st -y,R17 st -y,R16 xcall div32f movw R30,R2 ldd R0,y+58 ldd R1,y+59 add R30,R0 adc R31,R1 std z+0,R16 std z+1,R17 std z+2,R18 std z+3,R19 L48: .dbline 90 L44: .dbline 78 ldd R24,y+24 ldd R25,y+25 adiw R24,1 std y+25,R25 std y+24,R24 L46: .dbline 78 ldd R24,y+60 ldd R25,y+61 sbiw R24,1 ldd R2,y+24 ldd R3,y+25 cp R24,R2 cpc R25,R3 brlt X13 xjmp L43 X13: L41: .dbline -2 L1: adiw R28,46 xcall pop_gset5 adiw R28,4 .dbline 0 ; func end ret .dbsym l l0 36 I .dbsym l vi 32 D .dbsym l vr 28 D .dbsym l is 26 I .dbsym l i 24 I .dbsym l poddi 20 D .dbsym l poddr 16 D .dbsym l q 12 D .dbsym l p 8 D .dbsym l s 4 D .dbsym l m 2 I .dbsym l nv 0 I .dbsym r it 20 I .dbsym r j 10 I .dbsym l il 70 I .dbsym l l 68 I .dbsym r fi 12 pD .dbsym r fr 14 pD .dbsym l k 62 I .dbsym l n 60 I .dbsym l pi 58 pD .dbsym l pr 56 pD .dbend .dbfunc e main _main fI .even _main:: .dbline -1 .dbline 94 ; } ; } ; ; main() ; { L56: .dbline 95 L57: .dbline 95 xjmp L56 X14: .dbline -2 L55: .dbline 0 ; func end ret .dbend .area lit(rom, con, rel) L54: .word 0x0,0x43b4 L53: .word 0x0,0xc2b4 L52: .word 0x0,0x42b4 L49: .word 0x37bd,0x3586 L12: .word 0xfdb,0x40c9 L11: .word 0x0,0x0 L10: .word 0x0,0x3f80