This is Delphi 4 project with setup.
The RS-232 to RS-485 adapter which I applied used RTS line to control flow direction.
Unfortunately all comments and some messages are in russian but I have no time to translate it.
The main problem with this is controlling the data transfer direction. There is no way to detect that all bytes in the packet are sent so I used simply delay technique. But because Windows(r) is not a real time OS does not work well all the time. That is why please don't start MS Office nor play CS nor do anything else resource-intensive during erasing-programming process