Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


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

Re: Call Address to Print BASIC Error Message

From awanderin <awanderin@gmail.com>
Newsgroups comp.sys.apple2.programmer
Subject Re: Call Address to Print BASIC Error Message
Date 2019-02-02 11:32 -0700
Organization A noiseless patient Spider
Message-ID <yubpnsaavnc.fsf@gmail.com> (permalink)
References <f52655a8-0fd6-4aee-b345-8631bb8b3b38@googlegroups.com> <2b9c4542-55b8-4f71-97d1-e0b5ad57b5b4@googlegroups.com>

Show all headers | View raw


Michael Pohoreski <michael.pohoreski@gmail.com> writes:

> = Demo =
>
> 1 DATA 32,251,218,32,90,219,166,222,189,96,210,72,9,128,32,237,253,232,104,16,243,169,80,160,211,76,58,219
> 2 FOR I = 0 TO 27: READ B: POKE 768+I,B:NEXT
> 3 REM REPLACE 0 WITH APPROX. ERROR MESG OFFSET SUCH AS 42
> 4 POKE 222,0
> 10 CALL 768
>
>
> = ML =
>
> We can use this ML helper/utility to replicate the Applesoft error printing:
>
>      ORG $300
> 300  JSR CRDO
>      JSR OUTQUES
>      LDX ERRSTK-1
> 308  LDA ERROR.MESG,X
>      PHA
>      ORA #$80
>      JSR COUT
>      INX
>      PLA
>      BPL $308
>      LDA #$50 ; Address of
>      LDX #$D3 ; ERROR^G
>      JMP STROUT
>
> = How it was made =
>
> We can convert the assembly HEX to DATA decimal statements via this JS snippet:
>
>   var asc ="20 FB DA 20 5A DB A6 DE BD 60 D2 48 09 80 20 ED FD E8 68 10 F3 A9 50 A0 D3 4C 3A DB ";
>   var n = asc.length, text = "1 DATA ";
>   for( var i = 0; i < n; i += 3 )
>     text += parseInt( "0x" + asc.substr( i, 2 ), 16 ) + ',';
>   console.log( text );
>   console.log( "FOR I = 0 TO " + ((i/3)-1) );
>

Here's an all-Applesoft way to do it.  Substitute your choice of error
on line 20...

10  ONERR  GOTO 1000
20  PRINT 1 / 0 : REM Generate error
30  END
1000 BE = 53856
1010 EA = BE +  PEEK (222)
1015  GOSUB 1050
1020 EA = BE + 240: GOSUB 1050
1030  PRINT " IN LINE " PEEK (218) + 256 *  PEEK (219)
1040  END
1050 C =  PEEK (EA): IF C > 0 AND C < 128 THEN  PRINT  CHR$ (C);:EA = EA + 1: GOTO 1050
1055  IF C >  = 128 THEN  PRINT  CHR$ (C);
1060  RETURN

--
Jerry    awanderin at gmail dot com

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


Thread

Call Address to Print BASIC Error Message Bill Chatfield <billchatfield1@gmail.com> - 2019-01-30 15:16 -0800
  Re: Call Address to Print BASIC Error Message James Davis <JPD.Enterprises@outlook.com> - 2019-01-30 18:21 -0800
  Re: Call Address to Print BASIC Error Message gids.rs@sasktel.net - 2019-01-30 21:05 -0800
  Re: Call Address to Print BASIC Error Message Tom Porter <laseractiveguy@gmail.com> - 2019-01-31 00:35 -0800
    Re: Call Address to Print BASIC Error Message kegs@provalid.com (Kent Dickey) - 2019-01-31 21:58 -0600
      Re: Call Address to Print BASIC Error Message Michael Pohoreski <michael.pohoreski@gmail.com> - 2019-01-31 22:31 -0800
  Call Address to Print BASIC Error Message Michael Pohoreski <michael.pohoreski@gmail.com> - 2019-01-31 23:01 -0800
    Re: Call Address to Print BASIC Error Message awanderin <awanderin@gmail.com> - 2019-02-02 11:32 -0700
      Re: Call Address to Print BASIC Error Message Jeff Blakeney <CUTjeffrey_blakeney@yahoo.ca> - 2019-02-02 22:56 -0500
        Re: Call Address to Print BASIC Error Message gids.rs@sasktel.net - 2019-02-03 10:19 -0800
          Re: Call Address to Print BASIC Error Message Michael Barry <barrym95838@yahoo.com> - 2019-02-04 00:42 -0800
        Re: Call Address to Print BASIC Error Message Michael Barry <barrym95838@yahoo.com> - 2019-02-04 00:31 -0800
          Re: Call Address to Print BASIC Error Message Jeff Blakeney <CUTjeffrey_blakeney@yahoo.ca> - 2019-02-04 10:27 -0500
            Re: Call Address to Print BASIC Error Message Bill Chatfield <billchatfield1@gmail.com> - 2019-02-09 09:28 -0800
              Re: Call Address to Print BASIC Error Message Michael Pohoreski <michael.pohoreski@gmail.com> - 2019-02-09 13:57 -0800
      Re: Call Address to Print BASIC Error Message Michael Barry <barrym95838@yahoo.com> - 2019-02-04 01:06 -0800

csiph-web