[Coco] inline asm in C
    Bill Pierce 
    ooogalapasooo at aol.com
       
    Thu Nov  1 14:13:15 EDT 2012
    
    
  
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 <data)
If you want use them from C make sure you put a ":" (colon) after the label as that makes it global i.e.
Data: rmb 2
Not sure if that's what you are refering to or not...
hope it helps
Bill P
Music from the Tandy/Radio Shack Color Computer 2 & 3
https://sites.google.com/site/dabarnstudio/
Bill Pierce
ooogalapasooo at aol.com
-----Original Message-----
From: Retro Canada <retrocanada76 at gmail.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Sent: Thu, Nov 1, 2012 2:02 pm
Subject: [Coco] inline asm in C
Hi,
What is the best way to put your embedded asm code to work with your C
local variables ?
I'm using global variables to do so, but I wonder if there is a better
way 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-WSX
Commodore 64
Commodore 64C
Commodore 128
Apple //c
TRS-Color Computer 3
TI-99/4A
..and more coming!
--
Coco mailing list
Coco at maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco
 
    
    
More information about the Coco
mailing list