views:

162

answers:

4

Are there a Code Conventions for Assembly (mainly PIC)?

A: 

i don't think there's anything formal, but reading the coding samples on their website gives you a taste of the usual idioms. just be aware that there are lots of 'contributions' from many different hobbyists, and they might not be so nice.

also check other projects, most will have ugly code; but you'll find a gem or two.

i never did program on PIC, but liked to read the code. i vaguely remember a "real time OS" with a really nice and clean execution flow. don't remember how consistent was the coding style, but i'd start there.

it's better to read most of them and when it's as easy as prose, then you'll find your style

Javier
+5  A: 

I was able to find the Assembly Language Style Guide(PDF) which you might be interested in.

Bill the Lizard
This is the general style, but the comments are pretty lousy (too low-level or imprecise).
starblue
It's a good document to start. But it is as was commented above above
O Engenheiro
+3  A: 

When writing assembly, it's pretty helpful and not at all overboard to Comment Every Line

Alex Gartrell
I was just going to say something similar. I have some old assembly from years ago with few comments, and I don't understand any of it.
Zifre
A: 

I'm with Jason S -- use a C compiler if at all possible, even if you end up embedding a few lines of assembly language in your ".c" file using the "__asm" keyword.

If you must write entire programs in assembler for the PIC, the recommended function call convention is at PIClist: PIC Paging and PCLATH.

David Cary