#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 / 60;
    if(vga_cnt < 1310) vga_cnt++;
    else vga_cnt = 0;
    IOWR_SET_SPRITE(640-x, 50, 2+half_second, 2, 1, 1);
    //IOWR_SET_SPRITE(x, 200, 22-half_second, 3, 0, 1);
    //IOWR_SET_SPRITE(250, 250, 11, 0, 0, 1);
//    IOWR_SET_SPRITE(x+150, 0, 21, 1, 1, 1);
//    IOWR_SET_SPRITE(x+300, 0, 21, 2, 1, 1);
//    IOWR_SET_SPRITE(x+450, 0, 21, 3, 1, 1);
//    IOWR_SET_SPRITE(x+0, 100, 21, 4, 1, 1);
//    IOWR_SET_SPRITE(x+150, 100, 21, 5, 1, 1);
//    IOWR_SET_SPRITE(x+300, 100, 21, 6, 1, 1);
//    IOWR_SET_SPRITE(x+450, 100, 21, 7, 1, 1);
//    IOWR_SET_SPRITE(x+0, 200, 21, 8, 0, 1);
//    IOWR_SET_SPRITE(x+150, 200, 21, 9, 0, 1);
//    IOWR_SET_SPRITE(x+300, 200, 21, 10, 0, 1);
//    IOWR_SET_SPRITE(x+450, 200, 21, 11, 0, 1);
//    IOWR_SET_SPRITE(x+0, 300, 21, 12, 0, 1);
//    IOWR_SET_SPRITE(x, 300, 12, 13, 0, 1);
    //IOWR_SET_SPRITE(x+300, 300, 21, 14, 0, 1);
    //IOWR_SET_SPRITE(x+450, 300, 21, 15, 0, 1);
}
void sprite_clear_all()
{
    int i;
    for(i = 0; i<16; i++) IOWR_SET_SPRITE( 1023, 1023, 0, i, 0, 0 );
}
