”Starting Basic• ~ Synopsis of the Book

(by Ray Favre)

     !!! 1st Revision March 2003 !!!

To Ray Favre's Welcome page.               



To download sample chapter (in Impression format).          To Book introductory page.





Introduction

Objective - Assumptions - Book sequence -Printing conventions.

1. First steps

What a computer program is - The nature of Basic instructions, program lines and line numbering - Getting the computer ready for Basic - Command Line and Task Window - Basic Immediate Mode - Amending, listing and saving programs from command line/Task Window - Using !Edit for programming.

2. The Tutorial project

Definition of project aims - Outline planning of program.

3.Variables

What are variables - Demonstration of use in initial Loan program - Declaring variables and assigning values to them - The three variable types: integer number, real number and string - Null strings - Using them in programs - Incrementing numeric values - Variable names.

4. Keywords

The verbs‘ of Basic sentences‘ - Getting a list of keywords and their syntax‘ from computer - Keywords and variable names - Keywords LET, REM, PRINT and TAB( introduced and demonstrated in detail - Print modifiers‘ - Parameters and arguments - Keyword ERROR introduced - Use of ON ERROR in simple error traps‘ - Common error messages.

5. Procedures and Functions

What they are - Two main uses - DEF PROC/FN described with examples - Where DEFs are placed in program listings - Calling PROC/FNs demonstrated - PROC/FN names - Formal parameters and passing parameters demonstrated - PROC/FN as structural aids - Empty PROCs - Upgrading Loan program with PROC structure - Initial brief introduction to Screen modes, colours, menu formatting and pausing a program - First use of upgrade listing for Loan program.

6. The REPEAT and WHILE control loops

User selection from screen menu - Control loops introduced - REPEAT ... UNTIL and WHILE ... ENDWHILE loops explained in detail and compared - Exit and entry conditions - First use of TRUE/FALSE - Nested loops - Keywords INSTR(, CHR$, ASC, GET and GET$ introduced and incorporated into Loan program - Forcing a valid keypress - Masking to upper/lower case - INKEY and INKEY$ briefly introduced as alternative to GET/GET$.

7. Making an INPUT and the IF ... THEN construction

User entry of values with keyword INPUT - INPUT introduced in detail - IF ... THEN ... ELSE ... ENDIF construction introduced in detail (with and without use of ENDIF) - Incorporated into Loan program update - Input validation, with first example used in Loan program.

8. Branching with CASE ... OF ... WHEN

CASE ... OF ... WHEN ... OTHERWISE ... ENDCASE construction introduced in detail with several examples - Incorporated into Loan program upgrade.

9. The FOR ... NEXT loop

FOR ... TO ... NEXT ... STEP construction introduced in detail and incorporated into Loan program upgrade.

10. String manipulation

Keyword STR$ - Adding‘ strings - Keywords LEFT$(, RIGHT$(, MID$( and LEN introduced and demonstrated - Keyword STRING$( - Loan program upgraded.

11. Arithmetic and logical operators and built­in mathematical functions

Operator priority - Use of brackets to control calculation order - DIV and MOD - Most popular built-in math/trig functions - Use of RND.

12. Introducing graphics

Graphics play area‘ - OS units - standard non-Wimp screen - Pixels - Screen resolution - Preparing screen for graphics plotting - Keywords MOVE, DRAW and BY introduced and demonstrated - Effect of screen resolution on pixel/dot size - RECTANGLE, CIRCLE, ELLIPSE and FILL demonstrated - POINT - Graphics grid.

13. More graphics

Keyword PLOT introduced - Plot code block/offset principle, with examples - Introduce graphics to Loan program - graph drawing.

14. Text and graphics viewports and the use of VDU 5

Separate text and grapics viewports - Use of VDU 5 for text in graphic viewport - Detailed comparison of VDU 4 and VDU 5 text operations with demonstration - Defining text/graphics viewports with VDU 24 and VDU 28 - Incorporation into Loan program upgrade - Solving calculations by successive approximation - More graph plotting.

15. Final steps in Loan project

Multiple graph plotting/scaling - PROC structure and input validation revisited - ratcheting‘ values - Revisiting PROC/FN to introduce local/global variables - Keyword LOCAL - Importance of free-standing PROC/FNs - Repeating a program Final version of Loan program - Suggested areas for its further development.

16. VDU commands

Detailed introduction of VDU commands, concentrating on VDU control codes - Keyboard equivalents.

17. Data storage/retrieval (READ, DATA and RESTORE)

Permanent and temporary storage - Use of READ, DATA and RESTORE - Data pointer.

18. Data storage/retrieval (Arrays and the keyword DIM)

Using DIM to create arrays - Single and multi-dimensions - Subscripts - Comparison with variables - Demonstration using same data as previous chapter for comparison - Reason for declaring arrays early in program - Scope of operations on whole arrays.

19. Data storage/retrieval (Data files)

Basic data files in detail - OPENOUT, OPENUP and OPENIN explained - Lost‘ files - Keywords CLOSE#, PRINT# and INPUT# - Data file pointer - Common error messages - Trapping open files in error trap - Pointer manipulation - Data file structure - Keywords PTR#, EXT# and EOF# - File dumps - Format of stored data items demonstrated - Basic V/VI differences - Data type identifiers - keeping track of pointer.

20. Data storage/retrieval (Direct memory access/indirection)

DIM revisited - Reserving blocks of memory - Indirection operators - Entering and retrieving data.

21. Colour

Non-Wimp colour - Number of colours available - Colour numbers - Default palettes in 2-, 4- and 16-colour modes - Changing palettes in these modes - Keywords COLOUR, GCOL, CLS and CLG - Demostration of colour control/choices - 256-colour modes and TINT - Brief introduction of GCOL with two parameters - AND, OR, EOR and NOT with colours - Demonstration - Keyword POINT( - TINT revisited.

22. Libraries

Importance of libraries to Wimp programming - Keywords LIBRARY, INSTALL and OVERLAY introduced and compared - Building a library, with example.

23. Using the Operating System (SYS calls)

Access to Operating System - Keyword SYS - Detailed examination of SYS call structure - SWIs - Use of commas to avoid ambiguity of input/output parameters - Parameter blocks.

24. The nature of Wimp programming

Wimp and non-Wimp compared - The Wimp - Interaction between application program and Wimp - Wimp Poll - Reason codes - Structure of Wimp program - Example of possible Window for Wimp version of Loan program - Wimp programming tools.


Appendix 1. Current Directory‘

Appendix 2. Variable names

Appendix 3. TRUE and FALSE

Appendix 4. Table of ASCII codes

Appendix 5. Hex and Binary numbers

Appendix 6. The operators AND, OR, EOR, NOT, <<, >>, and >>>

Appendix 7. Declaring string variables

Appendix 8. Memory and the storage of numbers

Appendix 9. VDU control codes‘

Appendix 10. Operations on whole arrays

Appendix 11. Supplementary notes on Tutorial program formulae

Index


Price, including UK post and packing, is £16-00 (book-plus-disc). (Only cash or sterling cheques can be accepted.)

All excess of income over costs will go to charity.



If you want a copy of the book please contact me by Email in the first instance at:
ray at rayfavre dot me dot uk (Sorry about this 'non-live' address. It's an attempt to reduce spam.)


To download sample chapter (in Impression format).          To Book introductory page.          To Welcome page.




© 1996 Ray Favre