Re: [hatari-devel] GEMDOS HD emulation, Hatari cartridge program load code and TT-RAM

[ Thread Index | Date Index | More Archives ]


On keskiviikko 08 huhtikuu 2015, Eero Tamminen wrote:
> On keskiviikko 08 huhtikuu 2015, Eero Tamminen wrote:
> > Ps. I hadn't yet time to check whether things work better
> > from disk image (no Hatari cartridge code involved, program
> > is loaded completely by TOS).
> When using IDE disk image with Falcon emulation, program
> is executed from TT-RAM.  I.e. problem is Hatari cartridge
> code used for loading program for GEMDOS HD emulation.

I looked what the cartridge code does, and it just asks TOS
to allocate/return pointer to new basepage + rest of memory
with Pexec(PE_BASEPAGE, ...) call.

I assume that it should be changed to check program header for
PRGFLAGS (long @ offset 0x16) bits and depending on those:

* If PF_TTRAMLOAD bit (1) is set, and there's "enough" TT-RAM:
  - shrink the memory returned by Pexec() call to basepage size
  - try Mxalloc(MX_PREFTTRAM) memory for program TEXT/BSS/DATA
    - if PF_TTRAMMEM bit (2) is set, that memory should cover also heap
  - If alloc succeeds, load program to that memory area instead,
    and update basepage pointers accordingly
* If PF_FASTLOAD bit (0) is set, clear just BSS, not heap
  (as clearing full heap with 256MB of TT-RAM could take a while)

Does that sound sensible?

I'm not sure what should be done about the allocated memory when
program terminates.  Does TOS free it automatically, or should
the memory address be stored by emulation & Pterm* functions
hooked to free that memory?

	- Eero

PS. I'm not going to implement that, cartridge code is in 68k
assembly and I'm not really proficient in that. :-)

Mail converted by MHonArc 2.6.19+