Richard Zinn wrote: > 1. ORG - Assembler directive right? To make sure the actual code gets > stored in the correct memory bank location? Right, but it only works in absolute mode, which is a historic relic and otherwise bad idea. > 2. CODE - Assembler directive? Yes. This essentially replaces ORG in relocatable mode. This is what you should be using. > I guess my real question for ORG and > CODE is what would happen if I didn't address the correct memory > locations or left them out completely? I don't know what happens when you leave out ORG, and I don't care since its only for absolute mode anyway. CODE does more than set the starting location for code. In fact it only optionally sets the starting location. Most of the time, you don't put an argument behind CODE so that the linker can place the code wherever it wants to. About the only exceptions are the reset vector which has to be at 0, and the interupt vector which has to be at 4 (on 16 family). Anyway, CODE sets the linker section for subsequent code. There is no default executable code section, so you will get an assembly error if you write executable code not preceeded by CODE. > Is there some documentation > on this somewhere? Of course. "MPASM User's Guide with MPLINK and MPLIB", DS33014G. > 3. EQU - why use EQU instead of #define? Define and EQU are both > assembler directives right? Sortof. EQU explicitly defines an assembly time symbol. #DEFINE defines a string substitution macro. Short answer: use EQU unless you really really need #DEFINE. > 4. res - Is this just reserving memory for a register? Yes. > What are the > units used here, a word? No, bytes. All PICs have byte-addressable data memory. > 5. What is this? > cblock 0x20 > count > endc Bad code. This is an old fashioned way of defining symbols to correspond to data memory addresses. There are two problems with this. First, the starting address is hard coded, which can cause problems when moving to a different PIC where general data memory starts at a different address. Second, it only defines the symbols without allocating the RAM. Another CBLOCK could assign symbols to the same RAM addresses. RES actually allocates the RAM. The linker makes sure that no data memory location is allocated more than once by a RES directive. > Anyone know where I can find documentation on these assembler > directives? Same manual mentioned above. ***************************************************************** Embed Inc, embedded system specialists in Littleton Massachusetts (978) 742-9014, http://www.embedinc.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body