ONERR with Integer

2 posts / 0 new
Last post
macintricks's picture
Offline
Last seen: 5 years 1 month ago
Joined: Jun 22 2007 - 22:36
Posts: 30
ONERR with Integer

Another programming question, maybe beyond the scope of this forum....

So I'm taking on a huge project... to develop an ONERR routine (in assembly) for Integer BASIC. Yeah. Who hasn't done this before? My plans so far are:

1. Understand what's going on with Applesoft's ONERR GOTO/GOSUB, which somehow also handles DOS 3.3 and ProDOS errors.

2. Reprogram Integer's error subroutine entry point to branch to my own routine. (Ok, so where's the start of Integer's error subroutine?) A little search for "Integer BASIC disassembly" uncovered a mostly undocumented disassembly:

EB00- BE B3 B2 B7 B6 37 ; '&gt;32767'<br /> EB06- D4 CF CF A0 CC CF CE 47 ; 'TOO LONG'<br /> EB0E- D3 D9 CE D4 C1 58 ; 'SYNTAX'<br /> EB14- CD C5 CD A0 C6 D5 CC 4C ; 'MEM FULL'<br /> EB1C- D4 CF CF A0 CD C1 CE D9 ; 'TOO MANY<br /> EB24- A0 D0 C1 D2 C5 CE 53 ; PARENS'<br /> EB2B- D3 D4 D2 C9 CE 47 ; 'STRING'<br /> EB31- CE CF A0 C5 CE 44 ; 'NO END'<br /> EB37- C2 C1 C4 A0 C2 D2 C1 CE C3 48 ; 'BAD BRANCH'<br /> EB41- BE B8 A0 C7 CF D3 D5 C2 53 ; '&gt;8 GOSUBS'<br /> EB4A- C2 C1 C4 A0 D2 C5 D4 D5 D2 4E ; 'BAD RETURN'<br /> EB54- BE B8 A0 C6 CF D2 53 ; '&gt;8 FORS'<br /> EB5B- C2 C1 C4 A0 CE C5 D8 54 ; 'BAD NEXT'<br /> EB63- D3 D4 CF D0 D0 C5 C4 A0 C1 D4 20 ; 'STOPPED AT '<br /> EB6E- AA AA AA 20 ; '*** '<br /> EB73- A0 C5 D2 D2 0D ; ' ERR'<br /> EB77- BE B2 B5 35 ; '&gt;255'<br /> EB7B- D2 C1 CE C7 45 ; 'RANGE'<br /> EB80- C4 C9 4D ; 'DIM'<br /> EB83- D3 D4 D2 A0 CF D6 C6 4C ; 'STR OVFL'<br /> E88B- DC 0D ; '\'<br /> EB8D- D2 C5 D4 D9 D0 C5 A0 CC C9 CE C5 8D ; 'RETYPE LINE'<br /> EB99- 3F ; '?'

This was a clipping of the disassembly which appears to define the error names being output to the screen, but not the handler's entry point.

3. Essentially, the user of this routine would use some POKEs to store the BASIC line number for handling the error. When an error occurs, execution branches to the modified error subroutine in memory, which then branches back to BASIC at the stored line number. Finally, the user could PEEK memory locations to determine error type and line number of the error within BASIC.

If anyone has some ideas about how to do this, I'd like to hear it!

speedyG's picture
Offline
Last seen: 4 years 10 months ago
Joined: Nov 16 2011 - 07:45
Posts: 2493
Re: ONERR with Integer

Hello macintricks,

maybe you spend some time to scroll along the:
The Software Developers Sourcebook.pdf
at:
http://mirrors.apple2.org.za/ftp.apple.asimov.net/documentation/misc/

its rather more related to algorythms and the practice about how to deal with errors and that topic is covered along
about 50 pages of text..... beginning at page 192
maybe this gives you some usefull ideas about the topic of handling errors in general and at onerr in specific....

And just because talking about ideas:
The Beagle Bros have touched the onerr routines few times
also in the book:
The big tip Book
from:
http://beagle.applearchives.com/books/
examine bottom of page 50 ff.

sincerely speedyG

Log in or register to post comments