Re: [cc65] Apple2 file io - here: memory management questions

From: Oliver Schmidt <ol.sc1web.de>
Date: 2004-07-30 10:33:10
Hi,

>> [Apple2 memory layout]

> I agree.  Depending on the machine - the ROMs are in the $D000-FFFF
> range,  the IIc, IIe & IIGS have auxillary memory to play with.

Surely, I explicitly oversimplified things to get the non-Apple2 guru's into
the dicussion as well...

> >1. scenario: DOS 3.3 : $800 - $9600

> <snip> I assume most people using 3.3 would be here.  Might be another
> target (.cfg) though.

I'm afraid I don't get you right. The current Apple2 default .cfg file is
just for this scenario.

> >2. scenario: DOS 3.3 in upper memory

This one makes up another .cfg.

> >3. scenario: ProDOS 8 with command interpreter

> >4. scenario: ProDOS 8 without command interpreter

> I assume that the simplest scenario for both is $2000-$9600 which is
> 29.5 K. Once the file io tests pass, then I'll start putting in the
> extras.

Of course one step after the other. I just wanted to make sure that
everybody here - especially those thinking much about memory usage ;-) has a
understanding of the genral numbers...

> Out of that 29.5K, I allocate 8K for static buffers.  Overkill ? Maybe.

To be honest: In my opinion certainly _YES_ ! BTW: How do you make sure for
static buffers that they are aligned on page bounaries? Or do you the
"sub-alignment" with an addition 255 bytes I mentioned briefly?

> Which leaves 21.5K for a text program.  Someone who wants to use
> hires will lose another 8 - 16K for ~22K total or 13.5K program - buffers.

I explictly didn't mention hires as it makes things more complicated / worse
but - at least in my opinion - doesn't invalidate what I wrote.

Generally I believe that for successful usage of hires we really need a more
flexible linker. From my experience cc65 Apple2 programs tend to have lot's
of code and relatively little data. So using $0800-$2000 just for heap/stack
isn't enough. The CODE segment has to be able to be splitted across several
memory areas. Therefore I think hires is kind of out-of-reach for our
current discusion...

> >- The application has to call a special quit API on exit. The called quit
> >routine will then allow the user to load the next application (for
example
> >the command interpreter).

> The crt0.s is per library - there really is nothing stopping us from
> adding a jsr to a __filecleanup which can close files and "quit" instead
> of a "JMP RESTOR" or back to basic.  The DOS 3.3 cleanup would be back
> to basic.

1. The crt0.s is per target. If Ullrich gives us the option of several file
i/o libraries to be used for a single target they'll share crt0.s.

2. In 2.10 there's no JMP RESTOR there anymore, it's now jmp DOSWARM. Surely
this is semantically identical, but it makes things much harder to discuss
if not talking about the same thing with the same words. It would be really
great if you could step up to at least 2.10 or even better a recent
snapshot.

>     jsr __closeallfiles

Sorry, I don't understand this line with more context and/or hints. Is this
you current code? Is this a proposal? In the text above you mention a
__filecleanup, is this supposed to be the same with a different name?

> Problem: What if developers don't want a DOS link ? A nodos directory
> with __dos_quit ?

Sorry, but I simply don't know what a "DOS link" is :-(

> I need to read up on the config file again.  I was thinking of:
>     RAMLOW: start=$800, size=$17FF;
>     RAM: start = $2000, size = $7600, file = %O;
>     HIRES1: start = $2000, size = $1FFF;
>     HIRES2: start = $4000, size = $1FFF;
>     RAMHIGH: start = $6000, size = $3600; # $9600 begin prodos

How do you want to make use of RAMLOW?

> HIRES1 & 2 could be "DATA"

I don't understand this statement:

1. If the linker is to place the startup code at $2000, there can't be
something else at the same time.
2. The "DATA" segment is for initialized writable data items. What has this
to do with hires?

> Loader - hrrmmm...  load into HIRES1, run from RAMLOW ?  I'm not sure
> how this will work -yet.

I guess you missed the following from my last posting:

"It would have a custom startup code relocating the loader from $2000 to
let's say $B000.
This area would then wiped out later by the BSS, heap or stack of the main
executable."

The loader doesn't run from $0800, it runs from $B000 (or something like
that).

> >Setting up a RESET handler for closing files

> Again - the crt0.s can be modifed to call "quit" .

1. Again, the crt0.s is by default shared between the DOS 3.3 and ProDOS 8
libraries.
2. As I wrote: If we want the RESET handler only for ProDOS 8 the difference
is going to be more than just calling quit instead of jumping to doswarm.


>  I need to understand
> "condes" better.

The 2.10 Apple2 C library makes use of it in very simple manners making up
usable examples.

> Great stuff !  Gives me a lot to consider.

Thanks for the positive feedback.

Oliver

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Fri Jul 30 10:36:34 2004

This archive was generated by hypermail 2.1.8 : 2004-07-30 10:36:43 CEST