&& (and) fuction in assembly language

Thread Starter

BANnY

Joined Dec 16, 2008
1
Hi all,

I am using PIC16F877A , Assembly language, MPLAB v8.1, how should i write the && function in assembly language??? thank you
 

hgmjr

Joined Jan 28, 2005
9,027
The && operator is associated with a comparison in which one binary value is ANDed with another binary value often referred to as a mask. The original value being compared is unaltered.

hgmjr
 

n9352527

Joined Oct 14, 2005
1,198
There is a bitwise and (andwf) in PIC assembler. There is no straight && that works with whole registers. It is wasteful on resources to use one whole register for boolean logic. Most things can be done with andwf, instead of whole logical &&. Elaborate more on what you are trying to do, then we'd try to figure out on how to do it.
 

RiJoRI

Joined Aug 15, 2007
536
Logical AND (&&) is simply a convention used by C (and perhaps other languages). The micros I've come across only have a bitwise AND. Using the C TRUE/FALSE convention (0 is FALSE, everything else is true) allows the logical AND effect.
Rich (BB code):
;if( Monday && Noon)
    LD    A,MONDAY
    AND  A,NOON
    IFEQ A,@00
     JP    ELSE_1

;if(Monday & Noon)
    LD    A,MONDAY
    AND  A,NOON
    IFEQ A,@00
     JP    ELSE_2
--Rich
 
Top