A programming question

Anything QL Software or Programming Related.
User avatar
pjw
Super Gold Card
Posts: 531
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

A programming question

Postby pjw » Fri Jul 19, 2019 6:26 pm

Can it safely be assumed that a RAM address can never be "negative" in a SMSQ/E system? Ie,
that so much of the system relies on the assumption that RAM will never exceed 2GB, that any negative
return from some function can be taken to be an error code rather than a valid address..?
Asking for a friend..


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
User avatar
janbredenbeek
Gold Card
Posts: 332
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: A programming question

Postby janbredenbeek » Fri Jul 19, 2019 10:02 pm

pjw wrote:Can it safely be assumed that a RAM address can never be "negative" in a SMSQ/E system? Ie,
that so much of the system relies on the assumption that RAM will never exceed 2GB, that any negative
return from some function can be taken to be an error code rather than a valid address..?
Asking for a friend..

On the Q68, the display memory starts at address $FE800000 and the internal I/O at $FF000000. So addresses can be 'negative' on this hardware.

Jan


User avatar
tofro
QL Wafer Drive
Posts: 1605
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: A programming question

Postby tofro » Fri Jul 19, 2019 10:28 pm

Agree that generally, an address can be negative (not only on the Q68, the Q40/Q60 have nearly the same layout).

Some internal routines in SMSQ/E and QDOS, however, like the queue and list support, do assume and rely on the fact that "normal", working memory addresses are always positive.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
janbredenbeek
Gold Card
Posts: 332
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: A programming question

Postby janbredenbeek » Fri Jul 19, 2019 11:15 pm

tofro wrote:Agree that generally, an address can be negative (not only on the Q68, the Q40/Q60 have nearly the same layout).
Some internal routines in SMSQ/E and QDOS, however, like the queue and list support, do assume and rely on the fact that "normal", working memory addresses are always positive.

This goes for the job and channel table too ($FFxxxxxx indicates an unused entry, else it's a pointer to the job header or channel definition block).
Fortunately, it's very unlikely that these would extend into the Q68's screen memory :) .

Jan


User avatar
pjw
Super Gold Card
Posts: 531
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: A programming question

Postby pjw » Sat Jul 20, 2019 12:37 am

I suspected the possibility regarding hardware addresses. So let me be more specific: A user RAM request will never, ever return a "negative" address, right?

I guess that by the time we see systems sporting 2 gig or more - in about 2029 Jan 19 03:14:08 (or more likely around 2097 Feb 06 06:28:15) - so many other things will have had to change that the issue will be moot anyways..


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb
Nasta
Gold Card
Posts: 337
Joined: Sun Feb 12, 2012 2:02 am
Location: Zapresic, Croatia

Re: A programming question

Postby Nasta » Mon Jul 29, 2019 12:42 am

It seems RAM is limited by compatibility with one of the superbasic compilers (Qliberator?) which used the top 3 bits of the address references to store data about the reference. These need to be 'don't care' for decoding (which also makes it 'fun' to write cache management code...), so only bits 28 down to 0 are used for addressing, resulting in 512M total RAM. This is of course a limitation on OS managed RAM, not things like frame buffer RAM for video, as this is not used to store programs. Hence, you should be safe and anything managed by the OS should never return a negative pointer to a RAM address.


User avatar
pjw
Super Gold Card
Posts: 531
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: A programming question

Postby pjw » Sun Aug 04, 2019 10:45 am

Nasta wrote:It seems RAM is limited by compatibility with one of the superbasic compilers (Qliberator?) which used the top 3 bits of the address references to store data about the reference. These need to be 'don't care' for decoding (which also makes it 'fun' to write cache management code...), so only bits 28 down to 0 are used for addressing, resulting in 512M total RAM. This is of course a limitation on OS managed RAM, not things like frame buffer RAM for video, as this is not used to store programs. Hence, you should be safe and anything managed by the OS should never return a negative pointer to a RAM address.
Knowledgeable and comprehensive answer as usual :) Thanks!


Per
Be wary of large West-Coast corporations bearing gifts!
- Ancient Trojan proverb

Who is online

Users browsing this forum: No registered users and 6 guests