?BS ERROR
Dragon Data Dragon 32/64
Severity: MinorWhat Does This Error Mean?
?BS ERROR means you tried to access an array element outside its defined range. Check that your array index is within the DIM bounds and that the array has been DIM'd before use.
Affected Models
- Dragon 32
- Dragon 64
- Dragon 200E
- XRoar emulator
Common Causes
- Array index higher than the DIM size
- Negative array index
- Array used without DIM (default size is 0-10)
- Loop variable exceeding array bounds
How to Fix It
-
Check the DIM statement and the highest index you access.
DIM A(20) creates elements A(0) through A(20). Accessing A(21) causes ?BS ERROR.
-
Make sure the DIM statement executes before the array is used.
If GOTO skips over the DIM line, the array defaults to size 10. Accessing element 11 then causes ?BS ERROR.
-
Add bounds checking inside loops that access arrays.
Before A(I), check: IF I < 0 OR I > 20 THEN PRINT "INDEX OUT OF RANGE" : STOP
Frequently Asked Questions
What is the default array size if I do not use DIM?
If you use an array without DIM, it defaults to 11 elements: index 0 through 10. Accessing index 11 or higher causes ?BS ERROR.
Are Dragon BASIC arrays 0-based or 1-based?
Dragon BASIC arrays start at index 0. DIM A(10) creates 11 elements: A(0) through A(10). This is the same as TRS-80 CoCo BASIC.