Schrijver
| Loading of binary files
|
pp msx novice Berichten: 27 | Geplaatst: 03 December 2005, 11:54   |
Hi,
I'm loading a program consisting of 6 .bin files from out of basic in a for next loop, with the BLOAD command. The headers of these files of course contain the start and end addresses (bytes 1-4). But, if I have a closer look at these adresses, I see that the start addresses of file 1 and 2 are the same. In other words, they overlap.
I suppose the BLOAD command just looks at the header, and uses the start address to fill-up the RAM with code, starting from the start address in the header. But as soon as file 2 is processed, will RAM be rewritten because of the same start address ? Does anyone know this ?
What's wrong with my thoughts ? I'm not loosing code here, the program is running fine. Still I don't understand. Does it have to do with the subslots ?
Regards,
pp
|
|
BiFi msx guru Berichten: 3142 | Geplaatst: 03 December 2005, 12:07   |
It's possible to have 2 files overlap. The execution code will most likely have some code to move the contents to its final destination. In BASIC there's only about 23 KB available to load files into. To get the data to its final destination it's loaded and the execution code moves it to its final destination... for example the RAM area under the BASIC ROM can only be filled when the ROM is temporarilly switched to RAM.
|
|
pp msx novice Berichten: 27 | Geplaatst: 03 December 2005, 14:02   |
So this is the header in file 1.bin:
FE 00 80 20 E0 00 E0
This means binary file (FE), load in memory at &H8000 (00 80) and ends at &HE020 (20 E0), executes at &HE000 (00 E0)
This is the header in 2.bin:
FE 00 80 80 E0 00 E0
This means binary file (FE), load in memory at &H8000 (00 80) and ends at &HE080 (80 E0), executes at &HE000 (00 E0)
Now I do a:
BLOAD"1.bin":BLOAD"2.bin"
Does the BLOAD command take care of moving code in this case ? Or is the code overwritten ?
Regards,
pp
|
|
mars2000you msx master Berichten: 1723 | Geplaatst: 03 December 2005, 14:14   |
To avoid overlapping, it should be
BLOAD"1.bin",R:BLOAD"2.bin"
|
|
pp msx novice Berichten: 27 | Geplaatst: 03 December 2005, 16:09   |
You're right ! Thanks !
|
|
|
|
|