Bottom
Next
Contents
Advanced Programming for the BBC Micro
Contents
Preface
Chapter One Advanced Programming
Advanced languages?
Programs small and large
Communicating the total view
Know your machine - the role of experiment
The languages used - BASIC and assembler
Using this book
Chapter Two Program Structure
The two parts of a program
The flow of control and spaghetti
The natural structure of BBC BASIC
The trouble with line numbers
(1) The line misplacement problem
(2) Fixed destinations
(3) The forward jump problem
Selecting between two alternatives
THEN without ELSE
Multiple selection - ON
Loops
Multiple exit points
Enumeration loops - FOR . . . NEXT
A family tree of loops
Constructing programs sequencing and nesting
Freedom, efficiency and structure
Chapter Three Using Procedures and Functions
The small programs inside large programs
Stepwise refinement - or starting at the top
Stepwise refinement as nesting
Module interaction - local variables and parameters
Functions
REMs, indentations and line numbering schemes
Chapter Four Structured Assembler
The natural structure of assembler
Assembler selection
Assembly language loops
Modular assembly language
The role of comments
Using the assembler
Labels and variables
Two-pass assembly
Conditional assembly
Macros
Data definition
Problems with macros - OPT, BASIC and local variables
Assembly language examples
Chapter Five Structuring Data
Simple data and structured data
Scalars - integer, character and Boolean data
Real data
Structuring methods - arrays and records
The use of arrays - look-up tables
Constructing new data types
BASIC arrays and indirection
Dynamic variables - strings and pointers
The stack
The queue
The linked list
Trees
Too many types?
Chapter Six File Storage
The sequential file
BASIC file commands
BBC files in use - buffering
Larger data items - PRINT# and INPUT#
Allowing for different file devices
Random access files
The OPENUP problem
Virtual arrays
Using files from assembler
A disk sector editor
Chapter Seven Making Programs Work
The natural history of bugs
Bug detection
Practical testing
Bug location
BASIC and assembly language break points
The common errors of languages
Stepwise testing and debugging
Programs fit to use
Chapter Eight A Spelling Checker
A spelling checker - design specification
The first stage
The second stage
Third and fourth stages
The dictionary
Evaluation
Locating inefficiency
Using machine code with BASIC
Conclusion
Chapter Nine An Execution Tracer
Intercepting BASIC
Assembling a program
The first stage
Second stage
Third stage and changing WRCHV
The complete program
Using the execution tracer
Evaluation and modification
Conclusion
Chapter Ten The MOS - A Soft Machine
What is a machine operating system?
The structure of the MOS
The file system
The VDU driver
Miscellaneous I/O
ROM paging
The interrupt and event handler
A background clock
Chapter Eleven Project - A 6502 Disassembler
The trouble with tables
The 6502 instruction format
6502 instructions by group
How good is the 6502?
The disassembler
Program structure and error handling
Using a dissassembler
Super disassemblers
Chapter Twelve Bits, Binary and Boolean Loglc
Bit patterns
Simple binary
Negative numbers or two's compliment binary
BBC integers
Fractions - floating point binary
Binary Coded Decimal
Hexadecimal
Bit patterns and logic
BASIC logic
Logic in assembler - EOR
Bit manipulation
Extracting information - USR and shifts
Logic functions - predicates
Theory
Further Reading
Index
Next
Top