I recently built a serial cable for Sinclair QL and I'm trying to understand how to juggle the binary files of my QL and how to transfer the latter from the PC to the QL while keeping the header of these files intact.
I know it's a much discussed topic online and there are many suggestions/solutions to the problem; but what I want to understand is what the header actually contains, what it is for and also how to preserve it.
1. First of all, I often find that Windows destroys the header of binary files as soon as you unpack a Sinclair QL .zip file. But only Windows? Linux, Mac doesn't do it?
2. Does every executable binary file have a header? I often hear talk that "probably" if unzipped out of Sinclair QL it won't work. So sometimes there might not even be a header?
3. Then, following up with the questions: what does the header of binary files consist of?
I found this explanation online:
Code: Select all
Header:
[255]
[length highest byte]
[length]
[length]
[length lowest byte]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[0]
[byte x length of actual data...]
So, sending a file with a length of 16 bytes would mean sending this data over the serial:
255,0,0,0,16,0,0,0,0,0,0,0,0,0,0,11,22,43,54,25,64,17,108,19,20,44,22,13,11,10,6
(The 16 bytes here are just bogus numbers).
3. From what I can understand (see point 3), the header of a binary executable file is used to inform the system of how much memory the system must reserve for that program (of course, correct me because this is my assumption). So, I thought, what if a command like:
Code: Select all
EXEC MDV1_NOMEPROG
Code: Select all
BAD PARAMETER
Code: Select all
23172 / 1024 = 22.63
Code: Select all
110 qterm=RESPR(23*1024)
120 LBYTES mdv1_qterm_cde,qterm
130 CALL qterm
Code: Select all
EXEC mdv1_asm
Code: Select all
BAD PARAMETER
Unfortunately I can't use programs like unzip under QL, this is because they are heavy: I have a QL that doesn't expand (128K) and I use Qemulator which, in the basic version, doesn't support more than 128K. I therefore thought of using a microdrive (in the QL emulator) to open the .zip files and using the second microdrive, configured with a folder in my Mac's file system. Once this is done, I manually transfer the files from microdrive 1 to the 2 (always under emulator) and then from the folder I send them via serial to the real QL.