THE CPC464 has a few rather simple graphics commands which Amstrad greatly improved when they brought out the CPC664 and 6128. However there is still one command they might have included — a circle routine. Now you can draw circles with ease on any CPC with the program presented here. When run it sets up a new RSX called, as you've probably guessed, CIRCLE. It requires three parameters. The first is the X radius, the second the Y radius and lastly the pen to draw it in. It's actually a bit more powerful than a simple circle routine since both X and Y are given. If X and Y are the same you'll get a circle. However if they are different you'll get an ellipse. To use it MOVE to wherever you want the centre to be and |CIRCLE,rx,ry,pen will draw the circle or ellipse. For instance, to draw a circle in the centre of the screen simply enter: MOVE 320,200 |CIRCLE,100,100,2Due to the poor pixel resolution in Mode 0 you won't get perfect circles if the radius is very small. The most accurate is the hi-res Mode 2. The usual method of drawing circles is used where x=radius*COS(angle) and y=radius*SIN(angle) with angle running from 0 to 360. Since SIN and COS are very difficult in machine code I've cheated and used a sly trick to avoid them. At the end of the code are two tables - one of all the SIN values and one of all the COS values that are required multiplied by 64. So SIN(20) instead of being 0.342020143 becomes 22, or near enough as makes no difference. Negative numbers are marked by having bit 7 set. The circle routine uses integer maths only and ends up with coordinates that are 64 times too big. It's a simple matter to divide by 64 to obtain the correct coordinates when the points are actually plotted. CWTA ★ AMSTRAD CPC ★ DOWNLOAD ★ |
|
CPCrulez[Content Management System] v8.7-desktop/c Page créée en 716 millisecondes et consultée 1991 foisL'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko. |
|
|