ALCHP Common Heap

Anything QL Software or Programming Related.
Post Reply
tcat
Super Gold Card
Posts: 633
Joined: Fri Jan 18, 2013 5:27 pm
Location: Prague, Czech Republic

ALCHP Common Heap

Post by tcat »

Hi All,

I am reading some docs on QL assembly, along with QL Technical Guide.
I wish to learn more about QDOS heap management. I undesrtand that it maintains chained links of free and allocated blocks. The blocks are movable, and a relative pointer is therofore needed to access data in a user block.

But when does QDOS actually move blocks arround? Am I save that my block will not move when I write to or read from it, so I get valid data? Or do I have to care at all?

Many thanks in advance.

Tom


User avatar
tofro
Font of All Knowledge
Posts: 3091
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: ALCHP Common Heap

Post by tofro »

tcat wrote:Hi All,

I am reading some docs on QL assembly, along with QL Technical Guide.
I wish to learn more about QDOS heap management. I undesrtand that it maintains chained links of free and allocated blocks.
That's right. QDOS does, however, allocate memory for various purposes in various pools.
tcat wrote: The blocks are movable, and a relative pointer is therofore needed to access data in a user block.
The QDOS documentation is a bit vague in that respect - Memory you allocate through system calls like MT.ALLOC, MM.ALLOC or RESPR ( that is "ALLOCATION", "ALCHP" or "RESPR") is allocated at fixed addresses and won't move.

Memory allocated for SuperBASIC (like the name table, Basic variables, Basic Buffer area and some such) is, however, part of the SuperBASIC job and therefore movable (and thus always has to be addressed A6-relative).

tcat wrote:
But when does QDOS actually move blocks arround? Am I save that my block will not move when I write to or read from it, so I get valid data? Or do I have to care at all?
As above: SuperBASIC may move, but nothing in other jobs. If you're writing a SuperBASIC extension, you need to care (and address everything relative to A6), if you're writing a separate Job, you don't need to care.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
Post Reply