//this example shows how to set up a palette and use 8x8 HW sprites //also shows how fast (or slow) C code is #include "neslib.h" //#link "tileset1.c" // palette for balls, there are four sets for different ball colors extern unsigned char palSprites[16]; // tile set, two planes for 4 colors extern unsigned char TILESET[8*256]; //general purpose vars static unsigned char i,j; static unsigned char spr; //total number of balls on the screen //since there are 64 HW sprites, it is absolute max #define BALLS_MAX 64 //balls parameters static unsigned char ball_x[BALLS_MAX]; static unsigned char ball_y[BALLS_MAX]; static unsigned char ball_dx[BALLS_MAX]; static unsigned char ball_dy[BALLS_MAX]; void main(void) { //copy tileset to RAM vram_adr(0x0); vram_write((unsigned char*)TILESET, sizeof(TILESET)); pal_spr(palSprites);//set palette for sprites oam_size(1); ppu_on_all();//enable rendering //initialize balls parameters for(i=0;i=(256-8)) ball_dx[i]=-ball_dx[i]; if(ball_y[i]>=(240-8)) ball_dy[i]=-ball_dy[i]; } } }