;Library Name: ARRAYLIB ;Module Name: PUTDEF ;Author: Al Hawley ;Date: 31 Mar 1987 ;Version number: 1.0c ;Version History: ;Program Function: ARRAYLIB is a collection of subroutines which ; implement the management of byte arrays in programs written ; for Z80 or HD64180 based computers. This module is one of the ; set, and may require the presence of others. ;*************************************************** ; COPYRIGHT NOTICE ;ARRAYLIB is copyright by A. E. Hawley on March 4, 1987. ;It may be freely distributed, but it must not be sold ;either separately or as part of a package without the ;written consent of the author. The author may be reached ;via electronic mail at the Ladera Z-Node in Los Angeles, ;213-670-9465, or by Voice Phone at: 213-649-3575 ; ;*************************************************** MACLIB ARRHDR name putdef ;This module contains the following routines: public arrdefdu,arraydef ;..and uses the following external routines: ext mulhd ;from SYSLIB or HD180 arrdefdu: ;defines a standard d/u map in a 64 byte buffer. ;(16 drives(1-16) and 32 users (0-31) per drive) ;on entry, ; hl = address of the buffer xor a ld bc,101fh ;16,31 are max Drive,User ;..fall through to ARRAYDEF ;*************************************************** arraydef: ;stores array start, number of rows, and ;number of columns in local variables. subsequent ;calls to routines in the package don't have to ;pass that information. ;on entry, ; hl = address of buffer large enough for array ; a = 0 or 1 or >1 ;to specify the array in terms of d/u: ; a = 0 ; b = highest drive ; c = highest user number ;to specify the array in terms of row/column: ; a = 1 ; b = highest row number ; c = highest column number ;alternatively, to specify the row length in bits: ; a > 1 ; b = highest row number ; de = highest bit number in row ;on exit, all registers are destroyed ld (bitmap),hl or a ;is BC a drive/user number? jr nz,bcisrc ;jump if not dec b ;convert to row number ld e,c ;move highest bit # to de ld d,a ;zero in d to make de=c jr calchcol ;calculate hi col, store r/c bcisrc: dec a ;is BC a Row/Col? (i.e, is A=1?) jr z,saverc ;jump over column calc if yes (z) ;here if A > 1, meaning B = Max Row number, DE = Max BIT ;or if the Drive/User input has been converted to this form calchcol: srl d ;maximum bit is in de, rr e ;..which must be divided by 8 srl d ;..to get maximum column rr e srl d rr e ;B = max row, E = max col saverc: ld hl,hicol ;save in array data table ld (hl),e ld hl,hirow ld (hl),b ;note that hicol and hirow are 16 bit locations. The high byte ;is always zero. This permits either byte or word access by ;other routines. calclen: ;calculate the total length of the array, in bytes ld hl,(hirow) inc hl ;number of rows ld de,(hicol) inc de ;number of columns call mulhd ;8 bit multiply from syslib/hd180 ld (dumaplen),hl ;store in array data table ret ;********************************************** IF ZAS COMMON ;common block for ZAS ELSE COMMON /ADATA/ ;common block for M80, SLR ENDIF ;COMMON data area - contains default values for a 64 ;byte array useful for disk/user bitmapping. bitmap: ds 2 ;..filled in by ARRAYDEF hicol: ds 2 ;default is 4 columns: 0,1,2,3 hirow: ds 2 ;default is 16 rows (0....15) dumaplen: ds 2 ;default is (3+1)*(15+1) maxdu: ds 2 ;transient d/u data curloc: ds 2 ;NDR entry pointer ;********************************************** end