TITLE "SGFA - Syslib 4.3" NAME ('GFA') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SGFA.Z80 Ver 1.1 by Richard Conn ; Date : 4 Jul 89 ; Version: 1.3 ; Module : SGFA ; Abstract: GFA gets the file attributes of the unambiguous ; file whose FCB is pted to by DE. On return, A0 is the ; R/O bit and A7 is the SYS bit, and the MSBs of the FCB ; in the FN and FT fields are set according to the disk ; entry. Status is returned indicating error conditions. ; Revision: ; 1.4 - 25 Nov 90 - changed 5 ADD A,A to 3 RRCAs per HG. HFB ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; External Entry Points PUBLIC GFA ; From SYSLIB Get.. EXT INITFCB, @BDOSA ; Definitions F$SRC1 EQU 17 ; Search for first function code TBUFF EQU 80H ; DMA address .Z80 CSEG ;=============================================================== ; NAME - GFA ; Entry: DE - Addresses a File Control Block (FCB) ; Exit : A = attribute bits (A7 = SYS, A0 = R/O), Zero Set (Z) if Ok ; A = 0FFH, Zero Reset (NZ) if file not found, ; or ambiguous file specified. ; Uses : AF ; Special Requirements: DMA Must have been set to 80H. ;=============================================================== GFA: PUSH HL ; Save Registers PUSH DE PUSH BC ; Check for ambiguous file name PUSH DE ; save ptr to FCB INC DE ; pt to first char LD B,11 ; check 11 bytes AMB: LD A,(DE) ; get char AND 7FH ; mask MSB LD (DE),A ; put char CP '?' JR Z,AMB1 INC DE DJNZ AMB INC B ; make NZ AMB1: POP DE JR Z,ERROR ; Search for file PUSH DE ; save FCB ptr CALL INITFCB ; clear FCB fields LD A,F$SRC1 ; Dos Search First Command CALL @BDOSA ; ..and do it POP DE ; get FCB ptr INC A ; FF --> 0? JR Z,ERROR ; Pt to File Name in TBUFF area DEC A ; Compensate for F$EXIST Increment RRCA ; 3 rotates right = RRCA ; 5 shifts left RRCA ; ..for TBUFF offset LD C,A ; DE=offset LD B,0 LD HL,TBUFF+1 ; pt to DMA address ADD HL,BC ; HL pts to FN of desired file INC DE ; DE pts to FN of target file LD BC,8 ; copy 8 bytes LDIR LD A,(HL) ; get R/O byte LDI ; Move R/O byte (T1) from buffer to FCB RLCA ; rotate R/O bit into LSB AND 1 ; mask out uninteresting bits LD C,A ; save in C LD A,(HL) ; get SYS byte AND 80H ; mask out all but MSB OR C ; OR in R/O bit LDI ; Move SYS byte (T2) from buffer to FCB LDI ; Move third byte of type to FCB LD C,A ; C = return code XOR A ; OK return LD A,C ; return code in A DEFB 01H ; ..trash BC and fall thru ; Error Return ERROR: OR 0FFH ; set code and flags for Error ERREX: POP BC ; Restore registers POP DE POP HL RET END