TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Bob van der Poel 76510,2203 (X)
from: Kevin Darling 76703,4227
date: 1992-09-01 08:05:04
subject: #16358-Combining C and asm

#: 16362 S12/OS9/68000 (OSK)
    01-Sep-92  08:05:04
Sb: #16358-Combining C and asm
Fm: Kevin Darling 76703,4227
To: Bob van der Poel 76510,2203 (X)

Bob,

Well, I guess you could simply include the assembler equate, too:

 #define FOO 12345
 #asm
 FOO equ 12345
 #endasm

But what I do instead is to take such constants, and store them as variables:

 #define FOOVAL 12345
 static int foo;  /* foo is a variable */

 void setfoo()    /* This function called by main on init */
   {
    foo = FOOVAL;
   }

 void dofoo()    /* This function called to use foo from asm */
   {
   #asm
   move.l foo(a6),d0
   ...
   #endasm
   }

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.