#include <io.h>
#include <system.h>
#include <stdio.h>
#include "vga_update.h"
//------------------------------------------------
extern int x, y;

int vga_cnt = 0;
//------------------------------------------------
void sprite_refresh()
{
    IOWR_END_IRQ();
    sprite_clear_all();
    int half_second;
    half_second = vga_cnt / 20;
    if(vga_cnt < 439) vga_cnt++;
    else vga_cnt = 0;
    //IOWR_SET_SPRITE(0, 250, 2+half_second, 2, 0, 1);
    IOWR_SET_SPRITE(x+ 50,  10, 22-half_second, 0, 0, 1);
    IOWR_SET_SPRITE(x+ 150, 10, 2 +half_second, 1, 1, 1);
    IOWR_SET_SPRITE(x+ 250, 10, 22-half_second, 2, 0, 1);
    IOWR_SET_SPRITE(x+ 350, 10, 2 +half_second, 3, 1, 1);
    IOWR_SET_SPRITE(x+ 450, 10, 22-half_second, 4, 0, 1);
    IOWR_SET_SPRITE(x+ 550, 10, 2 +half_second, 5, 1, 1);

}
void sprite_clear_all()
{
    int i;
    for(i = 0; i<16; i++) IOWR_SET_SPRITE( 1023, 1023, 0, i, 0, 0 );
}
