;Library Name: ARRAYLIB ;Module Name: NDRACCESS ;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 ndraccess ;This module contains the following routines: public getndre,gtnxtdu ;..and uses the following external routines: ext getndr ;********************************************** getndre: ;get address of system NDR with error checking call getndr or a,a ld a,4 ;error code - No NDR scf ;in case of error ret z ;..null return is error ld a,(HL) ;bet 1st byte of NDR or a,a ;if null, NDR is empty ld a,5 ;error code - empty NDR scf ;indicate error ret z ;return with error code, Cy set xor a ;else, reset cy ret ;normal return, no error ;********************************************** gtnxtdu: ;get and return in BC the word at the address ;in curloc:, then increment that address by 18. ;The addresses are presumed to be pointers into ;a system named directory structure. ;curloc must be initialized on entry. ;on normal exit, ; A > 0, Flags = NZ,NC ; BC = Disk, User from NDR ; HL = pointer to next NDR entry ;on exit with pointer beyond valid NDR entries, ; A = 0, Flags = Z,NC ; BC = 0,(undefined) ; HL = undefined ;Error exit: ; A = 0, Flags = Z, C ; HL = address of curloc: ;registers affected: AF, BC, HL ld hl,(curloc) ;pick up pointer to data ld a,h or a,a ;unititilized of null jr z,uninit push de ld b,(hl) ;get drive (1..16) ld a,b or a,a ;test for null jr z,nomore inc hl ld c,(hl) ;get user number(0..31) ld de,17 ;distance to next entry add hl,de ld (curloc),hl ;ready for next call pop de ret nomore: ld a,(curloc+1) ;mark curloc invalid pop de ret uninit: ld hl,curloc ;return place to store pointer scf ;set Cy to show error 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