ARRAYDEF -- Define an array by row & column or row & bits
ARRDEFDU -- Define an array for disk/user mapping (D= A-P, U= 0-31)
ARRETDEF -- Return the definition data for a defined array
ARRMAXDU -- Initialize the array to 1s for A0: through maxdu
ARRNDRDU -- Initialize an array bit to 1 for each NDR entry
ARDNDMXU -- Initialize for each disk in NDR to maxuser from ENV
ARINVERT -- Invert the bit order in each byte of the D/U array
:Define an array by row & column or row & bits

     Routine:  ARRAYDEF

     Function: This routine stores the address and size of the
array for use by other routines. Therefore, This routine must be
executed before other routines are called to manipulate the array.
(This routine IS executed by the ARRDEFDU routine, which sets up
standard values for A,B, and C.)

     Inputs:  HL contains the address of a buffer large enough
to hold the array. Register A defines the interpretation
of the data in registers BC and DE. Provision is made for definition
in terms of Drive/User, Row/Column, and Row/Max-bit-number. The
latter is for definition of a bit-map which contains more than 256
bits per row. It is not needed for Disk-User applications.

(Continued on next screen)

On Input:
if   A = 0, the array is defined in terms of Drive/User, and
     B = maximum drive (1-16),
     C = maximum user(0-31)

if   A = 1, then array is defined in terms of row/col, and
     B = highest row (0...),
     C = highest column (0..)

if   A > 1, then array is defined in terms of row/max bit, and
     B = highest row (0...),
     DE = the highest bit (0...0ffffh)

     Outputs: NONE

The array address and configuration are stored internally

     Registers Affected:  ALL 8080 registers are destroyed.

     Error Conditions: NONE
:Define an array for disk/user mapping (D= A-P, U= 0-31)

     Routine:  ARRDEFDU

     Function: Defines an array for use as a Disk/User bit map which
accomodates the ZRDOS (and CP/M) 16 drives and the ZCPR3x  32 users.
The buffer which contains the array is 64 bytes long, and starts at the
address passed in the HL register. This routine calls ARRAYDEF, and is
sufficient initialization before other array access routines are used.

     Inputs:  HL contains the starting address of the buffer.

     Outputs:  NONE

     Registers Affected: ALL 8080 registers are destroyed

     Error Conditions: NONE. It is the programmers responsibility
to ensure that the buffer space starting at HL is allocated.
:Return the definition data for a defined array

     Routine:  ARRETDEF

     Function:  Returns the address of the table containing data
for the currently defined array. The table contains four 16 bit entries:

	tble:	dw	nnnn	;starting address of the array
	tble+2:	dw	nnnn	;highest column (0...nnnn)
	tble+4:	dw	nnnn	;highest row (0...nnnn)
	tble+6:	dw	nnnn	;length of array, bytes

     Inputs: NONE

     Outputs:  Registers contain data entered by ARRAYDEF.
	HL	= address of the array configuration table
	Flags	= nz, nc

(Continued on next screen)



     Registers Affected: AF, BC, HL

     Error Conditions:  Undefined array --
If ARRAYDEF has not been called, 
	HL	= 00h
	Flags	= z, c
:Initialize the array to 1s for A0: through maxdu

     Routine:  ARRMAXDU

     Function: Initialize an array as a disk/user bitmap.
This routine sets all bits to '1' in the range from row 0, bit 0
(disk a, user 0) through the row designated by maxdsk and the bit position
designated by maxusr. Maxdsk and Maxusr are inputs specified by
the program which calls this routine.

     Inputs: B = max disk (1-16)
	     C = max user (0-31)

     Outputs: NONE

     Registers Affected: All 8080 registers are destroyed.

     Error Conditions:
on error: AF returns with carry set and error code in A
	A = 1 if bitmap not yet defined
	A > 1 if D/U is out of range
:Initialize an array bit to 1 for each NDR entry

     Routine:  ARRNDRDU

     Function: Initialize a 64 byte array from the drive-user
assignments in the system named directory. The array must have been
previously defined by a call to arraydef. Only those bit positions in the
array are set which correspond to d/u entries found in the current NDR.
All others are reset.

     Inputs:  NONE

     Outputs: NONE

     Registers Affected: All 8080 registers are destroyed

     Error Conditions:
on error: AF returns with carry set and error code in A
	A = 1 if bitmap not yet defined
:Initialize each row referenced in ndr to maxuser value

     Routine:  ARDNDMXU

     Function: For all drives referenced in the system Named Directory,
initialize all bits to 1 up to the bit corresponding to the Maximum
User number from the system ENV segment.

     Inputs: NONE

     Outputs: NONE

     Registers Affected: All 8080 registers are destroyed

     Error Conditions:
on error: AF returns with carry set and error code in A
	A = 1 if bitmap not yet defined
:Invert the bit order in each byte of the D/U array

     Routine:  ARINVERT

     Function: Exchanges high and low order bits in each byte of
the array, starting with Row 0, Col 0. This function is useful for
transforming a manually entered bitmap (using binary notation) in
which the bit order is left-to-right. Such an ordering is very 
convenient for humans but the inverse of what an assembler understands.
This routine, called once before initial use of the array, converts
the bytes into the normal form whose bits are in the positions
expected by the cpu. The array must have first been defined by a call
to ARRDEFDU or ARRAYDEF.

(Continued on next screen)


     Inputs: NONE

     Outputs: NONE
(bits 0-7,1-6,2-5,3-4 have been swapped in each byte)

     Registers Affected: A, BC, HL are destroyed
all other registers preserved

     Error Conditions:
on error: AF returns with carry set and error code in A
	A = 1 if bitmap not yet defined
