🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.ibm.pc.programmer
Article #1033

Re: Programming the keyboard port

#1033
From: RAMontante
Date: Thu, 16 Aug 1990 02:10
28 lines
1853 bytes
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.
Technical Details
Message-ID: <54557@iuvax.cs.indiana.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!iuvax!bobmon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!iuvax!bobmon
From: bobmon@iuvax.cs.indiana.edu (RAMontante)
Newsgroups: comp.sys.ibm.pc.programmer
Subject: Re: Programming the keyboard port
Message-ID: <54557@iuvax.cs.indiana.edu>
Date: 16 Aug 90 02:10:19 GMT
Organization: malkaryotic
Lines: 28