Page 28 of 31

Re: QL / PASCAL

Posted: Sat May 22, 2021 10:57 am
by Chain-Q
So Norman, I finally merged most of your changes in FPC.patch8a.zip. I removed the old sysvars example, as it's quite messy, and the two current examples we have are enough.
NormanDunbar wrote:Hmm. Usually I code in C/C++ and not Pascal. However, when I'm coding on the PC to read QL structures, I always have to pack the structures to get the correct offsets. I suspect this was simply "muscle memory" in action. I've commented out the packing lines and recompiled the QDOS and SMS examples (in packages/qlunits/examples) and they appear to work fine. However, I'm on QPC which is impersonating/emulating a 68020 and I have fallen foul of that in the past with misaligned words/longwords on byte addresses -- the original QL with its 68008 would have barfed but the 68020 just did what was needed and carried on.
Also, the two byte alignment stuff I wrote before was a brainfart from me... It actually isn't two bytes, but 4... I'm sorry! We could change this actually, but anyway, for now I just added the $PACKRECORDS 2 directives at a few places, which wont' hurt. Also on the subject what you wrote: in this case the danger is not less, but more padding/alignment, so instead of crashes on a 68000 due to byte offsets, the later offsets being completely off. Which actually happened, and got uncovered by me writing some test code.
So I then compiled my own example program which displays all the QDOS System Variables on 5 or so pages. That also worked, so the good news is, unless I'm being 68020'd, is that I didn't need the packing after all. Famous last words?
Famous last words indeed. But were caused by my words this time...

So here's the test code I wrote for this. Checking like this will uncover if a system variable is badly aligned. Feel free to extend the sysvar_offsets table, but if the last variable is well aligned, then it's usually alright... :) So I just tested SV_TURBO with this, that was off by 8 whole bytes, then I found out where it got misaligned by checking some offsets in the middle, then I realized why it was aligning some pointer to 4 bytes, instead of two, so added 2 byte alignments. Then everything snapped right into place.

Re: QL / PASCAL

Posted: Sat May 22, 2021 3:09 pm
by NormanDunbar
Chain-Q wrote:So Norman, I finally merged most of your changes in FPC.patch8a.zip. I removed the old sysvars example, as it's quite messy, and the two current examples we have are enough.
I have no problem with your decision. Happy to be led by someone in the know, as opposed to someone (me) who is making it up as I go along! ;-)


Cheers,
Norm.

Re: QL / PASCAL

Posted: Sat May 29, 2021 1:00 pm
by NormanDunbar
Another update to the Cross Compiler Document. Version 1.5 is now available at https://github.com/NormanDunbar/FPC-Cro ... ses/latest. The changes include:
  • How to cope when the host compiler version changes and how to update your host compiler.
  • How to handle it when the cross compiler version changes and your sym-links go out of step.
  • Updates to the default Ql job name, which changed recently from PROGRAM to FPC_PROG.
  • Show how to determine that the compiler output if an actual QL file, when `-WQqhdr` used or defaulted. The Linux `file` commnad isn;t much use in this case.
  • Problems caused by rogue `.fpc.cfg` files found in your `$HOME` directory and how to fix them.
In addition, and on request, I'm now adding the document version to the PDF Properties (File->Properties in most PDF browsers) as well as in the actual file name. This is effective from this release onwards. This means that the versioned pdf file will be an asset, but in the source code files, both of them, the file will not be named with the version, just the properties. C'est la vie, as they say in Wales! ;)

As ever, you only need the PDF file, the *.gz and *.zip files are the source code, which you don't need unless you want to correct me! It happens.

Cheers,
Norm.

Re: QL / PASCAL

Posted: Sat May 29, 2021 5:44 pm
by Derek_Stewart
Hi Norm,

Can you produce an epub version?

Re: QL / PASCAL

Posted: Sat May 29, 2021 7:37 pm
by Sparrowhawk
Great guide Norman, thanks!

Re: QL / PASCAL

Posted: Sat May 29, 2021 11:12 pm
by NormanDunbar
Hi Derek,
Derek_Stewart wrote:Hi Norm,
Can you produce an epub version?
Does this help? https://ebook.online-convert.com/convert-to-epub. Thetevare plenty of pdf to epub converters online. I've no idea how good they are.

If you don't find one, there's a utility to convrrt my *.lyx file into epub/rtf/etc at https://github.com/willtang/lyx2ebook which might help. My source code is on the same URL as above, download the zip or tar.gz file to get it.

Cheers,
Norm.

Re: QL / PASCAL

Posted: Sat May 29, 2021 11:25 pm
by NormanDunbar
Sparrowhawk wrote:Great guide Norman, thanks!
Thanks Jean-Yves

Re: QL / PASCAL

Posted: Sun May 30, 2021 9:00 am
by Derek_Stewart
Hi Norm,

Your manual is a good read, it outlines all the issues that could cause the compiler compilation to fail.

Very well done.

PS, I will conver the PDF manual to Eub with Calibre and correct any page format problems.

Re: QL / PASCAL

Posted: Sun May 30, 2021 12:52 pm
by NormanDunbar
Thanks Derek.

Cheers,
Norm.

Re: QL / PASCAL

Posted: Wed Jun 09, 2021 9:32 pm
by Derek_Stewart
Hi Norm,

I loaded the manual into lyx and exported the them
file as HTML, loaded into Calibre which converted to Epub very nicely.

Ecept for your footnotes, which were exportdd as HTML pages.

I could create the footnotes correctly in each page, but maybe this is tedious to do...