r;
----------- (a)
First set up your buffer, setup 2 pointers to it, the serial interrupt uses one of them to write each byte, incrementing each time (ie a circular pointer). Ditto for your reading routine (use the other pointer). To flush the buffer set both pointers to the same number. You will not need to disable the serial interrupt. Your read routine must check the pointers are not the same before reading (buffer empty) the write routine must check they are not the same after writing (buffer overflow).