Here's an idea for a more generic program that would take EA5 files and embed them in an XB program. When the program runs it would move the files where they should be and start them up.
You would need an assembly subprogram in low memory to create the XB program. This would do the following:
1-get the name of the EA5 program
2-read each of the files comprising the EA5 program. This first pass is only to find out how long the files are. Each of the files has a 6 byte header with:
>FFFF (not the last file) or >0000 (last file)
Number of bytes
Address to load the bytes
Add them up and now we know how many bytes need to be saved and with that can determine the address where they should be copied.
3-Copy a short AL program to high memory at around >FF80. When the XB program runs, this AL program will move the embedded code where it belongs, then set up the registers and VDP to duplicate the EA5 environment. To do all this will take about 128 bytes depending on how thoroughly you restore the EA5 environment.(For some EA5 programs this may not be necessary)
4-Read the EA5 files again. This time copy them, including the 6 byte header, into high memory such that they stop just short of the AL program loaded in step 3. Put the 1st address of these files into the AL program so it knows where the code begins.
5-Just below those add this 1 line XB program: 10 CALL INIT::CALL LOAD(8192,2 BYTE ADDRESS OF LOADER)::CALL LINK("X")
6-Set the pointers at >8330 and >8332 to point to this line of XB code.
The XB program is now complete and can be saved as a normal XB program.
When the AL program loaded in 3 runs, it knows the starting address of the code and can read the 3 word header. With that it can determine how many bytes need to be moved, where to move them, and if there is more code to be moved after this segment. The very first address is the starting address of the program. (Usually >A000)
This would make it possible to save an EA5 program that uses almost all the high memory.
Edited by senior_falcon, Fri Jul 13, 2018 6:57 AM.