; TITLE "SSFA - Syslib 4.0" NAME ('SFA') ;================================================================= ; The Libraries, Version 4, (C) 1989 by Alpha Systems Corp. ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from SSFA.Z80 Ver 1.1 by Richard Conn ; Date : 11 Jun 89 ; Version : 1.3 ; Module : SSFA ; Abstract: This module contains the routine SFA which sets the ; R/O and System bits of the designated file as directed. ; Other attribute bits remain unchanged. ; Revision: ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points PUBLIC SFA ; 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 - SFA ; Entry: DE - Points to an unambiguous File FCB ; A - Desired Attributes, Bit 0 - R/O, Bit 7 - SYS ; Exit : A = 0, Zero Flag Set (Z) if Ok ; A <> 0, Zero Flag Reset (NZ) if Error ; Uses : AF ; Special Requirements: None ;=============================================================== SFA: PUSH HL ; save registers PUSH DE PUSH BC LD C,A ; save file attributes in C ; 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 CP '?' JR Z,AMB1 INC DE DJNZ AMB INC B ; make NZ AMB1: POP DE JR Z,ERROR LD HL,9 ; offset to R/O attribute ADD HL,DE ; pt to R/O byte ; Set R/O Bit LD A,C ; Move Att flag to A RL (HL) ; Rotate RO Byte Left into Carry RRA ; .now rotate RO Bit into Carry RR (HL) ; ..and into MSB of FCB+9 ; Set SYS Bit INC HL ; Pt to SYS attribute RL (HL) ; Rotate SYS Byte Left into Carry RLA ; .not rotate SYS Bit.. RLA ; ..into Carry RR (HL) ; ...and into MSB of FCB+10 ; Change attributes on disk CALL INITFCB ; Set the FCB still addressed in DE LD C,B$SFA ; use BDOS function CALL BDOS INC A ; error? JR NZ,OK ; ..jump if Not ERROR: DEFB 0F6H ; Set BAD with "OR 0AFH" if entered here OK: XOR A ; Set Ok status if entered here POP BC ; restore registers POP DE POP HL RET END