unsigned short r256table[256]; unsigned char r256index; void r256init() { int i,j,msb; j=42424; for(i=0;i<256;i++){ r256table[i]=(unsigned short)(j=j*65539); } msb=0x8000; j=0; for(i=0;i<16;i++) { j=i*5+3; r256table[j]|=msb; r256table[j+1]&=~msb; msb>>=1; } } unsigned short r256() { int r; r=r256table[(r256index+103)&255]^r256table[r256index]; r256table[r256index++]=r; return r; } void AgbMain(){ r256init(); *(unsigned short*)0x4000000=0x403; *(unsigned short*)0x4000004=0; int x=120,y=80,c=0,oc; for(oc=0;oc<240*160;oc++) ((unsigned short*)0x6000000)[oc]=0x7FFF; unsigned short color; while(1) { oc=c; c=(r256()*3)>>16; switch(c) { case 0: x=(x>>1);y=(y>>1)+80; break; case 1: x=(x>>1)+120;y=(y>>1)+80; break; case 2: x=(x>>1)+60;y=(y>>1); break; } switch(c*3+oc) { case 0: color=0x001F; break; case 1: color=0x02BF; break; case 2: color=0x541F; break; case 3: color=0x03F5; break; case 4: color=0x03E0; break; case 5: color=0x57E0; break; case 6: color=0x7C15; break; case 7: color=0x7EA0; break; case 8: color=0x7C00; break; } ((unsigned short*)0x6000000)[y*240+x]=color; } }