Bottom     Contents

Graphics on the

BBC

Microcomputer

Other books published by Prentice-Hal International

BASIC PROGRAMMING ON THE BBC MICROCOMPUTER,

Neil Cryer and Pat Cryer

THE BBC MICROCOMPUTER FOR BEGINNERS,

Seamus Dunn and Valwrie Morgan

100 PROGRAMS FOR THE BBC MICROCOMPUTER,

John Gordon

THE BBC MICROCOMPUTER DISK COMPANION,

Tony Latham

Graphics on the

BBC

Microcomputer

Neil Cryer

Chelsea College, University of London

Pat Cryer

Educational Consultant and Honoary

Research Fellow, University of Surrey

and Andrew Cryer

Prentice/Hall International

ENGLEWOOD CLIFFS, NEW JERSEY LONDON NEW DEHLI RIO DE JANEIRO

SINGAPORE SYDNEY TOKYO TORONTO WELLINGTON

British Library Cataloguing in Publication Data

Cryer, Neil

Graphics on the BBC micro.

1. Computer graphics 2. BBC Microcomputer

I. Title II. Cryer, Pat

III. Cryer, Andrew

001.64'63 T385

ISBN 0-13-363283-0

Library of Congress Cataloging in Publicaton Data

Cryer, Neil

Graphics on the BBC micro.

Includes index.

1. Computer graphics. 2. BBC Microcomputer - Programming

I. Cryer, Pat. II. Cryer Andrew. III. Title: Graphics on the BBC micro.

T385.C78 1983 001.64'43 83-13770

ISBN 0-13-363283-0 (pbk.)

ISBN 0-13-363242-3 (cassette)

© 1983 by Neil Cryer, Pat Cryer and Andrew Cryer

All right reserved. No part of this publication may be reproduced, stored in a

retrieval system, or transmitted, in any form or by any means, electronic,

mechanical, photocopying, recording or otherwise, without the prior

permission of the authors.

ISBN 0-13-363283-0

PRENTICE-HALL INTERNATIONAL INC., London

PRENTICE-HALL OF AUSTRALIA PTY., LTD., Sydney

PRENTICE-HALL CANADA, INC., Toronto

PRENTICE-HALL OF INDIA PRIVATE LIMITED, New Delhi

PRENTICE-HALL OF JAPAN, INC., Tokyo

PRENTICE-HALL OF SOUTHEAST ASIA PTE., LTD., Singapore

PRENTICE-HALL INC., Englewood Cliffs, New Jersey

PRENTICE-HALL DO BRASIL LTDA., Rio de Janeiro

WHITEHALL BOOKS LIMITED, Wellington, New Zealand

Printed in the United Kingdom

10 9 8 7 6 5 4 3 2 1

DIGITALLY REMASTERED ON RISC OS COMPUTERS, DECEMBER 2011.

Contents

Preface xi
0 INTRODUCTION 1
0.0 About this book 1
0.1 The two models of the BBC Microcomputer 3
0.2 Loading, saving and joining programs 4
0.3 Activities 6
0.4 Discussion of activities 7
1 FUNDAMENTALS OF GRAPHICS 8
1.0 Introduction 8
1.1 Display modes of Model B BBC Microcomputer 9
1.2 Graphics on a Model A BBC Microcomputer 11
1.3 Getting into a mode 11
1.4 Addressing pixels 11
1.5 Activities 15
1.6 Drawing lines 19
1.7 Activities 23
1.8 Drawing simple curves 24
1.9 Activities 24
1.10 Discussion of activities 24
2 COLOURING DISPLAYS 25
2.0 Introduction 25
2.1 Available colours 26
2.2 Setting foreground and background colour for text 27
2.3 Activities 27
2.4 Setting foreground and background colours for graphics 28
2.5 Activities 29
3 DRAWING SIMPLE SHAPES 30
3.0 Introduction 30
3.1 Codes for the PLOT statement 32
3.2 Activities 33
3.3 Using the PLOT statement 35
3.4 Activities 38
3.5 Discussion of activities 39
4 PROGRAMMING YOUR OWN CHARACTERS 42
4.0 Introduction 42
4.1 Designing a programmable character 44
4.2 Converting the design to code 45
4.3 Activities 47
4.4 Printing programmable characters 47
4.5 Activities 49
4.6 Composite figures 51
4.7 Activities 54
4.8 Multicoloured characters and figures 55
4.9 Activities 56
4.10 Discussion of activities 58
5 ANIMATING DISPLAYS 60
5.0 Introduction 60
5.1 The redefinable and absolute colour numbers: a summary 61
5.2 Redefining colours 62
5.3 Activities 62
5.4 Animation 63
5.5 Activities 64
5.6 Overlapping images 65
5.7 Logical operations 68
5.8 Activities 70
5.9 Discussion of activities 72
6 DRAWING THREE DIMENSIONAL RIPPLE SURFACES 73
6.0 Introduction 73
6.1 Choosing a function and scaling it 74
6.2 Activities 75
6.3 Drawing the surface 76
6.4 Hidden lines 78
6.5 Activities 80
6.6 Discussion of activities 81
7 ADDING PERSPECTIVE 82
7.0 Introduction 83
7.1 Drawing the object 83
7.2 Giving the object perspective 84
7.3 Rotating the object 84
7.4 The complete program 85
7.5 Activities 90
7.5 Two techniques for hidden line removal 90
7.7 Activities 95
8 EXTENDING BBC BASIC FOR GRAPHICS 98
8.0 Introduction 98
8.1 Our procedures 99
8.2 Procedures for enlarged, rotated writing 100
8.3 Using the procedures for large, rotated writing 101
8.4 Activities 103
8.5 Feeding data into programs 104
8.6 Storing data: arrays 105
8.7 The core procedures 106
8.8 Activities 108
8.9 Discussion of activities 109
9 DRAWING GRAPHS 111
9.0 Introduction 111
9.1 Data calculated by the program 112
9.2 Removal of the cursor from the final display 113
9.3 Activities 113
9.4 Data read from DATA statements 113
9.5 Titles and other labels 115
9.6 Activities 117
9.7 Data taken from the INPUT statement 118
9.8 Forcing the inclusion of the origin 119
9.9 Activities 120
10 GETTING THE BEST STRAIGHT LINE 123
10.0 Introduction 123
10.1 The equation of a straight line 124
10.2 The correlation coefficient 124
10.3 Using PROCbstln 125
10.4 Activities 125
10.5 Setting the accuracy of the equation and the correlation coefficient 127
10.6 Activities 129
11 DISPLAYING SHAPES OF FUNCTIONS 131
11.0 Introduction 131
11.1 Selecting a function for display 134
11.2 Using the function-drawing program 134
11.3 The operation of the program 135
11.4 Activities 139
11.5 Displaying two functions together 139
11.6 Activities 141
11.7 Discussion of activities 142
12 DRAWING HISTOGRAMS 143
12.0 Introduction 143
12.1 Drawing a simple histogram 144
12.2 Activities 144
12.3 Labelling the bars 146
12.4 Activities 148
12.5 Drawing solid-looking histograms 148
12.6 Activities 149
12.7 Drawing two histograms together 150
12.8 Activities 152
13 DRAWING PIE CHARTS 154
13.0 Introduction 154
13.1 Drawing a pie chart 156
13.2 Activities 158
13.3 Storing a pie chart 158
13.4 Activities 160
14 DISPLAYING STATISTICS 161
14.0 Introduction 161
14.1 Some statistical terms 162
14.2 The statistics program 152
14.3 Activities 163
14.4 Superimposing alternative distributions 164
15 USING TELETEXT GRAPHICS 167
15.0 Introduction 167
15.1 Writing in colour 168
15.2 Colouring the background of a single line of text 169
15.3 Flashing text 169
15.4 Making double height characters 170
15.5 Activities 170
15.5 Block graphics 171
15.7 Getting continuity when changing colour 172
15.8 Composite figures 173
15.9 Activities 177
15.10 Using the procedures with Teletext 178
15.11 Error messages with Teletext graphics programming 180
15.12 Activities 182
15.13 Discussion of activities 183
APPENDIX 1 LISTINGS FOR THE PROCEDURES 186
Introduction 186
The listings 188
Adaptations of the listings for Teletext
APPENDIX 2 HOW THE PROCEDURES WORK 200
APPENDIX 3 THE ASCII CODES 224
INDEX 225

Next     Top