QL / PASCAL

Anything QL Software or Programming Related.
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QL / PASCAL

Post by pjw »

tofro wrote:I don't argue on that as well ;)
There is quite good reasoning behind long job names in some cases (like QD incorporating the full file name of the file edited in its name, or a linker incorporating its command line,.... ). Such stuff can actually add valuable information to a job display.
Im fully aware of this. I use this technique myself. Perhaps you mis-read me? The figure chosen is not arbitrary: $30 (48 dec) characters allows for just that. And I didnt choose it.
As long as tooling simply displays parts of the job name within its own limits, I'm perfectly fine with having the end sliced off. But ruling on an arbitrary length just for the sake of a rule is not a good idea either ;)
Its not just the tooling. If your job is loaded as a Thing, getting its name in the standard way gives you the Thing name. If you rely on that name to hold any meaningful information beyond 48 char, you could get the wrong result. As it happens, if the info you want is a simple file name, the current guidelines provide sufficient room for file names.
There are almost always limits somewhere. Qlib limits names to just 22 char, the latest Turbo to 36 (IIRC. Other versions have other limits, as does SuperCharge). I dont know about MBASIC. I guess something like a Pascal compiler also needs some idea as to how much room to leave to the job name.. which is how we got here.
Martin Head wrote me a nice hack to stretch a Qlib job's name length to any limit. (A copy can be found at Knoware.no) So its normally possible to work around any restrictions.
Ideally, compilers and such should offer the possibility to set the max name length and the given name separately. Then jobs with a fixed, short name neednt take up unnecessary space, and jobs with different requirements can have as much space as they need.


Per
dont be happy. worry
- ?
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: QL / PASCAL

Post by tofro »

pjw wrote:
tofro wrote: Ideally, compilers and such should offer the possibility to set the max name length and the given name separately. Then jobs with a fixed, short name neednt take up unnecessary space, and jobs with different requirements can have as much space as they need.
That's what C68 does. If you do nothing, the compiled programs receive a name of "C_PROG".

In case you want to set your own job name, you can do so, by overriding a global static variable, with apparently no limit in length (at least there is no documented maximum length, loking into the C startup code, it does reserve 30 bytes - But as the code after that is never again ran, you can patch well over 100 bytes in there once your main() has been called (C68 programs aren't "pure" anyhow.)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
NormanDunbar
Forum Moderator
Posts: 2251
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: QL / PASCAL

Post by NormanDunbar »

Chain-Q wrote:Well I believe you, but I was following the docs here, which doesn't list a QDOS naming for this call:

http://qdosmsq.dunbar-it.co.uk/doku.php ... ap_3:start

Sooo... Anything? :) FS_MKDIR maybe?

I have another question: how long a job name is allowed to be?
IOF_MKDIR is what it should be. The site you reference shows what was implemented in original QDOS and what is (now) implemented in SMSQ. The original didn't have directories so shows as "not implemented".

As for job names, the start of a job is:

Code: Select all

      bra.s start
      dc.w $4afb
      dc.l 0
nam   dc.w namend-nam-2
      dc.b 'job name here'
namend equ *

Start ...
The short jump defines, for me, the biggest name, but the first 6 bytes could be used for a long bra too.

HTH

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
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QL / PASCAL

Post by pjw »

Hhrmm, a wee correction. I think this is what you meant, Norm:

Code: Select all

      bra.s start
      dc.l 0
      dc.w $4afb
nam   dc.w namend-nam-2
      dc.b 'job name here'
namend equ *

Start ...
or

Code: Select all

      jmp.l start
      dc.w $4afb
nam   dc.w namend-nam-2
      dc.b 'job name here'
namend equ *

Start ...


Per
dont be happy. worry
- ?
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: QL / PASCAL

Post by mk79 »

Chain-Q wrote:Well I believe you, but I was following the docs here, which doesn't list a QDOS naming for this call:

http://qdosmsq.dunbar-it.co.uk/doku.php ... ap_3:start

Sooo... Anything? :) FS_MKDIR maybe?
Ah, I see! Right, this is actually a bit weird. Technically QDOS itself never had this key and Tony Tebby moved to his own naming of TRAPs (SMS style) before inventing the new "Level 2" functions for QDOS, so there is no official name other than "iof.mkdr" for the key.

C68 actually named this function both fs_mkdir and iof_mkdr at the same time. In the end it doesn't matter too much, so I recant and say just keep it the way you've done it :-)
I have another question: how long a job name is allowed to be? For now all generated executables have the job name "FPC" hardwired. It would be cool to have this set to something more meaningful compile time. But I need to know what's the longest name allowed.
As usual for this system things are heavily under-specified. Technically it's just a QDOS string, so could be 65535 characters ;) It's never copied to any internal jobs table or anything, it's always read from the executable in memory. But I think Per's suggestion with $30 is a sensible size.

Cheers, Marcel


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

Re: QL / PASCAL

Post by NormanDunbar »

pjw wrote:Hhrmm, a wee correction. I think this is what you meant, Norm:

Code: Select all

      bra.s start
      dc.l 0
      dc.w $4afb
nam   dc.w namend-nam-2
      dc.b 'job name here'
namend equ *
Start ...
Thank you Per, that's what I thought I was typing!

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
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 »

OK, so based on all the feedback above, I just committed the following features into SVN trunk:

- have a 48 byte ($30) buffer for a job name
- use FPC_PROG as a default job name, wired into the binary
- have pair of QL-specific calls in the system unit: SetQLJobName and GetQLJobName, to allow easy manipulation of the job name from the user program, with all the necessary safe checks in place (buffer length, etc checks)
- modified the compiler to store the program name (specified in the "program" keyword at the start of the main source) into the main object file during compiling
- in early system unit init, take this Progam name, and set it as default Job name.

I hope it's fine like this. If not, please discuss or send patches to propose changes. :) If no change requests, I'll document this on the FPC Wiki QL page.

Edit: actually I now added a 3rd function, GetQLJobNamePtr, which returns the pointer to the QL string job name (word length + characters). Just in case this might be needed for something, I'm not aware of yet. :)
Last edited by Chain-Q on Mon Apr 12, 2021 1:19 pm, edited 2 times in total.


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

Re: QL / PASCAL

Post by NormanDunbar »

I can think of nothing to complain about! :D

Thanks.


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
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: QL / PASCAL

Post by pjw »

FPC seems now to have the best QL job name facilities on the planet :)


Per
dont be happy. worry
- ?
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 »

@pjw
Something tells me the bar wasn't set too high, but hey. :D Any victory is a victory! :ugeek: Anyway, as said earlier, now documented.


Post Reply