[Coco] Assembly Code from within a C program.

coco at jechar.ca coco at jechar.ca
Fri Nov 3 08:26:51 EDT 2023


Thanks replaceing strlen with strlength eliminated the original errors
but it appears that the os9 directive in the assembly code is not
supported by CMOC as my results are now.

cmoc --os9 hi09a.c
hi09a.s(75) : ERROR : Undefined symbol I$WritLn
hi09a.s:00075  os9 I$WritLn

hi09a.s(79) : ERROR : Undefined symbol F$Exit
hi09a.s:00079  os9 F$Exit

So rather then pursue this further I would like to know how to write
an assembly program that takes parameters directly from the os.

For example a program HAYU that works like this

{Term | 02 }/DD:hayu
Hello ?

{Term | 02 }/DD:
{Term | 02 }/DD:hayu Pierre
Hello Pierre.

{Term | 02 }/DD:hayu Charlie
Hello Charlie.



On 2023-11-02 18:32, Pierre Sarrazin via Coco wrote:
> 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