[Coco] inline asm in C

T. Franklin tim at franklinlabs.com
Thu Nov 1 14:49:43 EDT 2012


I'm not sure what compiler you are using but most compilers that I've used put local & passed variables on the stack unless they are declared static. The exact offset from the stack is up to the compiler and can change for each function instance depending on the compilers implementation.

Hope this helps.




-----Original Message-----
From: Bill Pierce [mailto:ooogalapasooo at aol.com]
Sent: Thursday, November 1, 2012 01:13 PM
To: coco at maltedmedia.com
Subject: Re: [Coco] inline asm in C

I don't know if this is what you want...I use RMA code in C programs and use VSECT and VSECT [DP] to store my variables used in the ML.Then they can be referenced by C code as "extern" and "extern direct"In ML they are as normal with VSECT in ",U" (lda data,u) and VSECT [DP] in DP (lda To: CoCoList for Color Computer Enthusiasts Sent: Thu, Nov 1, 2012 2:02 pmSubject: [Coco] inline asm in CHi,What is the best way to put your embedded asm code to work with your Clocal variables ?I'm using global variables to do so, but I wonder if there is a betterway like this:unsigned ASM1;unsigned ASM2;main(){ char *work_buf; unsigned start, fil_size;...ASM1 = work_buf + start;ASM2 = fil_size - start;#asm pshs a,x,y ldx ASM1 ldy ASM2_MOVE lda 1,x sta ,x+ leay -1,y bne _MOVE puls a,x,y#endasm}Thxs,-- Panasonic FSA1-WSXCommodore 64Commodore 64CCommodore 128Apple //cTRS-Color Computer 3TI-99/4A..and more coming!--Coco mailing listCoco at maltedmedia.comhttp://five.pairlist.net/mailman/listinfo/coco --Coco mailing listCoco at maltedmedia.comhttp://five.pairlist.net/mailman/listinfo/coco



More information about the Coco mailing list