Groups | Search | Server Info | Login | Register


Groups > comp.sys.apple2.programmer > #6126

Re: Using Applesoft Internal Error Messages in a BASIC Error Handler

Newsgroups comp.sys.apple2.programmer
Date 2023-11-29 22:23 -0800
References <010cc230-427a-485e-9a90-bcd294ba96b5n@googlegroups.com>
Message-ID <95461d63-9b7a-47b8-b433-c31432d43d24n@googlegroups.com> (permalink)
Subject Re: Using Applesoft Internal Error Messages in a BASIC Error Handler
From fadden <fadden@fadden.com>

Show all headers | View raw


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

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Using Applesoft Internal Error Messages in a BASIC Error Handler Bill Chatfield <billchatfield1@gmail.com> - 2023-11-29 10:31 -0800
  Re: Using Applesoft Internal Error Messages in a BASIC Error Handler fadden <fadden@fadden.com> - 2023-11-29 22:23 -0800
    Re: Using Applesoft Internal Error Messages in a BASIC Error Handler Bill Chatfield <billchatfield1@gmail.com> - 2023-11-30 07:14 -0800
      Re: Using Applesoft Internal Error Messages in a BASIC Error Handler Jerry Penner <jerry+a2@jpen.ca> - 2023-11-30 11:00 -0700
        Re: Using Applesoft Internal Error Messages in a BASIC Error Handler fadden <fadden@fadden.com> - 2023-11-30 13:23 -0800
        Re: Using Applesoft Internal Error Messages in a BASIC Error Handler Bill Chatfield <billchatfield1@gmail.com> - 2023-12-01 07:10 -0800
    Re: Using Applesoft Internal Error Messages in a BASIC Error Handler Michael J. Mahon <mjmahon@aol.com> - 2024-01-17 07:19 +0000

csiph-web