Page 1 of 2
EXEC binary over SER2
Posted: Mon Nov 11, 2013 9:06 pm
by tcat
Dear All,
I have built a serial cable recently.
I have Linux COM2 port at one end, QL SER2 on the other.
No TK2, only 128K, JS ROM so far.
This enables communication at 2400 bauds at Linux end
$ stty -F /dev/ttyS1 2400 cs8 clocal cstopb raw crtscts
This sets baud rate on the QL
BAUD 2400
I can load or save SUPERBASIC programs over SER2.
LOAD SER2 or LOAD SER2HR
SAVE SER2 or SAVE SER2HR
On Linux I have to type e.g.
$ cp MYPROG_BAS /dev/ttyS1 .......... sending to the QL
$ cp /dev/ttyS1 MYPROG_BAS .......... receiving from the QL
Seems to work alright.
HOWEVER
HOW CAN I EXECUTE A BINARY?????
E.G. I have a QED editor binary
I have constructed a file header, 64 bytes, hexdump follows
00000000 00 00 1E DC 00 01 00 00 06 00 00 00 00 00 00 03 ................
00000010 51 45 44 00 00 00 00 00 00 00 00 00 00 00 00 00 QED.............
00000020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
I concatenate the header and binery and send it down the line
$ cat QED.HDR QED > /dev/ttyS1
On the QL I type,
EXEC SER2HR
But I am getting...... bad parameter
Please can anyone HELP?
Many thanks
TCAT
Re: EXEC binary over SER2
Posted: Mon Nov 11, 2013 9:25 pm
by RWAP
The header looks correct, but the QL exec command does not expect to read the header from the file itself - it is stored in the device directory entry for the file.
You would need a program on the QL end to read the file header and then use that to construct a SEXEC command to store the file locally on the QL....
Re: EXEC binary over SER2
Posted: Tue Nov 12, 2013 8:50 am
by tofro
Assuming the QL would really send the header preceding the binary on a serial line (which I really think is the case) Keep in mind the manual says:
When a header is sent over a pure serial device, then the 14 bytes of the header are preceded by a byte $FF
(Note how this also somewhat implies that
not all 64 Bytes of the header go on the line)
So, if you "exec ser2_", I guess the QL will expect this $FF byte and slice it off. No wonder your program is garbled

You could try preceding your header with $FF as well.
It would probably be far easier to send the file from a QL emulator on the PC side - You wouldn't have to cope at least with
those details

BTW: Most "exec" programs can simply be run using LBYTES and CALL - They will just crash when you quit them. Maybe you start from there?
Regards,
Tobias
Re: EXEC binary over SER2
Posted: Tue Nov 12, 2013 11:24 am
by tofro
All,
I've gone through the literature again. To me it seems that when sending an executable file over a serial line, the QL wil send/expect $FF plus the first 14 bytes of the 64-byte header information (that is, everything before the file name) followed by the file content.
When the manual says "the buffer supplied for the heade must at least be 14 bytes long" - That also implies that the $FF in front of the header is already sliced off by the OS.
It might make sense to insert a short pause between the header and the actual executable, as the QL will need a bit of time to allocate memory and create a job in the transient memory area after it has seen the header.
It might also make sense to simply do a dummy "SEXEC ser2_,20000,100,1234" on the QL and analyse what's actually being received from that on the PC in order to be able to verify this.
Regards,
Tobias
Re: EXEC binary over SER2
Posted: Tue Nov 12, 2013 8:00 pm
by tcat
All,
Just to let you know, I tried following...
$ cat FF.B QED.HDR QED > /dev/ttyS1
Where,
FF.B is a file containing a single byte of the $ff value
QED.HDR is trunctaed header to 14 bytes
QED actual binary
IT WORKS!
I was not able to set higher rate than 2400 bauds so far.
BTW where in the QL manuals is it said about $FF and 14 header file?
Many thanks
TCAT
Re: EXEC binary over SER2
Posted: Tue Nov 12, 2013 9:57 pm
by tofro
tcat wrote:
IT WORKS!
Nice to hear.
tcat wrote:
I was not able to set higher rate than 2400 bauds so far.
That is quite normal. The QL's serial ports aren't known to be very reliable on high(er) baud rates. You might want to invest in a Hermes or SuperHermes to improve that (significantly)
I would have tested myself, probably, but none of my QL and alikes is rigged for serial comms nowadays.
BTW the information comes from the "QL Technical Guide", the "Developer's Handbook" for the QL, Pages on FS.HEADS and FS.HEADR system calls. Available from several places, WoS has an OCR'ed one, I think. (I've got one in stained and yellowed paper, purchased new for 79DM in Munich back in 1988. Yes, QLing has never been cheap

)
Tobias
Re: EXEC binary over SER2
Posted: Tue Nov 12, 2013 10:48 pm
by RWAP
Dilwyn,
Any chance you could update the page on file headers on your website:
http://www.dilwyn.me.uk/docs/formats/filehedr.txt
It would be useful to update this document with the information for headers went sent over serial ports
Re: EXEC binary over SER2
Posted: Wed Nov 13, 2013 8:19 am
by dilwyn
Re: EXEC binary over SER2
Posted: Wed Nov 13, 2013 10:59 am
by RWAP
Re: EXEC binary over SER2
Posted: Wed Nov 13, 2013 5:06 pm
by Dave
You're looking at a cached copy of the page.
