Histograms
M Furby,
Walton on Thames,
Surrey
Robert Newman's excellent machine-code animation routine in
April /Your Computer/ - including the amendment published
in the May issue - has uses beyond purely games applica-
tions. This subroutine uses it to produce 3D block histo-
grams like those used in /The Money Programme/, a BBC
television programme. It is not a complete program in
itself, and requires the following parameters to be passed
from your main program to run it.
I(N)..... an array of values to be graphically depicted
N........ the number of items in the array
M........ the maximum value
A........ the required location of the base line of the
histogram
The Poke and Usr address are for the 48K Spectrum, and you
will need to change them to those in April /Your Computer/
if you have a 16K machine. [In short: subtract 32770 (no,
not 32768) from each address.]
The subroutine will produce a histogram of any number of
values, although a practical maximum for clarity is 26.
Different values of A, between 0 and 165, will place the
base line in a suitable position on the screen to allow for
any text you wish to include.
If you wish to show, say, values between 1 and 10, then
the routine will draw the block for 10 right to the top of
the screen. By giving a false value for M of 20, the blocks
will be compressed to give clear space above for further
text, so M can be thought of as a magnification factor.