#include <io.h>
#include <system.h>
#include <stdio.h>

#define IOWR_SRAM_DATA(base, offset, data) \
  IOWR_16DIRECT(base, (offset) * 2, data)



int main()
{

    int xCoordinate;
    int yCoordinate;
    int xSpeed;
    int ySpeed;
    int xLowBound;
    int xHighBound;
    int yLowBound;
    int yHighBound;
    int radius;
    int counter=10000;
    printf("software works \n");
    int i=0;

    //IOWR_VGA_SPEED(VGA_BASE, 0x0040);

    xCoordinate = 200;
    yCoordinate = 240;
    xSpeed = 2;
    ySpeed = 2;
    xLowBound = 0;
    xHighBound = 640;
    yLowBound = 0;
    yHighBound = 480;
    radius = 25;

    static int r[2500] ={
    137,132,116,110,108,83,36,5,0,0,0,1,1,4,3,26,104,59,0,8,22,51,20,7,4,46,158,91,6,3,7,6,6,6,0,0,8,22,65,109,129,132,126,133,138,137,149,166,171,193,
    125,116,126,110,101,33,0,1,2,4,3,13,10,5,14,10,16,15,9,9,12,13,16,10,15,25,29,20,14,8,15,9,8,7,0,5,12,13,45,86,116,108,108,116,120,119,131,155,168,188,
    127,127,114,86,46,6,0,0,2,5,4,7,11,13,13,20,24,41,46,34,31,27,18,7,10,19,15,11,15,11,10,13,8,3,4,4,7,19,37,73,114,120,127,124,120,132,137,150,163,178,
    135,137,100,69,19,0,6,0,9,5,23,20,29,66,46,72,101,138,136,129,141,131,119,55,57,65,64,19,7,9,12,9,7,3,6,9,4,15,25,75,122,130,129,120,122,134,136,162,173,168,
    156,128,103,69,9,0,0,3,15,63,122,141,167,185,185,189,188,186,189,196,207,189,177,174,191,171,157,152,126,99,72,51,14,0,9,6,7,15,27,52,92,132,124,119,136,144,136,146,165,171,
    158,134,106,71,7,0,15,66,91,166,179,174,193,190,194,187,181,175,178,183,185,166,172,178,166,187,172,191,187,191,175,136,76,28,17,4,5,6,15,19,62,125,135,138,152,147,151,158,162,180,
    151,133,119,53,12,14,106,156,178,192,187,189,174,162,170,179,174,172,162,155,185,177,153,166,163,170,175,166,180,180,174,167,176,151,113,73,6,3,11,25,49,79,124,152,155,159,174,176,164,172,
    157,140,107,44,57,125,173,166,176,178,182,175,149,140,146,101,80,126,116,75,115,133,87,85,113,141,112,138,152,158,157,161,183,177,174,174,144,81,60,28,23,56,121,164,163,156,182,189,175,165,
    149,133,87,55,104,160,172,182,186,172,140,145,112,54,95,108,121,165,161,150,187,179,135,130,145,129,80,70,88,120,114,155,158,186,171,156,171,156,176,135,71,31,99,159,168,187,178,181,189,192,
    153,128,103,101,148,183,161,173,163,126,46,43,91,150,210,220,223,234,236,234,243,238,227,226,231,222,203,181,166,116,65,73,113,162,167,156,178,181,169,164,143,122,145,170,183,188,177,181,190,202,
    146,122,123,138,160,177,168,140,74,33,41,119,195,224,245,242,246,244,247,253,253,251,246,238,238,241,242,236,229,202,164,125,112,116,87,121,137,179,170,154,156,161,172,179,186,180,183,180,189,187,
    126,129,146,159,170,168,122,68,35,61,141,194,206,213,232,233,236,234,235,244,246,242,239,230,230,230,231,229,227,223,212,191,169,122,58,44,110,149,134,174,151,161,188,197,192,174,185,187,191,190,
    140,151,157,159,154,146,72,33,58,120,159,167,156,151,178,192,201,211,217,232,235,230,225,213,207,202,192,184,170,161,155,147,141,122,94,74,68,43,25,70,129,170,185,204,199,174,185,189,184,192,
    159,180,159,163,159,84,17,33,92,117,132,139,136,127,122,130,154,183,201,217,227,221,204,185,172,154,132,110,101,99,112,113,116,108,97,94,85,57,16,18,85,121,175,209,194,177,170,187,196,196,
    155,175,152,153,149,75,5,15,92,132,155,144,110,85,58,44,63,115,174,207,225,219,194,170,155,135,115,96,74,61,72,70,84,110,128,134,138,113,79,42,29,52,120,187,197,185,164,180,189,191,
    164,177,142,128,118,21,0,7,93,164,147,102,98,129,79,27,16,57,133,200,234,230,207,182,157,132,115,94,81,101,104,48,32,42,66,109,136,138,117,92,52,49,113,188,189,186,170,179,188,197,
    159,167,146,72,67,18,1,4,67,160,152,174,189,189,159,102,92,125,151,204,239,233,222,191,154,135,144,141,145,171,175,119,99,105,128,125,109,125,128,128,102,78,134,198,185,174,179,182,202,192,
    170,151,132,55,19,0,2,5,40,171,195,209,219,216,212,198,189,196,200,218,235,231,211,178,160,179,219,216,204,201,199,195,201,198,193,179,162,163,161,155,130,137,186,189,183,173,182,189,205,198,
    162,133,90,31,2,0,0,3,34,174,208,219,211,204,207,201,207,209,208,219,229,223,200,170,174,204,212,219,213,202,199,201,199,200,196,202,201,193,181,173,163,190,202,195,165,170,175,200,199,201,
    146,116,69,21,0,0,0,4,34,171,210,227,228,228,227,222,219,214,208,222,228,215,191,169,183,220,221,219,221,225,221,222,223,228,229,228,217,204,187,173,180,203,214,199,189,175,179,177,205,188,
    137,109,91,66,36,13,7,7,41,167,207,225,231,234,235,231,222,216,206,225,226,211,188,174,191,212,223,222,232,233,234,232,229,230,234,232,221,199,180,173,194,212,214,200,199,189,189,181,184,197,
    135,122,117,111,90,70,50,48,83,180,214,231,234,237,237,228,223,213,210,229,227,208,186,181,204,213,217,224,230,235,236,234,229,230,236,236,224,202,176,165,182,209,219,203,194,192,189,190,190,186,
    142,129,129,126,110,115,87,89,145,203,223,233,237,239,237,234,225,213,217,229,223,202,190,184,209,223,224,232,236,239,240,238,237,239,243,242,232,212,184,156,159,191,203,184,190,196,186,190,193,184,
    145,130,140,142,124,132,114,114,177,217,225,230,234,237,240,235,221,211,227,230,222,202,188,177,196,212,213,228,243,247,245,245,243,243,244,245,237,219,195,162,145,177,196,185,191,190,180,193,197,191,
    138,133,147,161,146,142,136,140,201,225,226,230,232,233,234,225,211,211,232,238,225,201,179,170,190,201,204,208,220,231,236,244,246,244,245,245,238,224,207,176,153,175,202,191,184,182,186,183,193,201,
    137,139,146,162,153,135,149,158,205,219,228,229,226,221,211,200,204,220,237,245,232,207,178,177,212,217,207,193,205,206,205,218,233,238,243,244,240,231,217,183,162,178,198,188,177,180,187,184,192,204,
    156,151,160,162,160,147,154,165,200,216,222,221,211,193,178,189,212,225,235,243,226,202,180,196,218,221,210,178,191,206,199,202,211,225,234,239,239,231,219,190,162,170,196,188,178,172,174,175,182,197,
    155,166,158,163,163,154,157,156,190,205,209,204,186,168,193,215,215,226,236,242,222,194,184,183,174,176,176,157,194,212,218,225,213,206,220,230,230,224,215,186,163,159,176,175,170,157,161,161,176,197,
    161,165,153,159,172,162,158,154,178,195,191,179,160,178,208,214,209,218,228,225,201,172,154,120,97,119,144,171,213,212,219,221,223,199,191,212,217,212,201,180,159,162,176,160,152,144,148,162,172,182,
    170,167,166,170,173,173,166,158,164,173,170,157,154,178,195,203,200,197,189,177,163,133,123,122,141,172,195,205,212,207,213,208,204,196,181,182,189,187,182,167,149,154,175,156,139,128,137,156,161,165,
    188,180,178,181,173,176,174,157,154,154,156,139,150,179,190,199,196,194,173,156,144,128,131,149,179,200,213,211,208,207,212,208,203,198,181,164,164,166,164,159,151,151,165,155,136,120,128,143,149,153,
    202,193,186,176,176,167,166,158,137,145,153,137,164,175,184,191,197,198,198,166,138,131,149,175,199,216,220,219,208,202,203,197,191,187,176,162,153,156,155,153,148,156,158,154,119,114,113,128,146,160,
    210,195,189,172,171,163,167,161,144,142,155,168,172,173,173,179,190,202,211,208,200,192,199,219,236,232,227,217,213,198,189,184,176,164,156,160,149,158,166,161,157,159,162,143,121,117,118,126,139,162,
    200,198,182,173,164,153,164,165,153,136,152,183,181,176,172,154,160,183,200,211,225,238,238,239,235,220,210,203,190,172,156,142,114,87,128,168,159,172,179,163,154,153,152,129,122,122,128,124,129,155,
    194,189,187,177,167,154,154,157,148,125,137,173,193,191,192,163,110,92,144,178,185,199,204,197,186,175,171,161,175,141,125,88,73,109,178,199,187,199,188,158,147,157,150,116,114,123,126,133,128,141,
    189,177,181,185,165,160,152,160,144,110,106,152,194,210,221,213,184,112,138,202,191,195,179,195,198,190,216,205,212,156,115,95,151,202,213,217,209,208,176,134,126,148,143,126,118,122,123,133,147,163,
    172,177,178,187,176,161,149,148,131,101,87,137,175,214,224,222,217,179,150,215,240,249,235,241,253,246,232,194,168,110,130,173,195,210,217,216,211,197,155,114,114,132,136,144,132,133,139,138,160,175,
    175,181,181,178,173,165,149,137,124,95,59,75,144,198,217,223,218,201,170,146,185,227,234,225,220,195,174,167,169,171,190,195,200,207,215,218,205,181,129,92,98,112,134,137,157,151,148,150,166,179,
    179,181,184,174,171,167,147,129,119,87,47,29,99,167,202,216,222,204,197,187,184,187,172,161,171,187,200,200,206,210,201,198,208,210,211,211,194,154,101,80,90,100,118,141,164,174,167,169,169,197,
    184,180,186,183,181,173,152,127,104,70,37,22,43,119,175,208,209,215,196,199,210,216,217,222,231,232,220,217,213,203,202,206,211,211,213,203,185,136,88,83,84,91,128,145,166,160,159,166,174,202,
    184,181,182,188,189,186,152,131,105,57,35,19,20,64,139,192,209,213,206,212,207,206,208,211,209,209,213,217,213,205,204,211,210,214,207,187,160,120,94,84,80,100,133,160,160,155,166,175,184,212,
    193,191,174,187,178,184,153,121,75,51,36,21,22,19,92,167,203,210,217,218,222,226,220,210,214,220,222,220,211,206,213,211,209,207,192,171,143,106,87,76,78,100,155,157,150,161,175,189,196,212,
    191,192,179,189,174,174,152,120,77,63,50,31,38,23,48,132,191,208,216,216,215,214,213,212,213,215,220,221,215,211,213,212,209,199,174,157,122,94,77,61,78,112,145,155,159,156,173,198,209,219,
    199,199,193,195,183,173,138,115,78,48,59,51,31,22,20,90,179,205,221,219,219,219,220,223,220,225,232,233,223,216,216,215,208,185,162,140,107,72,46,48,87,107,118,154,168,172,183,196,202,213,
    240,240,229,212,187,177,156,127,73,48,53,48,43,12,17,49,148,201,221,228,227,229,229,233,233,236,242,240,228,215,217,213,195,170,141,114,78,46,36,52,88,103,124,139,152,172,180,189,195,218,
    227,232,235,227,222,203,192,143,83,48,45,37,45,39,23,50,116,191,224,235,228,233,235,234,238,244,248,242,226,213,216,205,181,155,123,87,53,24,22,39,74,105,129,142,172,178,186,200,200,214,
    233,233,234,231,225,215,204,181,107,72,56,46,44,34,29,31,65,163,219,232,230,235,232,232,232,236,241,241,229,211,198,175,154,131,89,50,25,10,13,47,91,115,132,147,170,163,183,194,203,223,
    222,233,234,235,236,239,234,216,184,106,65,55,44,43,36,17,46,121,197,224,226,230,233,235,232,227,229,229,218,195,175,151,124,89,41,16,22,17,38,62,97,121,133,154,168,173,188,197,213,216,
    195,217,219,227,233,230,238,232,225,205,117,50,51,63,51,26,33,77,158,204,216,228,230,235,230,225,216,213,202,174,148,123,88,39,10,18,22,20,46,66,106,122,133,157,159,178,188,202,215,202,
    133,159,182,196,203,207,232,239,236,228,209,156,66,52,33,23,17,47,82,149,188,204,211,212,211,208,197,185,165,135,103,70,34,11,24,38,35,39,42,73,106,132,146,161,161,175,188,207,204,193
    };


    static int g[2500] ={
    140,135,119,112,110,84,38,7,2,5,8,12,19,22,19,41,118,76,16,24,35,64,32,22,21,63,174,107,23,21,25,24,19,17,9,7,14,27,68,111,130,134,128,136,138,138,149,166,173,195
    ,128,119,129,112,103,34,1,3,6,9,13,24,25,23,30,25,32,31,25,25,27,28,31,26,32,41,44,37,31,24,33,24,23,21,10,13,21,19,48,88,119,110,110,119,120,120,131,155,171,190
    ,132,132,118,90,48,7,1,4,8,13,14,18,26,28,27,34,38,57,60,50,47,45,36,25,26,33,31,27,29,25,25,28,23,17,15,14,17,28,42,76,118,123,129,127,120,133,137,150,166,181
    ,140,142,104,73,20,2,8,4,17,15,34,34,43,80,57,83,115,152,147,143,157,149,137,71,71,79,78,33,18,21,26,24,22,18,17,21,16,26,31,80,126,134,132,122,122,134,136,162,176,171
    ,161,133,107,72,12,1,2,9,25,74,133,155,181,197,195,198,197,195,198,207,220,202,189,186,202,182,166,161,136,111,86,67,30,16,20,18,19,27,37,58,98,136,128,122,138,144,136,146,165,171
    ,163,138,110,74,10,4,21,75,101,178,191,186,205,201,200,192,186,180,183,188,190,173,177,185,173,194,179,198,198,203,190,151,91,43,29,16,17,18,25,28,68,129,139,141,154,147,151,158,161,179
    ,154,137,123,59,17,20,115,166,190,204,199,200,185,172,175,182,175,173,163,155,182,174,148,163,164,173,182,176,193,193,186,179,186,162,124,84,17,14,22,34,56,85,128,155,157,158,173,174,163,171
    ,158,143,111,50,62,131,184,178,188,189,192,182,154,143,146,99,76,120,109,68,106,122,77,76,106,137,112,141,160,166,165,169,191,184,184,183,153,90,71,37,33,64,127,168,166,158,181,186,174,164
    ,148,134,89,58,109,167,182,193,197,181,145,146,109,48,83,95,105,149,145,136,174,166,121,116,128,112,68,60,80,116,114,158,164,193,178,166,181,167,186,145,81,38,107,165,171,188,177,180,188,191
    ,152,130,106,105,154,190,171,183,170,131,43,36,81,136,191,199,202,213,214,216,229,224,209,206,207,198,181,162,147,103,57,70,111,164,168,161,185,191,179,174,153,129,153,176,186,189,176,180,189,201
    ,148,124,126,142,168,187,175,145,77,31,31,106,178,205,222,216,220,220,225,233,236,233,224,214,210,211,212,208,201,179,147,110,99,107,81,119,140,186,177,164,163,168,178,182,189,182,182,179,191,189
    ,128,131,149,163,178,178,129,70,32,53,125,176,185,190,209,207,210,210,211,222,228,222,216,202,198,198,198,197,198,196,190,170,151,107,46,38,110,152,141,181,158,166,191,201,193,176,184,186,192,191
    ,143,153,160,163,162,153,77,34,54,108,143,147,134,130,157,171,180,188,194,210,213,209,200,186,176,170,161,153,143,137,131,125,119,104,81,66,64,44,30,75,134,175,188,208,200,176,184,188,185,193
    ,161,184,162,167,165,91,22,34,86,104,114,117,116,109,105,114,137,161,178,194,204,199,177,157,142,124,101,84,76,77,92,92,95,90,81,82,75,50,13,18,86,124,178,211,195,179,169,186,197,197
    ,159,179,155,157,155,80,7,14,85,119,137,124,93,72,46,32,49,97,151,182,200,192,166,142,124,107,88,71,51,42,56,57,71,94,112,118,121,96,63,30,25,52,122,189,198,184,166,182,190,192
    ,168,180,145,130,121,26,1,6,85,151,126,82,81,116,69,17,2,39,110,173,207,202,176,151,129,105,88,71,59,83,90,36,20,29,47,88,113,113,92,73,45,47,113,188,190,188,172,181,189,198
    ,161,169,149,74,70,20,1,3,59,147,131,152,170,173,145,87,78,107,125,175,208,202,189,160,126,108,116,118,123,153,161,107,86,88,105,98,81,97,100,106,91,75,132,199,186,175,181,184,204,191
    ,172,154,135,57,21,2,2,1,32,155,174,187,198,197,194,180,169,174,173,187,202,198,179,145,129,150,191,190,180,179,183,179,184,177,165,147,130,131,130,129,115,130,184,190,184,174,185,191,204,197
    ,165,136,92,34,3,0,0,2,26,158,186,194,189,181,184,178,181,182,180,188,197,191,165,138,143,176,185,191,187,179,178,180,177,172,161,164,164,156,147,146,146,181,199,193,166,171,176,201,197,200
    ,149,119,71,24,1,0,0,0,24,154,188,201,201,201,200,194,191,183,177,190,196,183,157,137,153,189,192,192,193,197,198,196,196,196,193,188,175,165,152,146,162,195,208,198,190,176,180,178,203,186
    ,139,112,94,68,39,14,8,2,27,149,182,199,205,208,207,200,191,184,174,191,191,177,156,142,161,181,195,194,203,206,207,205,200,197,198,194,181,162,145,146,176,204,208,198,200,192,190,182,185,198
    ,137,124,118,114,92,72,50,42,67,158,188,203,208,211,209,197,192,181,178,194,193,174,154,149,172,182,189,196,201,208,209,207,200,199,201,200,186,165,142,138,164,201,216,204,196,195,190,192,191,187
    ,144,131,131,127,113,116,83,80,128,178,195,205,210,212,210,206,197,182,185,197,191,170,156,152,177,192,196,205,209,212,212,212,211,213,215,211,196,176,150,129,141,183,200,184,192,199,188,189,195,186
    ,147,132,139,141,125,131,108,101,156,191,194,199,206,210,212,207,193,183,196,199,190,170,154,145,164,181,185,201,216,220,219,222,221,220,217,214,202,183,161,135,127,166,193,186,193,193,182,192,199,193
    ,140,135,147,160,145,139,127,124,176,194,194,195,202,205,203,197,183,184,205,211,194,170,147,138,158,171,176,181,192,204,213,223,225,221,218,213,202,186,170,145,131,163,197,192,185,184,185,182,192,200
    ,139,141,146,161,152,130,137,141,180,189,193,194,194,189,180,172,177,195,214,222,203,176,148,147,182,189,179,167,177,179,179,195,212,216,212,209,199,189,177,149,138,164,191,187,179,182,186,183,191,203
    ,156,151,160,161,157,142,142,148,175,186,187,185,177,159,146,161,187,202,216,222,199,174,152,168,190,193,182,150,165,179,172,175,186,198,199,201,194,184,174,153,136,154,188,186,177,174,173,174,184,199
    ,154,166,158,162,162,149,148,141,168,177,175,168,150,134,161,187,190,203,217,221,197,166,156,155,148,150,148,129,168,186,190,197,186,178,185,189,183,177,169,149,135,141,168,173,169,159,161,161,178,199
    ,160,164,152,158,171,159,151,138,156,167,157,143,124,144,176,183,182,193,207,204,176,146,126,92,70,92,116,143,185,184,191,193,196,171,159,174,175,170,159,144,133,144,165,155,151,146,148,162,175,185
    ,169,166,165,169,174,171,160,147,146,149,140,123,118,144,163,172,172,170,167,155,139,107,97,96,113,144,167,177,184,179,185,181,179,170,151,148,151,150,146,135,124,137,163,151,138,130,137,156,164,168
    ,185,177,177,180,174,177,171,152,143,138,132,109,116,145,158,168,168,166,145,130,118,104,107,125,153,174,187,185,182,181,185,183,178,173,155,134,132,132,132,131,130,135,156,152,135,122,131,146,149,153
    ,199,190,185,175,177,168,165,155,130,133,133,111,134,143,152,160,168,170,167,138,110,105,123,150,174,191,193,192,182,176,176,172,166,162,150,134,123,125,125,127,130,143,151,151,118,116,116,131,146,160
    ,207,192,188,171,172,166,168,160,139,131,137,144,145,141,141,148,161,173,180,177,169,161,171,192,211,207,200,190,185,170,161,157,150,138,129,132,119,127,136,135,139,148,155,140,123,121,122,129,139,161
    ,197,195,181,172,165,156,165,164,150,129,136,161,155,146,140,123,131,156,169,180,192,205,206,210,208,194,183,176,159,141,125,113,87,60,99,140,128,141,149,139,137,142,145,126,124,126,132,127,129,154
    ,191,186,186,176,169,155,155,158,146,119,122,153,167,161,160,132,81,65,112,146,152,165,172,167,158,147,143,134,144,110,94,56,41,80,147,167,153,165,158,134,130,149,145,114,116,125,128,136,128,140
    ,186,174,180,184,167,162,153,161,145,107,95,134,170,182,189,180,153,80,104,168,159,167,152,171,174,167,190,177,183,124,82,62,117,169,180,182,175,174,146,112,111,141,138,124,118,125,126,133,147,162
    ,171,176,177,186,178,163,150,149,131,99,80,122,153,186,192,187,181,143,112,181,217,233,222,227,237,228,210,168,140,78,94,137,159,174,182,181,177,165,127,93,103,127,133,142,130,133,139,138,160,175
    ,174,181,181,178,173,167,150,139,126,95,55,66,127,173,184,188,181,163,130,110,159,208,218,209,200,171,148,137,135,135,152,158,162,171,178,183,171,151,104,74,89,109,131,135,156,150,149,150,166,179
    ,179,181,182,172,171,169,148,131,122,90,50,26,87,146,174,183,187,167,158,148,146,151,135,127,134,149,160,157,159,166,159,161,172,177,176,179,163,127,79,65,83,97,115,140,162,173,166,168,167,195
    ,184,180,184,181,181,175,153,129,109,77,48,29,39,106,153,180,176,180,159,160,166,172,173,179,188,189,175,173,167,160,163,169,176,179,181,173,155,110,70,71,78,89,127,144,164,159,158,165,172,200
    ,187,184,185,190,191,188,153,133,110,68,54,36,28,61,123,167,180,182,174,177,168,167,168,173,171,173,177,181,180,172,169,176,178,182,177,160,134,100,79,75,77,99,132,160,159,154,165,173,184,211
    ,193,194,176,189,180,186,154,124,84,66,56,42,33,21,80,148,177,183,187,186,187,190,184,176,182,188,193,191,184,178,181,179,177,177,162,145,121,89,75,70,77,102,154,157,149,160,174,187,195,211
    ,185,188,179,188,174,176,155,126,88,79,69,47,49,24,39,116,170,186,190,190,187,187,186,184,187,189,194,195,190,185,182,180,177,169,146,132,104,78,67,58,79,114,145,155,160,156,171,196,208,220
    ,187,188,187,190,178,171,139,121,91,64,75,65,41,27,15,80,163,187,199,195,192,194,197,200,198,204,211,210,198,190,184,183,178,157,136,119,91,63,39,46,88,111,120,154,168,172,183,195,203,214
    ,218,219,212,197,176,171,153,129,83,63,67,62,54,21,19,46,139,186,199,202,199,200,206,212,214,219,223,219,201,187,182,179,163,142,119,97,69,43,36,54,90,106,126,142,152,172,180,191,196,220
    ,198,205,209,206,204,188,181,137,86,58,57,51,59,51,32,53,112,178,202,207,197,202,210,213,220,227,230,220,199,182,184,173,151,130,104,75,49,24,25,45,78,108,131,144,172,178,188,202,203,216
    ,202,205,207,205,200,193,183,166,99,72,65,61,63,53,44,40,65,151,196,203,199,204,205,210,211,215,219,216,201,180,170,149,129,112,77,46,26,15,20,55,98,118,134,149,170,163,185,195,206,225
    ,187,201,203,206,207,210,207,193,168,100,71,68,61,62,52,29,47,112,177,196,197,202,208,213,210,205,204,204,191,168,150,129,106,76,34,17,27,26,48,72,104,124,137,156,167,172,190,198,215,220
    ,157,181,184,194,198,197,207,205,206,196,119,60,64,78,67,38,38,73,144,182,193,203,208,213,208,200,194,191,177,152,130,106,75,31,10,23,31,31,56,74,110,125,136,161,161,177,190,205,219,208
    ,92,121,145,161,166,172,197,210,215,216,210,164,76,65,48,35,24,47,69,131,167,182,191,192,186,183,175,163,143,114,86,57,25,7,27,48,46,52,51,81,110,135,151,164,163,174,189,210,208,199
    };


    static int b[2500] ={
    119,116,102,98,99,76,33,4,3,5,11,14,23,24,18,34,101,60,13,23,28,55,28,17,15,47,147,80,13,21,27,28,25,21,11,6,12,21,59,98,114,113,104,107,110,107,121,138,149,171
    ,107,98,112,98,92,26,0,2,7,12,15,28,28,25,30,20,21,21,24,25,22,23,28,23,26,31,25,18,23,24,35,29,28,24,12,15,18,15,41,77,102,89,86,92,92,89,103,127,144,166
    ,109,110,101,75,37,1,0,3,8,15,16,22,29,31,30,37,39,57,61,50,47,45,36,25,25,33,30,26,29,26,28,33,28,20,17,15,16,25,36,67,103,104,107,100,92,102,109,122,139,154
    ,118,120,87,59,12,0,7,5,19,17,36,35,46,81,61,87,118,155,149,143,157,149,137,71,71,80,81,36,20,21,29,27,25,21,19,21,16,22,29,73,112,117,111,98,94,106,108,136,149,144
    ,141,113,92,61,5,0,1,9,26,76,135,155,182,197,194,195,194,192,195,203,213,195,185,182,198,178,163,158,135,111,86,66,29,15,22,18,19,25,36,54,86,121,111,101,114,118,110,120,141,147
    ,143,121,95,63,3,0,19,74,102,178,189,184,203,197,196,186,179,173,177,182,183,165,171,178,166,187,171,191,194,199,185,146,86,38,29,16,15,16,24,25,58,115,124,122,132,123,127,134,140,158
    ,135,120,108,47,11,16,112,165,188,202,195,194,177,164,168,173,167,165,155,147,175,167,142,156,156,164,174,167,183,183,176,169,178,154,120,80,13,10,18,29,48,75,114,138,136,137,152,153,142,150
    ,140,124,96,38,55,127,180,174,184,185,184,174,147,132,134,86,64,108,99,58,99,116,68,67,96,126,102,130,147,153,152,158,180,176,176,178,148,85,65,32,25,53,115,153,147,137,161,167,153,143
    ,128,116,75,47,102,160,174,187,191,176,139,140,100,36,69,79,89,134,132,125,165,157,110,105,118,102,56,48,67,104,102,147,154,185,171,158,173,159,178,137,72,30,96,151,154,170,157,160,167,170
    ,131,109,89,91,144,182,163,175,163,124,36,26,71,123,176,182,185,196,201,204,218,213,197,195,195,186,168,148,133,87,44,55,99,153,160,154,177,182,171,166,144,121,142,164,169,171,156,160,169,180
    ,124,102,107,127,155,176,168,139,68,19,19,90,162,190,206,201,207,208,212,222,226,223,213,202,198,200,201,194,187,163,129,91,83,92,69,107,131,178,169,155,156,160,168,171,172,161,162,159,170,168
    ,104,107,128,146,163,167,122,65,23,40,109,156,166,172,191,192,197,198,199,211,216,211,202,188,183,183,183,182,180,177,169,149,131,88,30,26,100,145,133,173,151,159,182,187,175,155,164,166,174,173
    ,116,129,139,146,147,145,71,28,43,92,120,123,111,109,138,154,163,174,180,196,199,192,180,165,156,149,140,132,122,113,107,101,96,84,64,53,53,36,23,69,128,168,179,194,182,155,164,168,167,177
    ,137,159,141,150,153,83,16,28,74,87,90,93,92,89,87,98,121,147,162,176,186,178,156,135,118,100,80,61,54,54,68,71,74,70,65,66,63,40,4,10,78,115,167,198,177,158,149,166,179,181
    ,136,156,136,142,145,74,4,9,75,103,113,99,73,55,32,20,38,83,133,160,178,171,144,120,103,85,67,51,33,25,40,41,55,78,96,102,105,80,48,16,13,40,111,176,180,164,145,161,172,174
    ,145,159,128,117,114,20,0,1,74,134,105,58,63,100,57,7,0,27,92,152,186,180,155,130,107,84,71,55,45,69,77,22,6,12,30,69,95,93,72,56,29,34,101,176,172,167,151,160,171,180
    ,140,148,132,61,63,17,1,0,48,130,110,131,153,158,136,80,69,95,110,157,188,182,170,140,105,89,102,104,112,141,148,93,69,70,87,77,60,75,76,83,73,60,120,185,170,157,160,163,183,171
    ,151,135,118,46,16,0,2,0,21,139,153,166,179,182,184,170,158,160,156,169,183,179,158,126,109,132,177,177,170,168,168,163,166,156,144,126,107,106,102,104,96,114,171,176,168,156,166,170,186,177
    ,144,117,78,23,0,0,2,0,15,142,165,172,168,163,168,162,166,165,159,168,176,170,143,115,122,155,168,177,174,165,161,161,156,151,139,141,138,129,119,119,126,164,182,178,148,153,158,183,182,182
    ,128,100,57,13,0,0,0,0,14,138,165,178,180,180,179,173,170,163,156,167,175,160,132,112,129,168,174,175,179,183,180,179,177,175,169,163,150,136,122,119,140,176,192,180,174,158,164,162,188,171
    ,117,91,77,55,30,8,3,0,14,129,160,176,182,185,185,179,170,161,151,166,169,152,131,117,137,160,173,173,185,189,190,188,182,178,176,171,156,135,117,119,154,185,192,183,186,175,172,164,167,180
    ,115,103,100,97,79,61,40,30,51,137,165,181,185,188,187,176,171,158,155,172,168,149,129,124,149,161,167,175,183,191,192,190,184,181,181,178,163,139,114,111,142,182,201,190,182,178,172,171,173,169
    ,123,110,110,109,96,102,71,65,108,156,174,184,189,191,189,185,176,161,164,176,168,147,131,127,154,171,175,186,190,195,200,199,198,196,194,190,172,150,122,102,117,164,185,172,178,182,167,168,174,165
    ,126,110,118,120,107,113,92,84,135,168,173,178,184,189,191,186,172,162,178,179,169,147,129,120,141,160,164,182,197,203,206,208,207,204,198,193,180,159,134,108,103,146,178,172,179,174,161,171,178,172
    ,118,111,123,139,127,122,112,108,156,173,173,173,178,181,182,176,162,165,188,194,174,149,124,113,133,147,154,160,171,185,197,206,208,203,199,192,180,163,144,117,107,139,178,174,167,163,164,161,172,182
    ,115,117,122,140,132,111,121,123,158,165,171,172,169,164,159,150,156,175,198,204,185,155,124,121,156,165,155,144,156,158,162,177,193,195,192,189,179,167,152,122,112,138,172,167,158,160,165,162,171,183
    ,132,127,136,140,138,123,126,130,153,162,165,161,152,134,125,140,167,184,199,205,180,152,128,144,166,169,158,126,142,158,151,156,166,177,180,182,175,164,151,127,111,129,165,165,156,152,152,153,162,177
    ,133,142,134,141,142,130,131,122,145,153,150,144,126,109,140,166,170,185,200,202,177,144,132,131,123,125,124,105,145,163,169,176,165,157,165,171,165,157,146,123,111,117,145,152,148,135,137,137,154,175
    ,140,143,131,137,153,142,135,122,133,143,132,117,100,119,155,162,161,173,186,183,154,123,102,68,43,65,92,119,163,162,170,172,175,149,136,153,153,148,135,118,108,122,147,136,130,122,120,134,148,158
    ,149,146,145,149,156,156,144,129,124,123,114,98,94,119,142,151,151,149,144,132,115,84,72,71,89,120,143,155,162,157,164,160,157,147,127,123,128,124,120,110,102,117,147,132,117,106,109,128,135,141
    ,166,158,157,162,158,161,154,133,121,113,108,85,91,120,137,147,147,145,123,107,95,80,83,101,130,151,164,162,159,158,164,161,156,151,130,108,107,105,107,109,111,119,139,135,115,100,104,117,121,125
    ,180,171,167,157,161,152,147,136,111,111,109,86,108,118,129,140,150,149,146,114,88,82,100,128,152,169,172,171,159,153,155,150,146,142,127,110,95,97,99,104,110,126,133,134,98,94,89,102,118,132
    ,188,173,168,151,154,147,150,142,120,111,113,118,118,116,118,128,143,155,160,156,149,141,150,173,191,187,181,169,163,148,140,138,133,121,108,108,91,99,110,112,119,130,137,123,102,98,97,102,111,133
    ,178,176,161,152,147,137,147,146,133,110,113,137,128,120,117,103,113,137,151,160,175,188,191,194,191,177,166,157,139,121,105,95,70,43,81,118,100,113,123,115,117,124,127,107,103,103,107,100,101,126
    ,172,167,166,156,148,137,137,142,131,103,101,129,142,135,137,112,63,48,97,131,137,153,161,156,146,133,129,117,126,92,76,41,28,64,129,146,126,138,132,110,110,130,125,93,94,101,104,109,100,112
    ,167,155,160,164,146,141,135,145,131,92,77,112,146,158,168,161,135,65,92,156,146,155,141,159,162,153,177,163,167,109,67,47,105,154,163,162,148,147,122,89,92,122,118,103,94,98,99,105,119,134
    ,150,155,156,165,156,142,132,135,119,86,64,103,130,164,171,168,165,129,101,169,203,218,206,214,224,214,196,153,126,63,80,123,145,158,163,159,152,140,105,72,83,108,114,121,105,105,111,110,132,149
    ,153,157,157,154,149,145,134,125,115,85,44,51,107,151,165,169,165,150,118,98,146,194,203,194,189,159,135,126,123,121,139,142,149,155,159,161,144,125,82,54,72,92,112,114,128,120,118,122,140,153
    ,155,157,157,147,145,147,132,118,113,83,43,17,71,125,153,164,168,151,143,133,133,139,126,117,126,140,152,148,149,153,145,143,156,158,154,154,135,100,58,46,67,82,98,119,137,145,138,140,142,170
    ,160,154,159,156,155,153,137,118,102,70,44,22,27,89,132,159,157,161,140,143,153,161,164,172,181,182,169,164,154,144,146,150,157,158,158,147,127,85,50,55,64,74,107,123,139,131,130,137,147,177
    ,160,157,158,166,167,167,137,122,104,64,50,30,17,46,107,147,162,161,151,155,151,152,158,162,160,161,165,167,163,153,149,154,157,159,151,133,109,76,60,58,62,81,111,136,131,124,137,148,160,190
    ,167,167,152,165,158,165,138,113,79,63,54,37,25,10,66,131,160,162,163,163,167,174,170,164,169,175,179,175,163,156,160,156,154,153,138,120,98,69,59,54,59,81,133,131,121,130,146,164,175,193
    ,159,163,155,167,150,154,138,114,82,78,67,44,45,18,30,103,153,165,167,167,166,168,169,170,174,174,179,178,168,162,161,159,154,145,122,110,84,62,55,43,61,92,121,127,129,128,146,175,190,204
    ,163,166,165,168,156,150,121,107,84,61,74,65,40,23,9,70,147,167,176,171,171,174,179,184,184,187,194,192,176,167,163,160,154,133,113,98,75,48,29,34,72,88,96,126,140,144,159,175,187,200
    ,197,200,194,178,154,149,134,115,74,58,67,63,56,20,14,37,124,165,176,179,178,182,188,193,197,201,206,200,180,165,160,154,138,118,96,77,52,28,26,43,76,85,104,115,124,146,156,170,180,206
    ,180,186,192,187,182,167,161,121,75,50,55,52,60,51,29,46,100,161,181,185,177,182,190,194,200,207,210,199,178,161,159,148,127,108,87,59,37,14,16,35,63,89,109,120,146,152,166,181,186,202
    ,182,184,190,188,180,172,162,147,86,62,60,58,61,51,41,35,55,139,180,185,179,184,186,189,190,194,198,196,180,159,146,124,107,95,63,35,18,8,13,44,82,97,112,125,146,139,163,177,189,211
    ,167,180,185,188,189,192,186,175,153,88,61,61,55,58,49,25,41,103,166,182,179,181,188,192,187,182,184,184,170,147,128,106,86,60,24,11,21,21,40,61,88,103,114,132,146,151,169,180,201,205
    ,136,159,165,175,179,178,187,186,191,181,106,49,55,73,64,34,32,64,133,168,175,181,185,190,187,180,171,168,157,131,110,88,59,18,2,17,26,25,48,63,95,106,115,138,140,157,169,186,204,194
    ,70,100,126,142,148,153,178,192,198,200,196,151,67,58,45,33,17,39,60,117,148,159,167,168,166,163,152,140,122,93,68,40,10,0,20,40,42,45,46,70,95,116,129,143,142,154,171,193,193,185
    };

    for(i=0;i<2500;i++){
    	IOWR_SRAM_DATA(VGA_BASE, i, r[i]);
    	IOWR_SRAM_DATA(VGA_BASE, i+2500, g[i]);
    	IOWR_SRAM_DATA(VGA_BASE, i+5000, b[i]);
    }

    for(;;){
    	counter--;
    	if (counter ==0)
    	{
    		counter=10000;

        if(xCoordinate - xLowBound <= radius){
            ySpeed = - ySpeed;
        }
        if(xHighBound - xCoordinate <= radius){
            ySpeed = - ySpeed;
        }
        if(yCoordinate - yLowBound <= radius){
            xSpeed = - xSpeed;
        }
        if(yHighBound - yCoordinate <= radius){
            xSpeed = - xSpeed;
        }

        xCoordinate = xCoordinate + ySpeed;
        yCoordinate = yCoordinate + xSpeed;

        IOWR_SRAM_DATA(VGA_BASE, 7501, xCoordinate);
        IOWR_SRAM_DATA(VGA_BASE, 7502, yCoordinate);
    	}
    }


    return 0;
}
