Documentation for AppleSoft & command hook?

From: Patrick Rigney <patrick_at_evocative.com>
Date: Sun Nov 30 18:33:17 2003

Sellam,

Just from looking at the disassembly you provided, it appears that the &
command will pass control to address $03F5, which is a three-byte space
expected to contain a JMP instruction to a handler. The jump to $03F5 is
done in such a way that when the handler is reached the accumulator will
contain the character in the BASIC program text immediately following the &.
On return, BASIC parses the next statement beginning at TXTPTR. It stands
to reason, then, that your "&" handling routine needs to advance TXTPTR by
calling CHRGET until an end-of-statement is reached.

So the basic (no pun intended) rules of engagement seem to be: load your
handler's code into memory, poke a $4C (JMP) into $03F5, and your handler's
entrypoint address into $03F6 and 7. The simplest handler should make sure
that the character in the accumulator is an end-of-statement (colon
character, or end of line $00 I believe) when called (perhaps JMP to SYNERR
if not, or just ignore). If you parse, or decide to just ignore whatever
follows the "&", make sure you call CHRGET ($00B1) until you get an
end-of-statement, so BASIC is armed to parse the next command in the text
when you return. You could also just set Y to the number of characters you
wish to ignore and jump to ADDON ($D998).

Anyway, that's all from a quick code review. In practice, I'm sure I've
missed some details, but maybe that will get you rolling in the right
direction. I'm sure more Apple-knowledgable folks will chime in, too.

Handy that the implementation not only gave you a jump vector, but also
provided enough context to allow you to parse whatever followed. I remember
using some DOS extensions that let you do things like &COPY
"fromfile","tofile". I wished for that on the PET many times (wouldn't that
have made for nicer disk handling than that OPEN 15,8,15 mumble?).

Patrick

> -----Original Message-----
> From: cctalk-bounces_at_classiccmp.org
> [mailto:cctalk-bounces_at_classiccmp.org]On Behalf Of Vintage Computer
> Festival
> Sent: Sunday, November 30, 2003 2:08 PM
> To: Classic Computers Mailing List
> Subject: Documentation for AppleSoft & command hook?
>
>
>
> I'm looking for documentation that explains how to actually use the &
> (ampersand) command hook in AppleSoft BASIC. Apparently this was
> documented in 1980 by some documentation Apple released at that time.
>
> BTW, here's a nice disassembly of AppleSoft BASIC:
>
> http://cosmicwolf.com/AppleII/AppleSoft_Commented.htm
>
> --
>
> Sellam Ismail Vintage
> Computer Festival
> ------------------------------------------------------------------
> ------------
> International Man of Intrigue and Danger
> http://www.vintage.org
>
> [ Old computing resources for business || Buy/Sell/Trade Vintage
> Computers ]
> [ and academia at www.VintageTech.com || at
> http://marketplace.vintage.org ]
>
>
Received on Sun Nov 30 2003 - 18:33:17 GMT

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:36:21 BST