4 wire touch screen

I am trying to port touchscreen library in C for hifive1, i am using adc mcp3008 in which i will give two wires as inputs to the channel 1 and 2 in the ADC (Y+ and X-) from the TFT display.

Now my doubt is , as i was reading the getPoint()
i saw this portion

 getPoint(void) {
  int x, y, z;
  int samples[NUMSAMPLES];
  uint8_t i, valid;

  valid = 1;

  pinMode(_yp, INPUT);
  pinMode(_ym, INPUT);
  pinMode(_xp, OUTPUT);
  pinMode(_xm, OUTPUT);

#if defined (USE_FAST_PINIO)
*xp_port |= xp_pin;
*xm_port &= ~xm_pin;
#else
digitalWrite(_xp, HIGH);
digitalWrite(_xm, LOW);
#endif

#ifdef arm
delayMicroseconds(20); // Fast ARM chips need to allow voltages to settle
#endif

   for (i=0; i<NUMSAMPLES; i++) {
     samples[i] = analogRead(_yp);
   }

#if NUMSAMPLES > 2
insert_sort(samples, NUMSAMPLES);
#endif

#if NUMSAMPLES == 2
// Allow small amount of measurement noise, because capacitive
// coupling to a TFT display’s signals can induce some noise.

   if (samples[0] - samples[1] < -4 || samples[0] - samples[1] > 4) {
   valid = 0;
   } else {
   samples[1] = (samples[0] + samples[1]) >> 1; // average 2 samples
   }

#endif

   x = (1023-samples[NUMSAMPLES/2]);

   pinMode(_xp, INPUT);
   pinMode(_xm, INPUT);
   pinMode(_yp, OUTPUT);
   pinMode(_ym, OUTPUT);

#if defined (USE_FAST_PINIO)
*ym_port &= ~ym_pin;
*yp_port |= yp_pin;
#else

   digitalWrite(_ym, LOW);
   digitalWrite(_yp, HIGH);

#endif

#ifdef arm
delayMicroseconds(20); // Fast ARM chips need to allow voltages to settle
#endif

   for (i=0; i<NUMSAMPLES; i++) {
     samples[i] = analogRead(_xm);
   }

#if NUMSAMPLES > 2
insert_sort(samples, NUMSAMPLES);
#endif

#if NUMSAMPLES == 2
// Allow small amount of measurement noise, because capacitive
// coupling to a TFT display’s signals can induce some noise.

   if (samples[0] - samples[1] < -4 || samples[0] - samples[1] > 4) {
     valid = 0;
   } else {
     samples[1] = (samples[0] + samples[1]) >> 1; // average 2 samples
   }

#endif

   y = (1023-samples[NUMSAMPLES/2]);

   // Set X+ to ground
   // Set Y- to VCC
   // Hi-Z X- and Y+

   pinMode(_xp, OUTPUT);
   pinMode(_yp, INPUT);

#if defined (USE_FAST_PINIO)
*xp_port &= ~xp_pin;
*ym_port |= ym_pin;
#else
digitalWrite(_xp, LOW);
digitalWrite(_ym, HIGH);
#endif

   int z1 = analogRead(_xm); 
   int z2 = analogRead(_yp);

   if (_rxplate != 0) {
     // now read the x 
     float rtouch;
     rtouch = z2;
     rtouch /= z1;
     rtouch -= 1;
     rtouch *= x;
     rtouch *= _rxplate;
     rtouch /= 1024;
 
     z = rtouch;
    } else {
     z = (1023-(z2-z1));
   }

   if (! valid) {
     z = 0;
   }

   return TSPoint(x, y, z);
}

X+ , X-, Y+,Y-

when i connected X- and Y+ to the 2 channels of adc how can i do the above function?
As only 2 digital pins will be connected in hifive1 headers (i.e X+ & Y-) and spi pins from adc.