Test your BASIC error message knowledge!

By Arjan

Paladin (766)

Arjan's picture

07-08-2003, 23:45

Here's a little game I made a looong time ago... It will show you an error message and it's up to you to type a BASIC command that results in that error.

10 CLEAR 1000:DEFINT A-Z:DIM A$(22),A(22)
20 READ A$,A:IF A$="*" THEN 40
30 A$(X)=A$:A(X)=A:X=X+1:GOTO 20
40 X=RND(1)*19
50 PRINT "Type a command that will give the following error: " + A$(X)
60 C$="":LINE INPUT C$
66 IF C$="" THEN GOTO 60
70 ON ERROR GOTO 90
80 PRINT C$:DEFUSR=&H156:A=USR(0):POKE &HF3FA,&HF0:POKE &HF3FB,&HFB:POKE &HF3F8,&HF0+3:POKE &HF3F9,&HFB:POKE &HFBF0,30:POKE &HFBF1,30:POKE &HFBF2,13:END
90 IF ERR=A(X) THEN PRINT "Correct!" ELSE PRINT "Wrong!"
100 RESUME 40
110 DATA NEXT without for,1
120 DATA Syntax error,2
130 DATA RETURN without GOSUB,3
140 DATA Out of DATA,4
150 DATA Illegal function call,5
160 DATA Overflow,6
170 DATA Out of memory,7
180 DATA Undefined line number,8
190 DATA Subscript out of range,9
200 DATA Redimensioned array,10
210 DATA Division by zero,11
230 DATA Type mismatch,13
250 DATA Undefined user function,18
280 DATA Missing operand,24
290 DATA Bad file number,52
300 DATA File not found,53
310 DATA Bad file name,56
320 DATA File not open,59
330 DATA *,0

Oh it isn't fool proof so any enhancements are welcome Smile

Login or register to post comments

By tcm1998

Expert (120)

tcm1998's picture

09-08-2003, 13:57

Cool program, never thought the 'on error goto' command would ever be used as a quiz.
The program is very easy to beat, though. You might want to check for cheaters.

error 7 <enter>

See what I mean ?

Tongue

By Arjan

Paladin (766)

Arjan's picture

09-08-2003, 14:17

yeah I know it has some bugs in it. Try
new <enter>
that'll definately stop the game Smile

By BiFi

Enlighted (4348)

BiFi's picture

09-08-2003, 14:42

Why not make an ASM version of it then? You can't NEW that... It's a funny idea to do such a thing...

By anonymous

incognito ergo sum (116)

anonymous's picture

09-08-2003, 14:58

The following line will fix the NEW problem Tongue

67 IF C$="NEW" GOTO 60

By Arjan

Paladin (766)

Arjan's picture

09-08-2003, 16:10

There's another problem! If you enter a statement that doesn't result in an error, the program just stops. Could be easily fixed by adding ':error 0' after the text the user enters, but it will look a little bit ugly on screen

By anonymous

incognito ergo sum (116)

anonymous's picture

09-08-2003, 17:21

A way to solve that is to store all commands that can generate the said error, but then the there's no need anymore for that trickery... :/

By BiFi

Enlighted (4348)

BiFi's picture

09-08-2003, 20:29

Then it would be too easy, since the list of commands is aready listed. Best way to solve all this is doing it in assembly using H_ERRO (&HFFB1) which is called when a Basic error occurs and ERRFLG (&HF414) which holds the error number.