http://emsky.net/bbs/read.php?tid=14591
里面有画圆的代码 ;-----------------------------------------------------------------------
;作圆
CircleA:.MACRO x,y,r,type
LDA #x
STA Graph_x1
LDA #y
STA Graph_y1
LDA #r
STA GraphType
int m_CircleA
.ENDM
CircleB:.MACRO x,y,r,type
LDA #x
STA Graph_x1
LDA #y
STA Graph_y1
LDA #r
STA GraphType
int m_CircleB
.ENDM
;-----------------------------------------------------------------------
;作椭圆
EllipseA:.MACRO x,y,a,b,type
LDA #x
STA Graph_x1
LDA #y
STA Graph_y1
LDA #a
STA Graph_a
LDA #b
STA Graph_b
LDA #type
STA GraphType
int m_EllipseA
.ENDM
EllipseB:.MACRO x,y,a,b,type
LDA x
STA Graph_x1
LDA y
STA Graph_y1
LDA a
STA Graph_a
LDA b
STA Graph_b
LDA type
STA GraphType
int m_EllipseB
.ENDM
;----------------------------------------------------------------------- 发出来了. 楼上用的是系统中断,楼主要原生的代码. 记得NC3000上有直接可以用的画圆和椭圆的中断,可以直接调用的. 哦,那就直接反一下中断好了. 谢谢啦。 Eastsun的代码只有circle函数? NC3000.h
晕~我原先竟然没想到!做一个这样的文件对写程序很有用~~
哦……又跑题了!
---------------------------
yan还要ellipse的代码! 引用第9楼POTO于2007-06-25 22:10发表的“”:
NC3000.h
晕~我原先竟然没想到!做一个这样的文件对写程序很有用~~
哦……又跑题了!
---------------------------
yan还要ellipse的代码!
这样写程序才比较有条理,呵呵. 引用第8楼yan于2007-06-25 18:48发表的“”:
Eastsun的代码只有circle函数?
嗯,因为Circle的简单,:-)
当初为了写这些代码还研究了一番基本图形生成算法. ellipse有普适性
[求助]circle和ellipse的汇编代码
本人的汇编太差,写不出来。哪位高手能将以下的代码用汇编写出来,谢谢了。
void cpoint(int xCenter,int yCenter,int x,int y,int type)
{Point(xCenter+x,yCenter+y,type);
Point(xCenter-x,yCenter+y,type);
Point(xCenter+x,yCenter-y,type);
Point(xCenter-x,yCenter-y,type);
Point(xCenter+y,yCenter+x,type);
Point(xCenter-y,yCenter+x,type);
Point(xCenter+y,yCenter-x,type);
Point(xCenter-y,yCenter-x,type);
}
void circle(int xCenter,int yCenter,int radius,int type)
{int x;
int p;
cpoint(xCenter,yCenter,0,radius,type);
x=0;p=1-radius;
while(x++<radius)
{if(p<0)p=p+(x<<1)+1;
else
{radius--;
p=p+((x-radius)<<1)+1;
}
cpoint(xCenter,yCenter,x,radius,type);
}
}
void epoint(int xCenter,int yCenter,int x,int y,int type)
{Point(xCenter+x,yCenter+y,type);
Point(xCenter-x,yCenter+y,type);
Point(xCenter+x,yCenter-y,type);
Point(xCenter-x,yCenter-y,type);
}
void ellispe(int xCenter,int yCenter,int Rx,int Ry,int type)
{int Rx2,Ry2;
int twoRx2,twoRy2;
long p;
int x,y;
long px,py;
x=0;px=0;
Rx2=Rx*Rx;Ry2=Ry*Ry;
twoRx2=Rx2<<1;twoRy2=Ry2<<1;
y=Ry;py=twoRx2*y;
epoint(xCenter,yCenter,x,y,type);
p=Ry2-Rx2*Ry+((Rx2+2)>>2);
while(px<py)
{x++;px=px+twoRy2;
if(p<0)p=p+Ry2+px;
else
{y--;
py=py-twoRx2;
p=p+Ry2+px-py;
}
epoint(xCenter,yCenter,x,y,type);
}
p=Ry2*x*x+Ry2*x+Rx2*(y-1)*(y-1)-Rx2*Ry2+((Ry2+2)>>2);
while(y-->0)
{py=py-twoRx2;
if(p>0)p=p+Rx2-py;
else{x++;px=px+twoRy2;p=p+Rx2-py+px;}
epoint(xCenter,yCenter,x,y,type);
}
}
页:
[1]