openocd would tell you that it found different tapid. But i only see in the logs that input is all ones (or zeroes i dont remember) that suggests: wrong connection, disabled jtag.
Assembly part of the code was written by TNT. And yes, you have to wait one instruction cycle between writes to GPIO. It is stated somewhere in Datasheet, and typically overlooked (Sjaak knows ;) )
You need to learn how to use git diff (to produce patches), and git format patch (to produce formated patches).... Yet better, learn how to submit code directly to openocd tracking system. (its not that hard and you get proper credit)
Just be sure that the code does not break anything.
BP was sending data as reply to some command, and the command finished. BP was in the middle of tap_shift function, and still is there.
For the first flushing would suffice.
For the second case, there almost no real solution. You need to finish the sending of the tap data to end this function. (up to 2kb of data that needs to be sent). There is no side channel on which you can signal BP to restart (its a serial port). Using RTS/DTR could work, but not universal for all states in which BP can be. (user could have BP that is in transparent bridge mode, RTS DTR are ignored or else). For BPv4 it would be possible to send some "control usb packet" to reset buspirate, this would also need fw support. (and would no be compatible with BPv3)
for windows you should define something like "WIN32", so it switches to Windows' serial port handling routines.
There is a project for Codeblocks and it has not been updated for the very recent versions. Also note that you need fairly new firmware in buspirate, so that pic24 writing is supported. (6.2 and newer?)
I have tested bpv4 writing and reading, but havent played with piratepicprog since (that is almost year ago). But i doubt anyone touched it :) so it should be working.
dont select fast speed ... it seems that new computers are just tooo fast for this change :-) and buspirate wont react that fast. instead of fast type normal. (inthe openocd config)
That thread i pointed you to was clearly about openocd and you are trying to find some jtag menu, that has been removed few years back. there just isnt any :-)
i dont know what first or second operation is. But you should try the ols-fwloader. It is combined loader for FPGA bitstream and for the PIC Firmware. It should be fairly easy to compile on your own.