Page 2 of 2

Re: Assembly eMagazine - What do you want to read about?

Posted: Fri Jan 24, 2025 9:22 pm
by martyn_hill
tofro wrote: Fri Jan 24, 2025 9:00 pm That doesn't happen. Ever. :)
Oh, no, not ever :-) Probably a bad/controversial example, that one!

I realise now that I didn't articulate the scenario itself very well and perhaps its a moot point, but when we know the absolute address we want to load into an A reg, wouldn't the two forms (LEA <label> and MOVEA #<immediate_add>) achieve the same result, assuming <label> falls at <immediate_add> and exists in our code block?

If so, I guess the decision to use one or the other would then depend on whether we are writing for relocatable code or to a known, specific address (rare, on the QL)...

Re: Assembly eMagazine - What do you want to read about?

Posted: Fri Jan 24, 2025 9:39 pm
by tofro
martyn_hill wrote: Fri Jan 24, 2025 9:22 pm
tofro wrote: Fri Jan 24, 2025 9:00 pm That doesn't happen. Ever. :)
Oh, no, not ever :-) Probably a bad/controversial example, that one!

I realise now that I didn't articulate the scenario itself very well and perhaps its a moot point, but when we know the absolute address we want to load into an A reg, wouldn't the two forms (LEA <label> and MOVEA #<immediate_add>) achieve the same result, assuming <label> falls at <immediate_add> and exists in our code block?

If so, I guess the decision to use one or the other would then depend on whether we are writing for relocatable code or to a known, specific address (rare, on the QL)...
If you specify the value of the label with an EQU, the value will be absolute (and your two example instructions will do exactly the same thing). If you reference to data defined in your own program (to a label in front of a dc.l, for example), the assembler will assume you want a PC-relative address (and the move.l #label will not work without a warning).

A better example where absolute addressing is really necessary and acceptable would maybe be the QL hardware registers at $18000+ (like MC_STAT or PC_INTR), because QDOS doesn't have an easy way to tell you where they are, and you might be able to verify your program runs on a black box QL before (and you'll likely be doing dirty things anyhow...).

Re: Assembly eMagazine - What do you want to read about?

Posted: Sat Jan 25, 2025 11:22 am
by Martin_Head
martyn_hill wrote: Fri Jan 24, 2025 5:36 pm Hi Norm!

A topic I still to this day struggle-with is the concept of 'SECTION's, relocatable directives, when I can and can't use DS blocks, LINKing and related features of QMAC and similar assemblers.
I would second that, I've recently just tried writing a machine code program in separate parts and linking them together with the QMAC linker for the first time. And I had a lot of trouble trying to understand what I had to do, how to write the LINK file, and drive the linker. Also some help on how to use QMAKE. Which I still haven’t got to work yet.

Re: Assembly eMagazine - What do you want to read about?

Posted: Sat Jan 25, 2025 6:19 pm
by Derek_Stewart
Hi,

I thought that QMAKE used the same link files as the QMAC assembler and was compatible with Tony Tebby Linker.

Re: Assembly eMagazine - What do you want to read about?

Posted: Sat Jan 25, 2025 6:24 pm
by tofro
Derek_Stewart wrote: Sat Jan 25, 2025 6:19 pm Hi,

I thought that QMAKE used the same link files as the QMAC assembler and was compatible with Tony Tebby Linker.
Yes it does. But you still need to know how to write the linker control file. :)

Re: Assembly eMagazine - What do you want to read about?

Posted: Sat Jan 25, 2025 6:31 pm
by Derek_Stewart
I have also processed:
Assembly Language Programming on the Sinclair QL programming the 68008 micprocessor, by Andrew Pennell

viewtopic.php?p=48231#p48231

Re: Assembly eMagazine - What do you want to read about?

Posted: Sun Jan 26, 2025 7:04 am
by NormanDunbar
Derek_Stewart wrote: Sat Jan 25, 2025 6:31 pm I have also processed:
Assembly Language Programming on the Sinclair QL programming the 68008 micprocessor, by Andrew Pennell

viewtopic.php?p=48231#p48231
Indeed you have Derek, an excellent recommendation, thanks.

Cheers,
Norm.