📄 bitrev.c
字号:
#include<math.h>
#define N 16
int x[N] = { 0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15 };
int y[N] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
/* int bitrev(int m, int n); */
void main()
{
int i;
asm(" PUSH AR5");
asm(" PUSH AR0");
asm(" LDI 8,IR0 ; initialize ir0 to 1/2 n");
asm(" LDI @CONST+0,AR5 ;AR5<-address of x[] ");
asm(" LDI @CONST+1,AR0 ;AR0<-address of y[] ");
for ( i=0; i<N; i++ )
{
/* y[bitrev(i,N) ] = x[i]; */
asm(" LDI *AR5++(ir0)b, R0");
asm(" STI R0,*AR0++");
}
asm(" pop ar0");
asm(" pop ar5");
}
/* These statements place x and y in .bss and make
their addresses available via the CONST table. */
asm(" .bss CONST,2 ");
asm(" .sect \".cinit\" ");
asm(" .word 2,CONST ");
asm(" .word _x ");
asm(" .word _y ");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -