🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #24

Re: Port 20h

#24
From: Brian Onn - OpCom Staff
Date: Mon, 02 Nov 1992 04:36
67 lines
3721 bytes
In article <1992Oct27.133937.60159@cc.usu.edu> sl8nl@cc.usu.edu writes:
> Question everyone.  We all know that:
>
>	   mov	al,20h
>	   out	20h,al
>
>  tells the processor to process the other interrupts.
>
>  What do other ALs do?  I'm interested in three in particular, when AL = 11h,
>  12h, and 13h.
>
>  Thanks!
>
>  Joshua Jensen

Values of 11h, 12h and 13h, when written to port 20h, signify the
start of an initialization sequence.  This is called ICW1
(Initialization Command Word 1), and is triggered by A0 == 0 (ie port
20, not port 21) and bit 4==1 in the byte written there.  ICW1 is
followed by a write of ICW2, and then possibly ICW3 (in a master/slave
PIC system; ie AT, not PC) and then followed by ICW4 if the
appropriate bit in ICW1 was set to indicate that you would be writing
an ICW4.  Make sense :-) Here's the picture of ICW1:

	b7   b6   b5    b4    b3   b2   b1   b0
        |__________|     1     |    |    |    |____ 1 = ICW4 needed
             |                 |    |    |_________ 1 = single, 0 = cascaded
          A7-A5 of             |    |______________ Call address interval
         Interrupt             |                      1 = 4 byte interval
       Vector  Address         |                      0 = 8 byte interval
       (MCS 80/85 mode)        |___________________ 1 = level triggered mode
                                                    0 = edge triggered mode


In your examples, 11h means no ICW4, cascaded mode, edge triggered
mode (The call address interval and interrupt vector address are
ignored in iAPx-88/86 mode). 12h means no ICW4 and single mode, edge
triggered.  13h means ICW4 needed, single mode and edge triggered.

to complete the picture, ICW2 is used to help generate vectoring
addresses (on MCS-80/85 systems) and vector bytes (on iAPX-88/86).

ICW3 is only present in cascaded systems, and is used to tell the
master which interrupt request line is a cascade input, and to tell
the slave its "slave id".  During an interrupt cycle, the master will
enable an interrupting slave to present it data onto the data bus at
correct times during the cycle.

ICW4 is used to control additional features of the 8259.  One of these is
the operational mode.  bit 0 in ICW4 controls whether the unit operates
in MCS-80/85 mode or iAPX-88/86 mode.  If b0 = 0 (the default if no ICW4
is sent) then the unit is set to MCS-80/85 mode.  This is not what you
want on a PC, so you should almost always see an ICW4.

BTW, the 20h in al in "out 20h,al" is the EOI (for End Of Interrupt),
and in a master/slave configuration (cascaded; ie PC-AT), you are
required to EOI both the master and the slave.  on the PC-AT and
clones, the slave PIC is at port A0h. The EOI is called an Operation
Control Word, or OCW.

Brian.
--
_____________________________________________________________________
Brian Onn.                  Internet : Brian.Onn@Canada.Sun.Com
Operation Commitment,	        Uucp : uunet!sun!suncan!brian
Product Support Specialist.    Voice : (416) 477-6745.
---------------------------------------------------------------------
Technical Details
Message-ID: <BRIAN.92Nov1233658@ganglion.Canada.Sun.COM>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!rutgers!sun-barr!news2me.EBay.Sun.COM!seven-up.East.Sun.COM!newscan!newscan!brian
References: <1992Oct27.133937.60159@cc.usu.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!rutgers!sun-barr!news2me.EBay.Sun.COM!seven-up.East.Sun.COM!newscan!newscan!brian
From: brian@ganglion.Canada.Sun.COM (Brian Onn - OpCom Staff)
Newsgroups: alt.msdos.programmer
Subject: Re: Port 20h
Message-ID: <BRIAN.92Nov1233658@ganglion.Canada.Sun.COM>
Date: 2 Nov 92 04:36:58 GMT
References: <1992Oct27.133937.60159@cc.usu.edu>
Sender: news@newscan.canada.sun.com
Organization: /home/brian/.organization
Lines: 67
In-Reply-To: sl8nl@cc.usu.edu's message of 27 Oct 92 19:39:37 GMT
Nntp-Posting-Host: ganglion