Kevin Lineberry wrote: > I need to write a function in asm but the program is a c one. > Here is the c version > > static byte a; > void MySub() > { > a=a+1; > } > > I require MySub() to be in asm, but to be callable from c or inline > Any help will be appreciated. > Note: > I use mcc18 Check the manual for "inline assembler" or "pragma" or "asm" or "#asm" or similar terms. I don't know mcc18, and this is a very compiler-specific topic, but it could be something like this static byte a; void MySub() { asm( "inc _a,1" ); } Besides knowing how to insert assembler statements, you have to know what assembler syntax your compiler uses (probably close to the MChip syntax, but possibly not exactly the same in all details), and you have to know how your compiler creates assembler symbols from the C language identifiers. They are usually somehow mangled and local variable identifiers often don't exist at all in the assembler source. If any of this isn't well documented, there may be the possibility to check out assembler listings generated by your compiler (if it does this, that is). This is then of course only some indication of how it works and may not reveal the full story. In any case, checking the listings is a good way to verify that your assembler code does what you want it to do, in the context of the compiler-generated code. Gerhard -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist