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

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 09/04/2015 21:44, Eero Tamminen a écrit :
Hi,

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. :-)


Hi,

yes, I think that the cartridge code is not aware of the flags in the program's header that were added in TOS 3 for TT to instruct it to load the program in TT RAM instead of "chip" RAM

IIRC correctly when I added TT RAM support, this flag is handled in emutos, so maybe the pexec logic of emutos (which was similar to TOS' one) could be used to change the cartdrige code.

Don't have time to look at this at the moment, maybe (much) later if no one takes care of this before.

Nicolas






Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/