Subject: Re: Applesoft Basic Question Newsgroups: comp.sys.apple2 From: dempson@actrix.gen.nz (David Empson) Date: Sat, 13 Feb 1999 03:24:44 +1300 Message-ID: <1dn578m.w4jxbm1dfkk74N@dempson.actrix.gen.nz> References: <36BA210D.242A@mich.com> <79igbt$6e3@login.freenet.columbus.oh.us> Organization: Empsoft X-Newsreader: MacSOUP 2.3 NNTP-Posting-Host: 202.49.157.176 X-Trace: 13 Feb 1999 03:24:09 +1300, 202.49.157.176 Lines: 53 Path: lobby!newstf02.news.aol.com!portc04.blue.aol.com!newsfeed.wli.net!su-news-hub1.bbnplanet.com!lsanca1-snf1!news.gtei.net!news.netgate.net.nz!news.xtra.co.nz!news.iprolink.co.nz!news.actrix.gen.nz!dempson David Wilson wrote: > Another quick quiz. Why do the Applesoft error codes have the strange > (in comparison to the regular DOS error codes) values listed? Since nobody else has answered yet, perhaps I can. > >Applesoft: > >0: ?NEXT WITHOUT FOR ERROR > >16: ?SYNTAX ERROR > >22: ?RETURN WITHOUT GOSUB ERROR > >42: ?OUT OF DATA ERROR > >53: ?ILLEGAL QUANTITY ERROR > >69: ?OVERFLOW ERROR > >77: ?OUT OF MEMORY ERROR > >90: ?UNDEF'D STATEMENT ERROR > >107: ?BAD SUBSCRIPT ERROR > >120: ?REDIM'ED ARRAY ERROR > >133: ?DIVISION BY ZERO ERROR > >163: ?TYPE MISMATCH ERROR > >176: ?STRING TOO LONG ERROR > >191: ?FORMULA TOO COMPLEX ERROR > >224: ?UNDEF'D FUNCTION ERROR > >254: ?REENTER (bad response to INPUT; non-fatal error) > >255: BREAK (^C has been struck) If you look at each of the error messages, eliminate the initial question mark, the word "ERROR" and the space preceding it, you will discover that each error number is the sum of the number of characters in all the preceding error messages. In other words, the error number is an index into a large table which contains each of the error messages packed end to end. It reads something like this: NEXT WITHOUT FORSYNTAXRETURN WITHOUT GOSUBOUT OF DATA (etc.) The last character in each message is marked specially (high bit opposite state) so the error message printer can locate the end of the message. 254 and 255 are special cases that are not handled in the same way as other errors. A cute trick: if you play around with the ONERR GOTO support mechanisms, you can generate partial error messages. For example, forcing an error 19 would produce "?TAX ERROR" (maybe the IRS is watching you?), and error 74 would be "?LOW ERROR" (is that anything like a low bridge?). -- David Empson dempson@actrix.gen.nz Snail mail: P.O. Box 27-103, Wellington, New Zealand