Seth Fischer wrote: > The directives EQU and CBLOCK appear to me to do the same job, > What is the difference and in what circumstance would each be used? Seth: You're correct; they do the same thing. CBLOCK is just an easier and less error-prone way to assign a series of symbols to sequentially-numbered values. With CBLOCK, for instance, you can assign a bunch of labels to file registers thusly: CBLOCK 0x20 TEMP TEMP1 FLAGS BIGNUM,2 REALBIG,4 OUTPUT ENDC With EQU, you'd write: TEMP EQU 0x20 TEMP1 EQU 0x21 FLAGS EQU 0x22 BIGNUM EQU 0x23 REALBIG EQU 0x25 OUTPUT EQU 0x29 After the first time that you need to insert a label in the middle of a series like that, you'd probably get clever and write: TEMP EQU 0x20 TEMP1 EQU TEMP+1 FLAGS EQU TEMP1+1 BIGNUM EQU FLAGS+1 REALBIG EQU BIGNUM+2 OUTPUT EQU REALBIG+4 but that still isn't anywhere near as easy as CBLOCK. CBLOCK also allows easier code reuse, since a CBLOCK/ENDC block without a starting constant implies a starting constant one greater than the last one in the previous CBLOCK/ENDC block. For example, you can have a routine that includes both code and a CBLOCK/ENDC block... Something like this: CBLOCK FOOREG1 FOOREG2 ENDC FOO: NOP ;Do something that uses FOOREG1 and FOOREG2. RETURN Then, if you cut-and-paste (or "include") that function into another program that already has a CBLOCK, FOOREG1 and FOOREG2 will automatically be assigned to the next-available file registers. For example: CBLOCK 0x20 TEMP TEMP1 FLAGS BIGNUM,2 REALBIG,4 OUTPUT ENDC CBLOCK FOOREG1 ;FOOREG1 IS ASSIGNED TO REGISTER 0x2A FOOREG2 ;FOOREG2 IS ASSIGNED TO REGISTER 0x2B ENDC FOO: NOP ;Do something that uses FOOREG1 and FOOREG2. RETURN It's not foolproof, of course -- you still should check your LST file to ensure that your not trying to use non-existent file registers -- but it does make things a LOT easier. And... Philosophically speaking, I think it's best to specify only as much as is necessary, and to deliberately generalize as much of the rest as possible. For special-function registers like PORTA and INTCON, I'd use EQU because it's important that those labels be assigned to specific register numbers. For my own registers like TEMP and FLAGS, which can be located anywhere, I use CBLOCK as a way of documenting the fact that it's not important that they be located at specific locations. -Andy === Andrew Warren --- aiw@cypress.com === IPD Systems Engineering, CYSD === Cypress Semiconductor Corporation === === Opinions expressed above do not === necessarily represent those of === Cypress Semiconductor Corporation -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body