View Single Post
Old 22 November 2020, 19:20   #27
Galahad/FLT
Going nowhere

Galahad/FLT's Avatar
 
Join Date: Oct 2001
Location: United Kingdom
Age: 47
Posts: 7,911
Quote:
Originally Posted by jotd View Post
current stack which could very well be in the destination zone...

A generic approach that works 100% of the time isn't that trivial (decruncher or not)
Just not likely is it?

System sets the stack at the top of 512k chip mem or top of 1 meg chip ram, or at the top of whatever external memory is present.

The most important thing is to get the file into memory.

If the load address is less than $100, then use the stack to put your copy routine, you're going to know this when the user inputs the details for the file to be created.

At no point will the file that gets loaded interfere with the stack, because your main concern is getting it into memory, and then transferring it afterwards.

If by some miracle the file interferes with the stack on final copy, then obviously you would need a low mem copy routine.

There can't be a file in 512K that will stop both options, because the file simply won't load because of AmigaDOS, CLI screen, trackbuffers, so in a 512K machine, the largest file size is probably going to be around 440K before you run out of memory.

Seems pretty trivial to me

The way I do it is 99.99% of the time, let AmigaDOS locate the file, then pass parameters to a low mem copy routine.

In the very few cases where a low mem copy routine would clash with the file in question, I still copy the file to near the postion it needs to be, and then have a secondary copy routine that is now copied to the top of memory (because now I know the file has been moved low enough that it won't be corrupted) and executed which then copies the file to its final lower destination.

For your routine to to know this stuff, I would say that should a file exceed 350K, and its load address is above $1000, I would use the double copy approach, i.e. copy routine to low mem, move file close to final position, copy routine in high mem, copy file to final destination.

If the load address is below $100, use the stack copy approach

If the load address is above $100 and file is less than 350K, then low memory copy will suffice.

All this information will be given to your program by the user, so there is literally NO guesswork on your part.

Last edited by Galahad/FLT; 22 November 2020 at 19:27.
Galahad/FLT is offline  
 
Page generated in 0.05421 seconds with 11 queries