Hi, Rich,
I've dropped you an email with an example of my current test code, FYI.
RichTW wrote:
Yet again, what we really need is the source code as an file which can be edited, generally poked around with, and conditionally assembled for each platform with optional extensions. Then we could trivially move around the memory layout at will.
Ahh, yes, but that would violate my attempt to keep it working without modifying the original executable on the disc.

I don't know why that's important to me, it just is, dammit!
Of course, even though I've got a commented disassembly of the Beeb version kindly provided by Dave Devenport, turning it into a modern assembled version is really beyond my skills anyway, so it's not an option. Plus, we're also talking about the Electron version here, which I haven't even got a proper disassembly for. :/
RichTW wrote:
I presume the Electron version shares most of its code with the Beeb version, but with changes for the sprite plotting and erasing. I've never looked at the Electron code. I guess it must have to erase the sprites in a different way (it can't use the EOR trick because it uses a lower colour depth mode), so maybe the spare memory between &3200..&5800 is used to cache the chunks of screen behind moving sprites, so it can be restored easily, although that's far more than it possibly needs.
Sounds plausible to my layman's ear. Although I don't know why it overwrites it (or even how much of the memory is being overwritten - I'm not sure if it's all the way up to &5800), I'm just making the assumption that there's not enough available for me to move all &440 bytes of the level data in one go.
RichTW wrote:
Just sounds rather like sloppy coding to me.
Of course! That's what CE is famous for.

RichTW wrote:
Anyway, for now you ought to be able to append that assembler code to the end of the Chuckie Egg executable, and call it as soon as the code's been relocated to its final place. That'll be more difficult to do in Basic though.
Give us a shout if you have any doubts!
With some previous help from PJ, I now know how to patch in the basic relocation code - what I need to do is see if I can modify that with your new code, to make it work with any generic levelset. To do it with BASIC, my plan was to use BASIC to identify the correct level, move it to somewhere above &5700 (everything needs rejigging as the initial joystick patch lives at &5700 atm) and update the appropriate pointer already loaded in to point to &3100. Then in the assembler, there would only need to be a simpler routine to move it down from &5700 to &3100, not any of the more clever stuff.
As there has to be an assembled routine, even if it's only moving code from &5700 to &3100, it will probably be neater to use your code to put the logic in the assembler rather than the BASIC. I think I will need to load the CE code even lower now, but if I load the XLOADER patch in at &1100, I'm hoping that will still let me squeeze it all in (the full XLOADER is jam-packed with features now).
Sam.