Path: csiph.com!tncsrv06.tnetconsulting.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.27.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Wed, 17 Jan 2024 07:19:40 +0000 User-Agent: NewsTap/5.5 (iPhone/iPod Touch) Cancel-Lock: sha1:O309nFECNS/s0WOhB/SdHgufosY= Newsgroups: comp.sys.apple2.programmer Subject: Re: Using Applesoft Internal Error Messages in a BASIC Error Handler Content-Type: text/plain; charset=UTF-8 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit From: Michael J. Mahon References: <010cc230-427a-485e-9a90-bcd294ba96b5n@googlegroups.com> <95461d63-9b7a-47b8-b433-c31432d43d24n@googlegroups.com> Message-ID: Date: Wed, 17 Jan 2024 07:19:40 +0000 Lines: 31 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-KV9UunyTOgZcff0+Rq20TQSey1kq8GqPhGGkO/5plWUo8AzlhL8B/jkEiZ0HCVee/iDXNz+eTY6fDKU!nw7Cznu3jgy4+tmnkcENslXL39vbwzJQCwr1gl0iSz6ilOpzMslJYQVKsnVxtV6UF4Yzrs74GGhh!nQ== X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: csiph.com comp.sys.apple2.programmer:6302 fadden wrote: > The error code, passed in the X register, is just the index of the start > of the error text (table at $d260). The error routine prints "?", then > the error text, then "ERROR" and a bell (from $d350). If the code was > running, it prints the line number, and does the Applesoft error handling. > > So for example, SYNTAX ERROR is error code 16. $d260 + 16 = $d270, which > is the string "SYNTAX". The last letter has the high bit set (Dextral > Character Inverted format, or DCI), which is how the code knows when to > stop printing characters. > > Try this: > > 100 BASE = 53856: REM $D260 > 110 ERRCODE = 16: GOSUB 1000: REM SYNTAX ERROR > 120 ERRCODE = 53: GOSUB 1000: REM ILLEGAL QUANTITY > 130 END > 1000 PTR = BASE + ERRCODE > 1010 L = PEEK (PTR): IF L > = 128 THEN PRINT CHR$ (L - 128);: PRINT " ERROR": RETURN > 1020 PRINT CHR$ (L);:PTR = PTR + 1: GOTO 1010 > When writing the NadaNet ampersand extension for Applesoft, I needed a “standard” way to signal a data packet error. Since there is no easy way to extend the error message table, I chose to piggyback on an existing message by choosing an error number that points to the last word in the “OUT OF DATA” error, creating a “DATA” error message for NadaNet communication errors. ;-) -- -michael - NadaNet 3.1 and AppleCrate II: http://michaeljmahon.com