BS Error
Tandy Retro Computer
Severity: MinorWhat Does This Error Mean?
BS in TRS-80 BASIC is 'Bad Subscript' — your program asked for an array element outside the dimensioned range.
If you DIM A(20), valid indices are 0 to 20.
Touch A(21) and BS fires.
Either increase the DIM size or fix the index calculation.
Affected Models
- TRS-80 Model I
- TRS-80 Model III
- TRS-80 Model 4
- TRS-80 Color Computer (CoCo)
- TRS-80 Pocket Computer
Common Causes
- Loop counter ran past array size — FOR I=0 TO 30 with DIM A(20)
- Off-by-one — using 1-based logic against 0-based DIM
- Array dimensioned with default size 10 when you needed bigger
- Negative subscript from a calculation that went negative
How to Fix It
-
Find the line that crashed.
BS in
tells you exactly where.
LIST that line.
Look at every array reference on that line. -
Check the DIM statement.
Search the listing for DIM and the array name.
If you didn't DIM it, the array defaults to size 10.
Anything past index 10 throws BS. -
Fix the index or grow the array.
Either constrain the loop: FOR I=0 TO 19 (matching DIM A(19)).
Or grow the DIM: DIM A(100).
Pick whichever matches your data. -
Watch for negatives.
An index calculated from arithmetic can go negative if you're not careful.
Add a guard: IF I<0 THEN I=0.
Or trace the calculation to find the bug.
Frequently Asked Questions
Why does BASIC use BS, OV, NF instead of full words?
Level II BASIC was written for 4K of ROM.
Two-letter codes saved space.
Reference tables in old TRS-80 manuals translate them: BS = Bad Subscript, OV = Overflow, NF = NEXT without FOR, TM = Type Mismatch.