[Coco] Assembly Code from within a C program.

Pierre Sarrazin sarrazip at sarrazip.com
Thu Nov 2 18:32:38 EDT 2023


Hi Charlie,

> asm {
> 	leax hello,pcr
> 	ldy #strlen
    [...]
> strlen:	equ *-hello
    [...]
> I get these errors.
>        hi09a.s(73) : ERROR : Bad operand (,pcr)
>        hi09a.s:00073  ldy #_strlen,pcr
> 
> Why is this not working ?

It appears that CMOC took strlen as the name of the strlen() function, so
it replaced it with _strlen,pcr, and that isn't usable anyway with ldy #.

I would recommend changing the strlen label to something else, like
helloLen, to avoid a clash.

Then, using ldy #helloLen should work.

-- 
Pierre Sarrazin <sarrazip @ sarrazip . com>


More information about the Coco mailing list