This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Coding standards: EQU vs DS

(1) Is there a coding standard for 8051 assembler regarding use of:

foo equ 80h   ; some idata

and

foo:  ds 1
?

(2) What is your opinion?

Parents
  • "I ... intend to have our subcontractor change it."

    In my entirely objective, unbiased, and impartial opinion, I'm sure you could find far better things for your subcontractor to do... ;-)
    (unless, of course, you were asking me to quote for this as a subcontractor...)

    "I hope to find a document that mandates or, at least, highly recommends the use of DS over EQU."

    But wasn't that the precisely point that both Drew and I were making: DS and EQU are entirely different beasts - each has its own place, and anything that blindly mandates (or recommends) one over the other must be inherently flawed!?

Reply
  • "I ... intend to have our subcontractor change it."

    In my entirely objective, unbiased, and impartial opinion, I'm sure you could find far better things for your subcontractor to do... ;-)
    (unless, of course, you were asking me to quote for this as a subcontractor...)

    "I hope to find a document that mandates or, at least, highly recommends the use of DS over EQU."

    But wasn't that the precisely point that both Drew and I were making: DS and EQU are entirely different beasts - each has its own place, and anything that blindly mandates (or recommends) one over the other must be inherently flawed!?

Children
  • Sorry. I did not mean to imply one over the other in all cases.

    My intent was that for variables DS be used instead of EQU.

    I also agree that our sub has more important things to do with his time.
    Doug

  • ds a
    ds b
    ds c

    will automatically allocate separate spaces

    a equ 8
    b equ 9
    c equ 10

    works as well BUT if these get mixed up it EXTREMELY likely that some day some 'small program change' will result in two variables in same slot

    a equ 8
    b equ (a+1)
    c equ (b+1)

    does in some way remove the danger of the above.

    The one important thing here is to have ALL variables in the same place or you may end up with the stack in a place where you do not want it to be.

    Erik