Can I use the same Data Registry for both input and output pins? This is for a class in which we are not allowed to use the Arduino Library (Not my choice or preference). I know to use DDRB for the B pins. This is the code that I have so far:

//Global pointers
unsigned char *portDDRB = (unsigned char *) 0x24;
unsigned char *portDataB = (unsigned char *) 0x25;
unsigned char *portPinB = (unsigned char *) 0x23;

void setup () {
  //For the led output I know that I would do this
  *portDDRB |= 0x80;
}

void loop () {
   //And here the code would be like this to light up the light:
   if (condition to turn on light) {
     *portDataB |= 0x80;
   }
   // To Turn off the LED:
   if (condition to turn off the light) {
     *portDataB &amp;= 0x7F
   }
}


I would like for the light to turn on when the input of PB4 is HIGH (from a button press). I just am not sure on what to put in the condition statements or the setup functions. 

When I set the DDRB to 0x80, is that just making the PB7 an output and the rest as input?

I am using the Arduino Mega ATmega2560 btw.

From the comments I have this:

//Global pointers
unsigned char *portDDRB = (unsigned char *) 0x24;
unsigned char *portDataB = (unsigned char *) 0x25;
unsigned char *portPinB = (unsigned char *) 0x23;

void setup () {
  //For the led output I know that I would do this
  *portDDRB |= 0x80;
}

void loop () {
   //And here the code would be like this to light up the light:
   if (portPinB &amp; 0x10) {
     *portDataB |= 0x80;
   }
   // To Turn off the LED:
   else {
     *portDataB &amp;= 0x7F
   }
}
Assuming the button is connected between GND and pin 10, without any pull-ups or pull-downs.

void setup () {
    //For the led output I know that I would do this
    DDRB = 0;             // set all pins on port B to INPUT
    DDRB |= _BV(DDB7);   // set PB7 to OUTPUT
    PORTB = 0;            // set all pins on port B to LOW
    PORTB |= _BV(PORTB4); // enable the pull-up resistor on PB4
}

void loop () {
    if( PINB &amp; _BV(PINB4) )
    {
        // if bit PINB4 is set, the button is not pressed
        PORTB &amp;= ~_BV(PORTB7); // turn off led
    }
    else
    {
        PORTB |= _BV(PORTB7); // turn off led
    }
}