TITLE "DSETTD - Dslib Ver 4.0" ;================================================================= ; Copyright (C) 1989 by Harold F. Bower. Permission granted to ; Alpha Systems Corp. to distribute with The Libraries, Version 4 ;----------------------------------------------------------------- ; Author : Harold F. Bower ; Derived from DSLIB3 routines by Bridger Mitchell ; Date : 27 Jun 87 ; Version : 1.0 ; Module : DSETTD ; Abstract: This module contains the routine SETTD which writes ; User-supplied Create/Access/Modify time data for a file ; to the !!!TIME&.DAT file on the currently logged drive. ; Revision : ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ; Module Entry Points : PUBLIC SETTD ; External References : EXT OPENTD, CLOSTD, RWTD, @TDERR CSEG .Z80 ;============================================================ ; Routine - SETTD. Set 15-byte T&D data in !!!TIME&.DAT ; Enter: A - T&D index (0..7) ; DE - T&D Sector ; HL - 15 byte buff with CREATE, ACCESS, MODIFY T&D ; Exit : F - Zero Flag Set (Z) if No file/read/close Error ; Zero Clear (NZ) if OK ; Effects: All primary registers used ; Requirements: Desired drive must be logged in before call ; DMA address is altered by this routine ;============================================================ SETTD: LD (TDINDX),A ; Save index into T&D sector LD (TDADDR),HL ; ..and source addr for 15 bytes of t&d LD A,0FFH ; Set to Write mode PUSH DE ; ..save Sector # around open CALL OPENTD ; Open !!!TIME&.DAT for R/W POP DE JR Z,TDERR ; ..go error if no good XOR A ; Do read first PUSH DE ; ..preserving sector # CALL RWTD POP DE JR NZ,SETTD0 ; Jump if good read ; A Read/Write error occured. Attempt to close !!!TIME&.DAT while ; preverving error condition to minimize problems in O/S SETERX: CALL CLOSTD ; Else attempt close for good form XOR A ; ..and signify error JR TDERR ; ..to error exit ; Desired T&D sector is in TDBUFF. Move new field into position SETTD0: PUSH DE ; Save Sector # LD A,(TDINDX) ; Get index into sector ADD A,A ; ..and calculate address ADD A,A ADD A,A ADD A,A LD E,A ; Set for 16-bit calculation LD D,0 ADD HL,DE ; Add to sector start, HL=field addr EX DE,HL ; Put in dest register LD HL,(TDADDR) ; Get source field LD BC,15 ; ..which is 15 bytes long LDIR ; ..and fill in new T&D POP DE ; Restore Sector # ; New data is in the sector buffer, so write it to the same ; random sector in the !!!TIME&.DAT file, and close LD A,0FFH ; Set for Write CALL RWTD ; ..and Do it JR Z,SETERX ; Jump R/W error if Bad CALL CLOSTD ; Close the file if Good TDERR: JP Z,@TDERR ; Error if No good operation XOR A ; ..else set for OK INC A RET ;..... ; Data Storage/Buffers DSEG ; Put these in the Data Segment TDINDX: DEFS 1 ; Relative record in T&D Sector TDADDR: DEFS 2 ; Source T&D record address END