Re: Oh god
Back in the old days writing code to read serial data from an RS232 line was hell on earth - everything would work most of the time but never all of the time until I "discovered" Interrupts!
I was contracting at one of the parts of the Racal empire in the late 1980s. Our standard workhorse was an Olivetti M24SP running DOS, with no networking.
One of our suppliers tried to interest the company in the newfangled "PS/2" range from IBM, and someone managed to wangle the loan -- just for a day, because they were in short supply -- of a Model 30 (the crap one with the 8-bit CPU and, more importantly for us, an ISA expansion bus rather than MCA). We had developed an ISA bus encryption card, and wanted to see whether it would work in the PS/2.
What could be easier? Just copy the software onto a diskette and ... Oh, No! Our Olivettis all had 5.25" floppy drives, but the PS/2 had a 3.5" drive.
So, we found a laplink cable to connect the machines together. I wrote a little file sending routine in C to run on the olivetti, and a file receiving routine in assembler, in debug (it was all we had) on the PS/2, using the awful ROM BIOS serial port routines because that was the easiest thing to do. I implemented a very, very, simple handshake (I think I just echoed every character received) and ran a simple test. I don't think it worked first time, but before long it worked well enough to transfer the laplink software (and we all went for coffee while that transferred) and then we were in business.
Our hardware did work in the Model 30, and we were able to return the machine at the end of the day having run all the tests we needed. Before we gave it back, though, we got the supplier to give us a 3.5" floppy and we kept a copy of laplink, for the next time.
My little program, written in debug, is one "temporary fix" that was NOT kept beyond the first use.