Altair BASIC 3.2 (4K) - Annotated Disassembly
[This is a work in progress, about 90% complete]
Here is a complete annotated disassembly of Altair BASIC 3.2 (4K). I have faithfully
followed the program order, and the code naturally divides into three sections
- the Interpreter, the Maths Package, and Initialisation.
Each of these sections is more-or-less logically subdivided into a number of
subsections.
1. The Interpreter
Interpreter (Explanation) - Explanations and
overviews of most of the internal logic used in BASIC. It describes the memory
layout, key concepts, structures and variables, and you shouldn't look at a
line of code until you've read through this.
Section
Base
Size
Key Functions
1.1
Restarts
0000
61
Start, SyntaxCheck, NextChar, OutChar, CompareHLDE, FTestSign, PushNextWord
1.4
Utility Functions
0192
101
GetFlowPtr, CopyMemoryUp, CheckEnoughVarSpace, CheckEnoughMem, OutOfMemory,
SyntaxError, DivideByZero, Error
1.14
Printing
0555
143
Print, NewLine, PrintString, ToNextTabBreak, Tab
Total size: 2041 bytes
2. The Math Package
Math package (explained) - All the concepts
needed to understand the math package.
Section
Base
Size
Key Functions
2.3
Mantissa Magic
085B
136
FNormalise, FMantissaLeft, FMantissaInc, Overflow, FAddMantissas, FNegateInt,
FMantissaRtOnce, FMantissaRtMult
2.5
Sign Magic
09DA
40
FTestSign_tail, InvSignToInt, SignToInt, Sgn, FCharToFloat, Abs, FNegate
2.6
Moving FACCUM about
0A02
53
FPush, FLoadFromMem, FLoadFromBCDE, FCopyToBCDE, FLoadBCDE, FCopyToMem
Total size: 1307 bytes.
3. Initialisation
Section
Base
Size
Key Functions
Total size: 478 bytes.