Arduino PC Oscilloscope (measure negative voltage)

Hi everyone,
I want to make an arduino pc oscilloscope but as you know arduino can’t directly measure negative side.
That’s why i think connect serially a dc source (3 Vdc).The problem is that i dont know how to remove 3 Vdc in this type of coding.

Source : https://electronicsforu.com/electronics-projects/pc-based-oscilloscope-using-arduino

const int analogInPin1 = A0;
static int ctr,flag_tog;
static unsigned char adcval;

void setup()
{
Serial.begin(115200);

pinMode(13, OUTPUT);

ADCSRA = 0; // clear ADCSRA register
ADCSRB = 0; // clear ADCSRB register
ADMUX |= (0 & 0x07); // set A0 analog input pin
ADMUX |= (1 << REFS0); // set reference voltage
ADMUX |= (1 << ADLAR); // left align ADC value to 8 bits from ADCH register

// sampling rate is [ADC clock] / [prescaler] / [conversion clock cycles]
// for Arduino Uno ADC clock is 16 MHz and a conversion takes 13 clock cycles
//ADCSRA |= (1 << ADPS2) | (1 << ADPS0); // 32 prescaler for 38.5 KHz
ADCSRA |= (1 << ADPS2); // 16 prescaler for 76.9 KHz
//ADCSRA |= (1 << ADPS1) | (1 << ADPS0); // 8 prescaler for 153.8 KHz

ADCSRA |= (1 << ADATE); // enable auto trigger
ADCSRA |= (1 << ADIE); // enable interrupts when measurement complete
ADCSRA |= (1 << ADEN); // enable ADC
ADCSRA |= (1 << ADSC); // start ADC measurements
}

ISR(ADC_vect)
{
adcval = ADCH; // read 8 bit value from ADC
}

void loop()
{
Serial.write(adcval);

// Following code to generate ref signal at pin 13 @ 50HZ. You can connect A0 to see the waveform in PCScope.exe
ctr++;
if(ctr>117) //117=10.03ms
{
ctr=0;
flag_tog = !flag_tog;
digitalWrite(13, flag_tog);
}