Shop OBEX P1 Docs P2 Docs Learn Events
Assembly Code Examples for the Beginner - Page 4 — Parallax Forums

Assembly Code Examples for the Beginner

124»

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2014-01-12 20:21
    Sir Gawain wrote: »
    It seems to me that a potential advantage to the MUX method is that it deals with the current pin/s in the mind of the programmer and wont interfere should there be some other pins that other part of the code has set purposely. Why AND or XOR the whole INA or DIRA unless you really want to? It makes no difference on these simple and short code examples, but on more sophisticated pin sets it is better to have code applying only what ought to be applied... n'est pas?

    I see MUX used many times where the flag is purposely set before using the command. To me this seems like a waste of instructions. I think MUX is great if the value being "muxed" could be either high or low, but if it always going to be one or the other, OR and ANDN do the job with one less instruction. Like MUX, OR and ANDN only affect the pins in the mask and leave the other ones as they are.
Sign In or Register to comment.