Cool AppleSoft BASIC trick I never thought of before

From: Vintage Computer GAWD! <foo_at_siconic.com>
Date: Wed May 17 11:43:27 2000

On Wed, 17 May 2000, Ethan Dicks wrote:

> > The default is 2049 ($801): 103=1 and 104=8 ($68=1, $69=8).
>
> Typical. The PET uses $0401, and the C-64 uses $0801 (because the display
> memory is at $0400 by default on a C-64)

Same with the Apple (first text display is at $400-$7FF, and actually, the
SECOND text display is from $800-$BFF, though it was rarely used, but I
have seen a couple programs that did use it in various ways).

> > QUESTION: Does anyone know why the default is $801 instead of $800? I
> > always wondered why that was. Anyway...
>
> I'm not sure of the exact reason, but for PETBASIC, $0400 (or $0800) must
> contain a null byte. I suspect the same for AppleSoft.

Yes, same thing with the Apple. If there is anything but a null at $800
(or really the first byte just before the beginning of your BASIC code)
you get, I believe, an UNDEFINED STATEMENT error or some such nonsense.

Why?

> > It occured to me tonight as I was writing just such an application--the
> > Nerd Trivia Challenge management program for the VCF, which loads a
> > hi-resolution character generator at $1600, which would over-run my BASIC
> > code, which is therefore relocated to $4001--that two or more BASIC

Insignificant correction: actually, it's the VCF registration program.

> There was a machine language program for the PET called "QuadraPET"
> published way back when (I have a copy on a 1541-disk-image file),
> that moved all the BASIC pointers around in zero page to create four
> 8K virtual PETs on a 32K PET. The author suggested that in a family
> setting, each user could have their own space and not clobber other
> people's work. I'm sure it would be trivial to adapt to AppleSoft,

As long as the family idiot didn't turn the power off of course. And also
as long as the other family members didn't over-run the other's memory
space.

Can you imagine how dysfunctional such a nerd family could be?
Son: Damn it, Dad, your sorting algorithm clobbered my variables again!
Dad: It's not my fault! I told you not to invoke the graphics mode you
     little twit! Why don't you RTFM!?
Mom: You're one to talk! You're not that great of a programmer yourself.
     And believe me, that's not the only thing you're not good at!
Sis: I hate myself! My code is fat and ugly! I want to die!!

> presuming there's around 100 bytes of protected memory to stuff it
> into - the trick on the PET was to use the second cassette buffer
> since so few users ever had two cassette drives. It was a great
> learning experience to have to fit useful programs into 192 bytes.

That's sort of the same thing as the $300-$39F range in the Apple. It
usually held simple tone generator routines. I used it for specialized
key input routines, etc.

> cf. QuadraPET; I can send you a copy if you'd like to disassemble it. ISTR
> it was published in COMPUTE! if you have a collection of them from the 1978-
> 1981 timeframe. I'm fairly sure that the source is printed in the magazine.

I have these issues (somewhere) but I pretty much know how the code needs
to be written. I didn't just give myself the title of Apple GAWD! out of
vanity, you know ;) I just need to look through some references and find
out where the variable memory space pointers are at (I can almost remember
them but its been too long) and the rest is easy.

> OTOH, I am not familiar with this sort of trick being done for AppleSoft,
> probably because back in those days, people moved to M/L for the Apple
> very early on because of the demands for speed on graphical programs.

True. I can't think of anything this would be useful for save for
demonstrating my Apple GAWDliness.

Sellam
Received on Wed May 17 2000 - 11:43:27 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:33:09 BST