A programming question

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

A programming question

Post by pjw »

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
dont be happy. worry
- ?
User avatar
janbredenbeek
Super Gold Card
Posts: 629
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: A programming question

Post by janbredenbeek »

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
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: A programming question

Post by tofro »

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
Super Gold Card
Posts: 629
Joined: Wed Jan 21, 2015 4:54 pm
Location: Hilversum, The Netherlands

Re: A programming question

Post by janbredenbeek »

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

Re: A programming question

Post by pjw »

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
dont be happy. worry
- ?
Nasta
Gold Card
Posts: 443
Joined: Sun Feb 12, 2012 2:02 am
Location: Zapresic, Croatia

Re: A programming question

Post by Nasta »

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

Re: A programming question

Post by pjw »

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
dont be happy. worry
- ?
Post Reply