?TM ERROR
Dragon Data Dragon 32/64
Severity: MinorWhat it means
?TM ERROR on the Dragon means Type Mismatch — BASIC tried to use a string variable where a number was expected, or a number where a string was expected.
For example: LET A = "HELLO" + 5 causes ?TM ERROR because you cannot add a string to a number.
Affected Models
- Dragon 32
- Dragon 64
- Dragon 200E
- XRoar emulator
Common Causes
- Assigning a string value to a numeric variable (or vice versa)
- Passing a string to a function that expects a number (e.g. SQR("FIVE"))
- Mixing string and numeric expressions in a calculation
- Variable names: A is numeric, A$ is a string — confusing the two
- Reading DATA values of the wrong type with READ
How to Fix It
-
Type LIST and check the line where the error occurred.
BASIC will print the line number with the ?TM ERROR.
Type LISTto see just that line. -
Check variable names — string variables must end with $.
In Dragon BASIC, A is a numeric variable and A$ is a string variable.
If you wrote LET A = "HELLO", BASIC rejects it because A is numeric.
Change it to LET A$ = "HELLO". -
Check any functions that receive variables.
Functions like SQR(), SIN(), LOG() only accept numbers.
Print the variable before the function call to confirm its type: PRINT A — if it shows a number, it is fine; if it shows text, the type is wrong. -
Check READ/DATA statements match their variable types.
If your DATA line contains: DATA HELLO, 10 — and your READ line does: READ A, B — this fails because A is numeric and HELLO is a string.
Change to: READ A$, B
Frequently Asked Questions
How do I tell if a variable is a string or a number in Dragon BASIC?
Simple rule: if the variable name ends in $, it is a string (e.g. A$, NAME$, X$).
If it does not end in $, it is numeric (e.g. A, NAME, X).
Dragon BASIC uses the same convention as all Microsoft BASIC dialects.
Is Dragon BASIC identical to TRS-80 Color Computer BASIC?
Very nearly.
Both use Microsoft Extended Color BASIC on the Motorola MC6809E CPU.
Error codes including ?TM are identical across both machines.