wapopla.blogg.se

Sinclair Basic
sinclair basic




















The program repeatedly draws boxes of variable height until the data statement containing zero is reached, whereupon the routine terminates. The program draws a barchart using the data in the data statements in lines 100-160. The short routine called Ellipse Angle Values (Figure 9.7) shows what values are returned by the formula called angle between 0 and 90 in whole degree steps.This program shows one application for a routine to draw a variable sized rectangle. The value returned by 0 would be a truly infinite number exceeding the Spectrum’s numeric capacity which is limited to a range from 310 -39 to 710 38.

sinclair basic

Instead of just drawing a border around the screen, this routine will draw a border or box of any size and at any location on the screen. The second pair of values are the height and width of the rectangle.160 – input X and Y coordinates of rectangle centre190 – input height and width of rectangle340-370 – convert centre coordinates to bottom left corner coordinatesThis routine is a natural extension of the program Border. Using the coordinates of the centre of a displayed shape is the conventional method of positioning a shape on the screen.This program requires the input of two pairs of parameters, the first pair are the X and Y coordinates of the centre of the rectangle. The two programs are virtually identical except for the addition of lines 310 to 370 which simply convert the centre coordinates to the bottom left coordinates. The second pair of values are the X and Y coordinates of the top right corner of the rectangle.120 – draw border around screen using subroutine at 500160 – input X and Y coordinates of bottom left corner190 – input X and Y coordinates of top right corner230-300 – check that the rectangle lies within the limits of screenThis is a variation of the program Rectangle 1, the difference is that it is the coordinates of the centre of the box which are input rather than the bottom left coordinates. It should be noted, however, that like the previous two rectangle drawing routines this program will only draw a rectangle with sides parallel to the X and Y axis.This program requires the input of two pairs of parameters, the first pair are the X and Y coordinates of the bottom left corner.

...sinclair basicsinclair basicsinclair basic