; TITLE "SSCFA - Syslib 4.0" NAME ('SCFA') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SSCFA.Z80 Ver 1.1 by Richard Conn ; Date : 17 Sep 89 ; Version : 1.2 ; Module : SSCFA ; Abstract: This module contains the routine SCFA which sets ; the unambiguous file whose FCB is passed to the attri- ; butes specified. All other attributes are cleared. A ; Flag is set to indicate errors. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC SCFA ; From SYSLIB Get.. EXT INITFCB ; Definitions BDOS EQU 5 ; CP/M, Zrdos, P2Dos Entry Point B$SFA EQU 30 ; Set File Attributes Function .Z80 CSEG ;=============================================================== ; NAME - SCFA ; Entry: - Points to an FCB for the specified file ; - Contains attributes, Bit 7 - SYS, Bit 0 - R/O ; Exit : - A = 0, Zero Flag Set (Z) if Ok ; A <> 0, Zero Reset (NZ) if Error or amb fn.ft ; ,, - Preserved ; Special Requirements: None ;=============================================================== SCFA: PUSH HL ; save registers PUSH DE PUSH BC LD C,A ; save file attributes in C ; Check for ambiguous file name and clear MSBs of FN/FT bytes 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 PUSH DE ; save ptr to FCB LD HL,9 ; offset to R/O attribute ADD HL,DE ; pt to R/O byte ; Set R/O Bit RES 7,(HL) ; Start with No-R/O BIT 0,C ; Should we set R/O? JR Z,NORO ; ..jump if not SET 7,(HL) ; Else set Read-Only attribute NORO: INC HL ; pt to SYS attribute ; Set SYS Bit RES 7,(HL) ; Start with No-SYS BIT 7,C ; Should we set SYS? JR Z,NOSYS ; ..jump if not SET 7,(HL) ; Else set SYStem attribute ; Change attributes on disk NOSYS: POP DE ; pt to FCB CALL INITFCB LD C,B$SFA ; use BDOS function CALL BDOS INC A ; error? JR NZ,OK ; ..jump if Ok ERROR: DEFB 0F6H ; Set BAD Status with "OR 0AFH" from here OK: XOR A ; Set OK flags if entered from here POP BC ; restore registers POP DE POP HL RET END