[Coco] Assembly Code from within a C program.

dave at davebiz.com dave at davebiz.com
Fri Nov 3 11:19:42 EDT 2023


You can still make OS9 system calls with SWI followed by the appropriate code. 

-Dave Philipsen

> On Nov 3, 2023, at 7:27 AM, coco--- via Coco <coco at maltedmedia.com> wrote:
> 
> 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>
> 
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco



More information about the Coco mailing list