Address register usage

Anything QL Software or Programming Related.
Post Reply
User avatar
Whopper
Over Heated PSU
Posts: 126
Joined: Tue Oct 24, 2017 4:04 pm

Address register usage

Post by Whopper »

Hi All,

It's stupid question time, again!

I'm doing some assembler programming and wonder what the 'normal' usage of address registers A4, A5 & A6 are.

Can I use these with impunity? Will the civilisation as we know it collapse? OK, maybe not quite that bad but are there problems or effects that I should be aware of.

Thanks for your guidance,

Whopper


You woke me for THAT!!!
User avatar
tofro
Font of All Knowledge
Posts: 2685
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Address register usage

Post by tofro »

Whopper wrote: I'm doing some assembler programming and wonder what the 'normal' usage of address registers A4, A5 & A6 are.
Definitely depends (I'm always in for useful answers ;) )

SuperBASIC extensions are not allowed to change A6 at any time, not even temporarily. all other registers are free to use.

EXECutable jobs are free to use all registers but will receive some values from the system, so make sure you use or store these values before you change the registers in any way.

a6 normally points to the start address of a job when it is created
a6+a4 is pointing to the data space of the job
a6+a5 is pointing to the end of the data space

Just by convention, most people tend to use a6 as the base address of the data space (once they have redirected it from the job's start address). SuperBASIC does more or less the same.

Device driver code has much more restrictions on the usage of registers which I won't go into here.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
Whopper
Over Heated PSU
Posts: 126
Joined: Tue Oct 24, 2017 4:04 pm

Re: Address register usage

Post by Whopper »

Thanks Tobias.

Whopper


You woke me for THAT!!!
Post Reply