| UMBC CMSC 211 |
| Assembly | C/C++/Java |
|---|---|
| AND | & |
| OR | | |
| XOR | ^ |
#define OUTOFPAPER 8 /* 00001000b */
value = status & OUTOFPAPER; /* status is the printer status word
from the printer status port.
How it got into the variable status
is not important
for this example. */
if ( value != 0 )
{
printf( "Printer is out of paper.\n" );
}
msg db 'Printer is out of paper.', 10, 13,'$'
OUTOFPAPER EQU 00001000B
mov ax, status
and ax, OUTOFPAPER
mov ax, value
jne lab1 ; Flag set by the AND instruction
_PutStr msg
lab1: