As per the title, I've got an inline asm block in which I'm using iyh and iyl z80 registers such as for example the following fragment:
__asm
ld d,iyh
ld iyl,#0x00
__endasm;
and my source won't compile. It's blaming me (twice - one for each line) for using an
Error: (a) machine specific addressing or addressing mode error
how can I fix this?
I'm using
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.6.0 #9615 (MINGW32)
published under GNU General Public License (GPL)
Thanks!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This may cause errors if you are allowing the peepholer to look into inlined asm; at the minimum the peepholer won't be able to look through the "defb".
(I personally prefer to completely separate asm source from c source to keep the c portion portable and to have control over things like area assignment. It's fairly easy to do :- there's a brief example here for the z80 where a simple "cpm.s" assembly file provides a couple of bdos functions. Normally you'd have to add a function prototype in a header to make the compiler aware of an asm function but "putchar" is already prototyped by sdcc in stdio.h so that doesn't have to be done here)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As per the title, I've got an inline asm block in which I'm using iyh and iyl z80 registers such as for example the following fragment:
and my source won't compile. It's blaming me (twice - one for each line) for using an
how can I fix this?
I'm using
Thanks!
asz80 does not support those undocumented instructions. There's some previous discussion here .
You can probably get away with doing something like:
This may cause errors if you are allowing the peepholer to look into inlined asm; at the minimum the peepholer won't be able to look through the "defb".
(I personally prefer to completely separate asm source from c source to keep the c portion portable and to have control over things like area assignment. It's fairly easy to do :- there's a brief example here for the z80 where a simple "cpm.s" assembly file provides a couple of bdos functions. Normally you'd have to add a function prototype in a header to make the compiler aware of an asm function but "putchar" is already prototyped by sdcc in stdio.h so that doesn't have to be done here)
I think it's funny that those instructions are still treated as 'undocumented'... it's completely useless nowadays IMHO.
BTW, back in topic, it seems I can't use
when I do, all I get is
is that defb something I can't use in a inline asm block?
That should be .db insteaf of defb.
Philipp