//Function Prototype
void DrawCircle(unsigned int xpos, unsigned char ypos, unsigned int R, unsigned int color);
// Routine
void DrawCircle(unsigned int xpos, unsigned char ypos, unsigned int R, unsigned int color){
unsigned int y,x;
signed int p;
x=0;
y=R;
p= -(R/2);
Plot8(xpos,ypos,x,y, color);
while(x<y){
x++;
if(p<0)
p=p+2*x+1;
else{
y--;
p=p+2*(x-y)+1;
}
Plot8(xpos, ypos, x, y, color);
}
}
void Plot8(unsigned char x,unsigned char y,unsigned char dx,unsigned char dy, unsigned int color){
PutPixel(x + dx, y + dy, color);
PutPixel(x + dx, y - dy, color);
PutPixel(x - dx, y + dy, color);
PutPixel(x - dx, y - dy, color);
PutPixel(x + dy, y + dx, color);
PutPixel(x + dy, y - dx, color);
PutPixel(x - dy, y + dx, color);
PutPixel(x - dy, y - dx, color);
}
// example
DrawCircle(63, 32, 20, Red);