X-Received: by 2002:a0c:ff0b:0:b0:67a:52c7:f44d with SMTP id w11-20020a0cff0b000000b0067a52c7f44dmr255172qvt.5.1701325437357; Wed, 29 Nov 2023 22:23:57 -0800 (PST) X-Received: by 2002:a05:6808:34c:b0:3b5:6432:e0ec with SMTP id j12-20020a056808034c00b003b56432e0ecmr670551oie.1.1701325437119; Wed, 29 Nov 2023 22:23:57 -0800 (PST) Path: csiph.com!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer01.ams4!peer.am4.highwinds-media.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.sys.apple2.programmer Date: Wed, 29 Nov 2023 22:23:56 -0800 (PST) In-Reply-To: <010cc230-427a-485e-9a90-bcd294ba96b5n@googlegroups.com> Injection-Info: google-groups.googlegroups.com; posting-host=24.130.68.111; posting-account=UAtoeQoAAADrX7T-MHdWWRC4Fzf0dsLP NNTP-Posting-Host: 24.130.68.111 References: <010cc230-427a-485e-9a90-bcd294ba96b5n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <95461d63-9b7a-47b8-b433-c31432d43d24n@googlegroups.com> Subject: Re: Using Applesoft Internal Error Messages in a BASIC Error Handler From: fadden Injection-Date: Thu, 30 Nov 2023 06:23:57 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Received-Bytes: 2198 Xref: csiph.com comp.sys.apple2.programmer:6126 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 e= rror 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 =3D $d270, which= is the string "SYNTAX". The last letter has the high bit set (Dextral Cha= racter Inverted format, or DCI), which is how the code knows when to stop p= rinting characters. Try this: 100 BASE =3D 53856: REM $D260 110 ERRCODE =3D 16: GOSUB 1000: REM SYNTAX ERROR 120 ERRCODE =3D 53: GOSUB 1000: REM ILLEGAL QUANTITY 130 END=20 1000 PTR =3D BASE + ERRCODE 1010 L =3D PEEK (PTR): IF L > =3D 128 THEN PRINT CHR$ (L - 128);: PRIN= T " ERROR": RETURN=20 1020 PRINT CHR$ (L);:PTR =3D PTR + 1: GOTO 1010