stever@Octopus.COM (Steve Resnick ) (08/16/90)
In article <7576@ucdavis.ucdavis.edu> foss@iris.ucdavis.edu (Jim Alves-Foss) writes: >In article <90226.104110TOMIII@MTUS5.BITNET> TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes: >>... >>Ok people, how can the same port be both read-only and write-only? Am >>I missing something? >>... >>Thanks, >>Thomas Dwyer III TOMIII @ MTUS5.BITNET >>Network Programmer DWYERIII @ MTUS5.BITNET >>Computing Technology Services >>Michigan Technological University > >Well, In the PC architecture we have 512 (not 256) ports. 256 are Input ports >and 256 are Output ports. Often a card will have a R/W register with a >single address. In your case you have TWO DISTINCT registers, one input >and one output but with the same address (064H(In) and 064H(Out)). > >Hope this helps. > >-Jim Alves-Foss (foss@iris.ucdavis.edu) /* Of course these are MY opinions */ > (foss@[127.120.57.20]) /* and may change without warning. */ I think you missed something here... the 80n806 supports 65535 ports, which can be r/o, r/w, w/o depending on the hardware designer. An example is the 8250 UART in which the receiver nad transmitter are the same port. If you write a value to the UART at 3F8H and the UART doesn't remove that byte you can read that value again. I can't comment on the keyboard, since I have never programmed the thing other than to make the lights dance on the AT keyboard. Consider, though, that since the com1 UART lies at port addresses 3F8-3FF your statement about 512 ports is wrong. Steve -- ---------------------------------------------------------------------------- steve.resnick@f105.n143.z1@FIDONET.ORG #include<std_disclaimer.h> Flames, grammar errors, spelling errrors >/dev/nul ----------------------------------------------------------------------------
bobmon@iuvax.cs.indiana.edu (RAMontante) (08/16/90)
Excerpted from: / TOMIII@MTUS5.BITNET (Thomas Dwyer III) / | The Status Register (Port 064H) | The Status register is an 8-bit read-only register. [text omitted] | Command Register (Port 064H) | The command register is an 8-bit write-only register, addressed at I/O | port 064H. [text omitted] | Ok people, how can the same port be both read-only and write-only? Am | I missing something? In this context, the command register is "write-only" in the sense that, if you write some command word to it, you cannot find out what command word you wrote by attempting to read it back --- if you try, you will instead get the contents of the status register. Similarly, you cannot change the status by writing to the status register. For example, in assembly language (or an HLL for that matter), it might seem natural to clear some status indicators by AND'ing the appropriate bits of the status register with 0. This will fail miserably, as the status register is read-only. You must instead write the appropriate command or commands to the command register (which happens to be at the same address). The appropriate command will not, in general, look like the AND of the current status with any intuitive mask value. It might be clearer if each register had a unique address. But once you're used to this stuff, the overloading of an address is not confusing, and in old small architectures the address space was small enough that it seemed worthwhile to reuse addresses in this manner.