Help me! Please explain this code for me

void CParallelPortDlg::UpdatePins()
{
     int reg;
     reg=_inp(STATUS);

     if((reg & 0x40)==0) m_pin10=0;     else m_pin10=1;
     if((reg & 0x80)==0) m_pin11=0;     else m_pin11=1;
     if((reg & 0x20)==0) m_pin12=0;     else m_pin12=1;    
     if((reg & 0x10)==0) m_pin13=0;     else m_pin13=1;
     if((reg & 0x08)==0) m_pin15=0;     else m_pin15=1;
     //////////
     reg=_inp(DATA);
    
     if((reg & 0x01)==0) m_pin2=0;     else m_pin2=1;
     if((reg & 0x02)==0) m_pin3=0;     else m_pin3=1;    
     if((reg & 0x04)==0) m_pin4=0;     else m_pin4=1;
     if((reg & 0x08)==0) m_pin5=0;     else m_pin5=1;
     if((reg & 0x10)==0) m_pin6=0;     else m_pin6=1;
     if((reg & 0x20)==0) m_pin7=0;     else m_pin7=2;
     if((reg & 0x40)==0) m_pin8=0;     else m_pin8=1;
     if((reg & 0x80)==0) m_pin9=0;     else m_pin9=1;
     //////
     reg = _inp(CONTROL);

     if((reg & 0x01)==0) m_pin1=0;      else m_pin1=1;
     if((reg & 0x02)==0) m_pin14=0;     else m_pin14=1;
     if((reg & 0x04)==0) m_pin16=0;     else m_pin16=1;
     if((reg & 0x08)==0) m_pin17=0;     else m_pin17=1;

     UpdateData(FALSE);
}

This is code that programming LPT port but i dont understand where

(reg & 0x10)==0
(reg & 0x20)==0
(reg & 0x40)==0
(reg & 0x80)==0

i think they must be

(reg & 0x16)==0
(reg & 0x32)==0
(reg & 0x64)==0
(reg & 0x128)==0

pls help me!

the prefix “0x” indicates that the number is in base 16 (hexadecimal)

Please don’t post with “Help me!”

In english, that’s an imperative - calling out a critical/dire situation.

if((reg & 0x40)==0) m_pin10=0; else m_pin10=1; 

could be written like

if((reg & _BV(4)) == 0){ 
     m_pin10 = 0;
}else{
     m_pin10 = 1;
}

its a whole bunch of ‘if bit n is set in A, set bit m in B’

your snippet looks like something from the parallel lcd routines, cross mapping bits from one byte to another

if((reg & 0x40)==0) m_pin10=0; else m_pin10=1; 

could also be written as

m_pin10 = (reg & 0x40) > 0;

or more esoteric, in C

m_pin10 = (reg & 0x40) ? 1 : 0;

m_pin10 = ( (reg & 0x40) != 0); // this one adds clarity, but probably same asm code result