This looks odd. Could be my pathetic C knowledge letting me down again, but it just does.
The bits you appear to be checking in the MSR are these:
bit 7-Main request. You check for 1 which is good, since that mean the data register is ready.
bit 6-Data I/O. You check for 1 which is right I think. The controller wanting to output data to the cpu.
bit 4-Busy bit. This is what got me curious. When this is set it means the controller is busy. So your read byte instruction only ever gets run if the controller is busy executing a command when execution reaches this "if" statement.
Data Rate Select Register is also port 0x3f4, but that shouldn't be a problem since you never write to it. Any reads from that port should (afaik) read the MSr which is what you want. You could always try using the alternative port (0x374 I think).
The other thing is this:
Can your read function handle both decimal and hex? Because you set the other 2 ports in hex, and this one in decimal. If not then port 0x50 is the parallel port I think. What you were probably trying to use was 0x80 which is the port Linux uses for delays.
**
Went and had a dig around my docs because I got curious. Apparently port 0x50 is used to control something called a "Serial Communications Chip" in some Olivetti computers (
Source: Ralf Brown's Port List). This isn't incredibly likely to be there, and reading non-existent ports is liable to cause problems.