QL / PASCAL

Anything QL Software or Programming Related.
User avatar
Chain-Q
Chuggy Microdrive
Posts: 62
Joined: Mon Nov 16, 2020 1:10 pm
Location: Berlin, DE, EU
Contact:

Re: QL / PASCAL

Post 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.


User avatar
NormanDunbar
Forum Moderator
Posts: 2249
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post 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.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2249
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post 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.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Derek_Stewart
Font of All Knowledge
Posts: 3900
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QL / PASCAL

Post by Derek_Stewart »

Hi Norm,

Can you produce an epub version?


Regards,

Derek
User avatar
Sparrowhawk
Super Gold Card
Posts: 624
Joined: Wed Dec 15, 2010 12:33 pm
Location: @131072
Contact:

Re: QL / PASCAL

Post by Sparrowhawk »

Great guide Norman, thanks!


a.k.a. Jean-Yves
User avatar
NormanDunbar
Forum Moderator
Posts: 2249
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post 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.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
User avatar
NormanDunbar
Forum Moderator
Posts: 2249
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

Sparrowhawk wrote:Great guide Norman, thanks!
Thanks Jean-Yves


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Derek_Stewart
Font of All Knowledge
Posts: 3900
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QL / PASCAL

Post 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.


Regards,

Derek
User avatar
NormanDunbar
Forum Moderator
Posts: 2249
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

Thanks Derek.

Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
Derek_Stewart
Font of All Knowledge
Posts: 3900
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: QL / PASCAL

Post 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...
Last edited by Derek_Stewart on Thu Mar 07, 2024 12:30 am, edited 2 times in total.


Regards,

Derek
Post Reply