
Auto-Configuration

The auto-configuration ("autoconfig") protocol is designed to allow the 
dynamic assignment of available address slots to expansion boards, eliminating
the need for user configuration via jumpers.  Upon reset, each board appears
in turn at $E80000, with readable identification information, most of which 
is in one's complement format, stored in the high nibbles of the first $40 
words ($80 bytes) of the board.  This identification information includes 
the size of the board, its address space preferences, type of board (memory 
or other), and a unique Hardware Manufacturer number assigned by Commodore 
Amiga Technical Support.  

Each board contains configuration hardware including an address latch 
appearing in the nibble at offset $0048 and the nibble at offset $004a.  
When A23 through A16 of the assigned board base address are written to 
this register, the board latches and appears at the assigned address, 
and passes a signal called config-out which causes the next board to 
appear at $E80000.  To make certain types of boards less expensive, an 
expansion board's write registers may be organized as either a byte-wide 
or nibble-wide register.  If it is nibble-wide then it must latch the 
low nibble of the assigned address (at $4A) until the high nibble (at $48)
is written.  This allows the following algorithm to work with either 
type of board:

    Write the low order address nibble to offset $4A
    Write the entire address byte to offset $48

Alternately, many boards can be asked to "shut up" (pass config-out
and stop responding) by writing to offset $004c of the board.  A bit
in the nibble at offset $0008 flags whether a board supports shut-up.

All commercial expansion slot boards for the Amiga must implement the 
auto-configuration protocol.  More in-depth machine-specific information 
on the design and implementation of autoconfig boards is available from 
Commodore Amiga Technical Support.


The Amiga operating system contains support for matching up disk-based 
drivers with autoconfig boards. Since 1.3, the OS also supports initialization 
of onboard ROM driver software.  As a general rule, applications should not
attempt to autoconfig expansion peripherals, but rather should allow the
Amiga system software to handle all autoconfiguration.
Many boards contain registers which once activated could do irreparable 
damage to such things as a user's hard disk data if the board was configured 
improperly.

However, certain types of low level stand-alone applications may
need to configure hardware such as ram boards without using the
Amiga operating system.  Such applications should only configure expansion
ram boards (boards which ask to be added to the free memory list) and 
known dedicated boards designed for the application.  All other boards
should be "shut up" if the board supports shut-up, or configured and
ignored if shut-up is not supported (There are many boards which do not
support shut-up).   Configuration of boards should only be attempted
by applications which take over the whole machine at reset.  Presence
of an autoconfig board waiting for configuration is determined by
comparing the nibbles appearing at the initial autoconfig address
with the valid values for such nibbles in the specifications.

The autoconfig spec requires that boards be configured on boundaries
that match their space requirements.  For example, a one megabyte 
memory board should be configured on a 1 megabyte boundary.  There are 
two exceptions to this rule: boards with a 4 megabyte address space are 
capable of being placed at $200000 and $600000 as well as being placed on 
4 MByte boundaries; 8 MByte boards can be placed at $200000.  These 
exceptions are necessary because the eight megabyte space reserved for 
expansion in the current machine begins at $200000.



Debugging Autoconfig Boards
===========================

If there is a defect in your configuration information,  your board
may be ignored, shutup, or crash in a way that makes diagnosis
difficult.  A simple trick allows you to test the configuration
information.  Cut the configin* line to your board, and wire
a switch such that you either pass configin* or force the input
high.

Set the switch to the high position, and bring up the system.
Your board will be invisible to the system software.  Activate
a debugger, and flip the switch.  Your board should now respond
at the normal $E80000 address.  Your view of the board is identical to
what the Operating System sees when configuring your board.  You
can compare the bits with the expected values.



Address Specification Table
===========================

The following table describes the board identification information and
autoconfig registers which appear in the first $80 bytes of an
autoconfig board at configuration time.

Notes:
  
Identification information is stored in the high nibbles of the even (word) 
addresses at the start of an autoconfig board.  For example, the first two
words of a board might contain $Cxxx 1xxx.  The valid information in these
first two words would be the $C (high nibble of the word at offset $00), 
then the $1 (high nibble of the word at offset $02).  Much of the information
is interpreted by combining several nibbles, with low to high address 
nibbles containing high to low order parts of the resulting value.  

 
All nibbles of information except for those at offsets $00/02 and $40/42
are stored in an inverted (one's complement) form and must be exclusive 
OR'd with $F before interpreting them according to the table below.
Unused nibbles (the three other nibbles in each word) may not be assumed 
to contain any particular value.  All values written to the autoconfig
area, including the assigned address, are written uninverted.
 
All addresses are shown here as offsets from the base address $E80000
where boards appear at configuration time, so offset $02 is 
at $E80002, offset $04 at $E80004, etc. 


How to read the Address Specification Table:

              
Board Offset   
($00/02)	7  6  5  4   3  2  1  0	  Description of nibbles    
R/W info	\___  ___/   \___  ___/
		    \/           \/
	 Nibble at $E80000   Nibble at $E80002  

Note that the bit numbering ( 7 6 5 4  3 2 1 0 ) is for use when
two nibbles are to be interpreted together as a byte.  Physically,
each nibble is the high nibble of the word at its address (ie. bits
15 14 13 12).
 

 		     Address Specification Table

 OFFSET:	Address 1    Address 2		  Description
 ===========================================================================

($00/02)	7  6  5  4   3  2  1  0___ Board size  000=8meg   100=512k
 Read		|  |  |  |   |  \__|__/                001=64k    101=1meg
 Not Inverted	|  |  |  |   |                         010=128k   110=2meg
		|  |  |  |   |                         011=256k   111=4meg
		|  |  |  |   `----------  1 = Next card is also on this board   
		|  |  |  `--------------  1 = Optional ROM vector valid
		|  |  `-----------------  1 = Link into memory free list (RAM)
		|  `--------------\_____  
		`-----------------/       Board type	   00 = Reserved
					                   01 = Reserved
							   10 = Reserved
							   11 = Current type



($04/06)	7  6  5  4   3  2  1  0   Manufacturer chosen product number 
 Read		\___  ___/   \___  ___/
 Inverted	    \/           \/
		 Hi nibble   Lo nibble



($08/0A)	7  6  5  4   3  2  1  0   (Remember - these read inverted)
 Read		|  |  |__|___|__|__|__|_  Reserved - Should be 0 currently
 Inverted	|  | 
		|  `--------------------  0 = this board can be "shut up"
		|			  1 = this board ignores "shut up"
		|
		`-----------------------  0 = any space OK
					  1 = 8 Meg area preferred



($0C/0E)	7  6  5  4   3  2  1  0 
 Read		|__|__|__|___|__|__|__|_  Reserved - must be 0
 Inverted



($10/12)	7  6  5  4   3  2  1  0   High byte of unique hardware
 Read		\___  ___/   \___  ___/   manufacturer number assigned
 Inverted	    \/           \/       to manufacturer by CBM USA (CATS).
		 Hi nibble   Lo nibble    (Not developer number!)

($14/16)	7  6  5  4   3  2  1  0   Low byte of unique hardware
 Read		\___  ___/   \___  ___/   manufacturer number assigned
 Inverted	    \/           \/       to manufacturer by CBM USA (CATS).
		 Hi nibble   Lo nibble    (Not developer number!)


($18/1A)	7  6  5  4   3  2  1  0   Optional serial #, first byte (msb)
($1C/1E)	7  6  5  4   3  2  1  0   Optional serial #, second byte
($20/22)	7  6  5  4   3  2  1  0   Optional serial #, third byte
($24/26)	7  6  5  4   3  2  1  0   Optional serial #, fourth byte (lsb)
 Read
 Inverted

($28/2A)	7  6  5  4   3  2  1  0   High byte of optional ROM vector.
 Read		\___  ___/   \___  ___/   
 Inverted	    \/           \/       
		 Hi nibble   Lo nibble    
					  

($2C/2E)	7  6  5  4   3  2  1  0   Low byte of optional ROM vector.
 Read		\___  ___/   \___  ___/   If the "ROM vector valid" bit
 Inverted	    \/           \/       is set in nibble $00 at the start
		 Hi nibble   Lo nibble    of the board, then this optional
					  ROM vector is the offset from the
					  board base to ROM driver structures.


($30/32)  	7  6  5  4   3  2  1  0	  Read - Reserved, must be 00
 R/W	  				  Write - optional reset of
 Inverted  			             board base register to
	  			             pre-configuration address


($34/36)	7  6  5  4   3  2  1  0   Reserved, must be 00
($38/3A)	7  6  5  4   3  2  1  0   Reserved, must be 00
($3C/3E)	7  6  5  4   3  2  1  0   Reserved, must be 00
 Inverted

($40/42)	7  6  5  4   3  2  1  0      Write		 Read
 R/W		|  |  |  |   |  |  |  |
Not Inverted  	|  |  |  |   |  |  |  `-  Interrupt enable   Interrupt enable
	  	|  |  |  |   |  |  `----  User definable     Undefined
	  	|  |  |  |   |  `-------  Local reset	     Must be 0
	  	|  |  |  |   `----------  User definable     Undefined
		|  |  |  `--------------  User definable     INT2 pending  
	  	|  |  `-----------------  User definable     INT6 pending
	  	|  `--------------------  User definable     INT7 pending
	  	`-----------------------  User definable     Board pulling INT

   Note:  Use of the $40/42 registers is an optional feature which
          can be implemented by boards which generate interrupts.
          They make it possible for board-specific interrupt servers  
          to determine if the current interrupt is being generated
          by their board, or by some other hardware using the
          same interrupt line.
 
($44/46)	7  6  5  4   3  2  1  0   Reserved, read must be 00
 R/W					  Write undefined
 Inverted


($48/4A)	7  6  5  4   3  2  1  0   Base address register, write only.
Write Only	\___  ___/   \___  ___/   These bits are compared with A23
Not Inverted	    \/           \/       through A16 (or fewer) to determine
		 Hi nibble   Lo nibble    the base address of the board.


($4C/4E)	7  6  5  4   3  2  1  0   Optional "shut up" register.
Write Only 	\___  ___/		  Any write to $4C will cause
		    \/			  board to pass config out and
		     `------------------  and then never respond again 
					  to any address, until RESET.
					  A bit in nibble $08 flags
					  whether the board can be shut up.


($50 through $7E)			  Reserved, must be 00
 Inverted


Remember that all nibbles except $00/02 and $40/42 will actually
appear inverted from the values in the above table.  For example,
a "must be 0" nibble will appear as $F, and flags and hex values
will also be inverted (ie a value of $1 will read as $E, etc). 
