In the evening today I implemented the PRG import feature in IECHost: I can now copy data from a PC to a real disk.
However, the work on this is not yet finished as I’ve been copying a chunk of memory initialised to a sample program, instead of a user-picked PRG file, for simplicity.
In order to further troubleshoot new features that write back to disk, I felt compelled to step back a bit and add some useful features before finishing the PRG import one.
In particular I added a quite flexible interface to IECHost that enables users to send commands to serial devices through the command channel. On my first attempt I roughly implemented the equivalent of:
In case you have not tried the above before in direct mode, it might surprise you that control is returned to the BASIC interpreter immediately while the disk is busy executing <command>, which might take a while if e.g. the command is about formatting a disk.
However, if you issue a CLOSE command while the disk is busy, you might appreciate the fact that control is not returned to the BASIC interpreter until the disk command completes:
This is due to the fact that a serial device on the IEC bus (e.g. a printer or floppy drive) might be busy performing a long job. In that case it will take a while to signal it’s ready to receive when the IEC host signals it’s ready to send by releasing the clock line. There’s no time limit when it comes to waiting for a device to become ready: that’s why CLOSE will not return to the BASIC interpreter until that happens.