[Icc-mot] Inline asm quirks
Edward Karpicz
ekarpicz at freemail.lt
Thu Mar 29 03:11:55 PST 2007
> Using v7.02...
>
> Local data used in inline assembly goes wrong when address calculation is
> required. The simplest example follows:
>
> ; asm(" adcb %data[3]");
> adcb 26,S[3]
Not only with local data. I of course would prefer more intelligent % in
inline asm, but inline ICC asm was always the same, it didn't handle
anything else than just replacing %variable to variable label if global or
N,s (or N,x in V6).
However I wonder how could inline asm handle for example %var1[var2]? Should
compiler add code to compute the address of var2-th
element of var1? Bad idea because % used not in the first line of inline asm
can break our inlined code. I'm talking about this:
asm(" ...");
asm(" ...");
asm(" ...");
compiler putting here % support code can break our code.
asm(" xx %yy");
In your example, if data is char[] then I would write it this way
asm(" adcb 3+%data"); // this should work and compile to
adcb 3+26,S
>
> Any pointer variable generates similar output, where the value is added to
> the stack pointer reference rather than the offset.
>
> ; asm(" adcb %data_ptr->uc[1]");
> adcb 9,S->uc[1]
>
This your code can't fit single asm line.
"adcb %data_ptr->uc[0]" could be something like "adcb [9,S]"
but there's no single line solution for
adcb %data_ptr->uc[1]
Edward
>
> --
> Gene Norris
> Chief Engineer
>
> SPOT Engineering, Inc.
> 1261 Campground Road
> Lancaster, Ohio 43130
> 740.654.0880
> FAX.654.0889
>
> http://www.spotengineering.com/
>
> _______________________________________________
> Icc-mot mailing list
> Icc-mot at imagecraft.com
> http://dragonsgate.net/mailman/listinfo/icc-mot
>
More information about the Icc-mot
mailing list