[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Extending Applesoft with Ampersand routines.
On Tuesday, March 12, 2013 4:32:35 PM UTC-4, Michael J. Mahon wrote:
> BLuRry wrote:
>
> > I'm starting this as a new thread since Bill Buckels asked a very good
>
> > question as a response to my smart-ass response to a cross-post.
>
> >
>
> > Here is what I know about ampersand routines from a high-level:
>
> >
>
> > You register your ampersand routine handler as a memory pointer, and your
>
> > routine is called by the applesoft interperter (only at runtime) when it
>
> > encounters the & sign.
>
> >
>
> > Applesoft pointers indicate the current memory address where the parser
>
> > was looking (I can't remember if it is the location where & occurs or the
>
> > memory location just after it).
>
> >
>
> > It is up to your routine to parse as much or as little as it wants, and I
>
> > believe your parsing routine has to update the applesoft pointer(s) as
>
> > well. This allows you to do some very wonderful and complex things, or
>
> > also very simple ones.
>
> >
>
> > And this is the part that eluded me when I experimented with this stuff
>
> > in the 90's: Your parser will encounter tokenized applesoft statements.
>
> > That means if your code looks like: &HOME then the actual data will be
>
> > the tokens &(0xAF) and HOME (0x97). You can use this to your advantage
>
> > by reusing applesoft tokens for your amp commands instead of having to
>
> > compare letter after letter (which is the case if the characters do not
>
> > have the hi-bit set) Some tokens have the open paren or equal sign as
>
> > part of the token as well.
>
> >
>
> > As for the ins and outs of how to return out of an ampersand command,
>
> > again it goes back to the applesoft zero-page locations. I can't
>
> > remember if you have to clear/set the carry as a status bit like you do
>
> > in other Apple firmware routines but it wouldn't surprise me if CLC meant
>
> > there was no error and SEC meant there was.
>
> >
>
> > Also, here's a list of all the applesoft tokens as well as my applesoft
>
> > de-tokenizer routine:
>
> >
>
> > http://sourceforge.net/p/java-ace/code/285/tree/jace/src/jace/applesoft/Command.java
>
> >
>
> > I hope this helps. I can dig up some better information if this is insufficient.
>
> >
>
> > -Brendan
>
>
>
> No, there's no automatic error handling--you have to explicitly report any
>
> errors.
>
>
>
> I replied in the original thread before noticing your new one. ;-)
>
>
>
> Check out the AMPERNADA module in my NadaNet source for a compact, quite
>
> capable ampersand handler.
>
>
>
> -michael - NadaNet 3.1 and AppleCrate II: http://home.comcast.net/~mjmahon
This is awesome. Thanks, Michael.
When I did Slammer, since I figured it was an Applesoft programming tool, I deliberately kept it away from the ampersand vector (though it does use the CTRL-Y vector at $3F8). This would be a cool thing to deliver via Slammer and have all the ampersand processing without needing to BLOAD anything; I might have to try to do that!