Hi
The buffer you described is known as so called ring-buffer and a usual buffer for serial input.
If you use an existing DOS program to get the data from the serial port you should think about writing this data into a PIPE instead of the ramdisk and read the data to be compared from this PIPE. There is an existing device called PIPE: implemented in the AmigaOS, I'm not shure about the restrictions of this device but it might be used for this purpose.
Noster