;Library Name: ARRAYLIB ;Module Name: NDR$MXU ;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 ndr$mxu ;This module contains the following routines: public ardndmxu ;..and uses the following external routines: ext arrfr0$e,arxltbit,arrxltrc,arrbcmsk,armemora ext getmus,getndre,gtnxtdu ;********************************************** ardndmxu: ;Initialize a D/U array 64 bytes long, with bits set ;through maxdu value from system env for each drive ;which has an entry in the system NDR. xor a ;make null for... call arrfr0$e ;init array to nulls ret c ;ret if error, code in A call getndre ;return pointer to NDR in HL ret c ;ret if error, code in A ld (curloc),hl ;pass it to NDR access routine call getmus ;max user from sys env ld hl,maxdu ;point to local d/U storage ld (hl),a ;store in local variable inc hl ld (hl),0 ;say no drive initially drvlp: call gtnxtdu ;get potential DU entry from NDR ret z ;return if no more entries ld a,(maxdu+1) ;get last drive referenced cp a,b ;same? jr z,drvlp ;jump if yes, and get next entry ld a,b ld (maxdu+1),a ;store the new drive number dec b ;convert drive to row ld a,(maxdu) ;get maximum user ld c,a ;..in c call fillrow ;fill its row with 1's to maxusr jr drvlp ;repeat until no more entries ;********************************************** fillrow: ;set bits in row (B) up to the user value in C ;NOTE: this ignores possible entries higher than ;column C, which may in fact contain set bits push bc push de call arxltbit ;make row,column,bit pos in bc,e call arrxltrc ;addr of row,column in hl ld a,e ;bit position in a from e call arrbcmsk ;make mask from E in A call armemora ;set bits 0 to (e) in column C ld a,0ffh ;mask for columns 0 to (c) ld b,c ;column number in B inc b ;number of columns to mask jr lp2tst ;jmp to test first in case only 1 to do loop2: dec hl ;back up to previous entry call armemora ;fill it with 1's lp2tst: djnz loop2 ;continue through col 0 pop de pop bc 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