Page 1 of 1

Qdos GCC and inline assembly code

Posted: Sat Dec 31, 2022 3:02 pm
by SM7I
Hi all !

In most C compilers inline assembly is accepted in one way or another. Often just a matter of finding the correct syntax.
For a few days now I´ve searched for a source that could tell/show how to do this with Qdos GCC, but so far I´ve been unsuccesful. I´m using XorA qdos-gcc docker container.

Can anyone please shine a light on how to do this please ?

Re: Qdos GCC and inline assembly code

Posted: Sat Dec 31, 2022 3:32 pm
by tofro
In a nutshell, you simply pack your assembly statements in-between an asm volatile () bracket.

Code: Select all

void main () {
   asm volatile (
      "move.l #100,d0");
}
The volatile should be present to prevent GCC from over-eagerly optimizing away your precious code.

GCC knows an extended asm statement that allows you to specify input / output operands and clobbered registers:

Code: Select all

asm asm-qualifiers ( AssemblerTemplate 
                 : OutputOperands 
                 [ : InputOperands
                 [ : Clobbers ] ])
A description on how to specify these extended arguments to asm can be found here, for example.

Re: Qdos GCC and inline assembly code

Posted: Sat Dec 31, 2022 4:22 pm
by SM7I
That is exactly what I’ve tried, but when compiling gcc complains about jas missing :

Tried different variants, but same error.

Re: Qdos GCC and inline assembly code

Posted: Sat Dec 31, 2022 9:29 pm
by SM7I
Solved it....sat me down and figured about the error and more or less tried until I got it right :)