[comp.os.msdos.programmer] Programming the keyboard port

TOMIII@MTUS5.BITNET (Thomas Dwyer III) (08/14/90)

According to my "Z-386/AT Series Workstation Technical Reference
Manual, Volume II Programmable Registers" book, page 17-2 it says:

  The Status Register (Port 064H)

  The Status register is an 8-bit read-only register. [text ommited]


Now on page 17-3 it says:

  Command Register (Port 064H)

  The command register is an 8-bit write-only register, addressed at I/O
  port 064H. [text ommited]


Ok people, how can the same port be both read-only and write-only?  Am
I missing something?  Am I correct in thinking that if I write a SCP
command (page 17-5) to port 064H than I can read the results of the
command from port 060H?  My tests show that any value written to port
064H followed by a read of port 060H results in a 01CH being read.

Any help on this would be most appreciated.

Thanks,
Thomas Dwyer III                            TOMIII   @ MTUS5.BITNET
Network Programmer                          DWYERIII @ MTUS5.BITNET
Computing Technology Services
Michigan Technological University

foss@iris.ucdavis.edu (Jim Alves-Foss) (08/16/90)

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. */

everett@hpcvra.CV.HP.COM (Everett Kaser) (08/16/90)

/ TOMIII@MTUS5.BITNET (Thomas Dwyer III) /  8:41 am  Aug 14, 1990 / writes...
>According to my "Z-386/AT Series Workstation Technical Reference
>Manual, Volume II Programmable Registers" book, page 17-2 it says:
>  The Status Register (Port 064H)
>  The Status register is an 8-bit read-only register. [text ommited]
>Now on page 17-3 it says:
>  Command Register (Port 064H)
>  The command register is an 8-bit write-only register, addressed at I/O
>  port 064H. [text ommited]
>Ok people, how can the same port be both read-only and write-only?  Am
>I missing something?  
>
>Thomas Dwyer III                            TOMIII   @ MTUS5.BITNET

"Port" 64h is NOT read-only or write-only, it can be both read and written.
The "Status Register" (which is accessed by READing PORT 64h) is read-only.
The "Command Register" (which is accessed by Writing PORT 64h) is write-only.
Be careful not to confuse a CPU I/O port with the hardware to which it's
interfaced.

Everett Kaser                   Hewlett-Packard Company
...hplabs!hp-pcd!everett        work: (503) 750-3569   Corvallis, Oregon
everett%hpcvra@hplabs.hp.com    home: (503) 928-5259   Albany, Oregon

dgil@pa.reuter.COM (Dave Gillett) (08/16/90)

In <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? 
>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)).

Basically the right answer, except that the 8086 architecture allows for 16-bit
port addresses, so that's 64K in and 64K out.  IBM only ran ten bits of the
port address out to the expansion bus, but that's still 1K of each and not 256.
(I think I've seen MCA port addresses higher than 1K, but I'm not 100% sure.)
                                        Dave

fzsitvay@techbook.com (Frank Zsitvay) (08/18/90)

In article <90226.104110TOMIII@MTUS5.BITNET> TOMIII@MTUS5.BITNET (Thomas Dwyer III) writes:
>According to my "Z-386/AT Series Workstation Technical Reference
>Manual, Volume II Programmable Registers" book, page 17-2 it says:
>
>  The Status Register (Port 064H)
>
>  The Status register is an 8-bit read-only register. [text ommited]
>
>
>Now on page 17-3 it says:
>
>  Command Register (Port 064H)
>
>  The command register is an 8-bit write-only register, addressed at I/O
>  port 064H. [text ommited]
>
>
>Ok people, how can the same port be both read-only and write-only?  Am

   When you write to port 064H you write to the command register.  When
you read from 064H, you read the status register, not the contents of
the command register.

   zilog has been confusing programmers with this for years...



-- 
fzsitvay@techbook.COM - one of these days i'll get it right...

Version 2 of anything is usually the version that works.

Ralf.Brown@B.GP.CS.CMU.EDU (08/28/90)

In article <328@saxony.pa.reuter.COM>, dgil@pa.reuter.COM (Dave Gillett) wrote:
}Basically the right answer, except that the 8086 architecture allows for 16-bit
}port addresses, so that's 64K in and 64K out.  IBM only ran ten bits of the
}port address out to the expansion bus, but that's still 1K of each and not 256.
}(I think I've seen MCA port addresses higher than 1K, but I'm not 100% sure.)

Er....	All 16 I/O address bits are available on the bus, but only the low
10 bits are decoded for motherboard devices on pre-PS2 systems (thus the clock
chip appears not only at 0040h-0043h, but also at 0440h-0443h, 0840h-0843h,
etc).
--
UUCP: {ucbvax,harvard}!cs.cmu.edu!ralf -=- 412-268-3053 (school) -=- FAX: ask
ARPA: ralf@cs.cmu.edu  BIT: ralf%cs.cmu.edu@CMUCCVMA  FIDO: 1:129/3.1
Disclaimer?    |   I was gratified to be able to answer promptly, and I did.
What's that?   |   I said I didn't know.  --Mark Twain