Odd Reports From All Over

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v5 n9 (Volume 5, Issue 9)
Date: September 1984
Pages: 6

Computers, like humans, often give confusing answers, doing the best they can to tell you what’s wrong. Some years ago, I spent too many hours trying to understand the message “invalid subroutine call” in a program with no subroutines. As it turned out, I exceeded the default length of variable names on the particular machine, and it did the best it could to tell me where I had erred in this case.

When you use USR calls, you transfer absolute control of the machine to the address specified, and the function expects a RETurn instruction that will provide a 2-byte, unsigned integer as the value returned in the BC register pair.

But try 10 LET T=USR 832 right after you do a NEW on your ZX/TS. Surprise! You get C/10–the text of the string argument of VAL does not form a valid numerical expression. VAL? What string?

What’s happened is that the answer couldn’t be assigned as you demanded, so the computer tried to see if it could treat the answer as a string to be evaluated before assignment. It could not, and told you so–answering a question you did not know you had asked. This happens on the way back from the call, not before executing the code starting at 832.

Perhaps some ROM-dweller out there can give us an even clearer picture of all this. Until then, remember–the computer always does exactly as it should. Even a truly malfunctioning machine executes its broken cycles perfectly–though not always understandably.

Thermodynamics says you can’t win, you can’t break even, and you can’t get out of the game–but you can learn. Observe, don’t judge.