29.12.2012 Views

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

The Programmer's Guide to TRSDOS Version 6 - Tim Mann's Home ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

@SKIP, @PEOF, or @SEEKSC SuperVisor Call. It is important for the system <strong>to</strong><br />

know whether or not the disk file buffer has been changed since it was read<br />

from the file. If the buffer has been altered, it is necessary <strong>to</strong> write the<br />

buffer back <strong>to</strong> the file prior <strong>to</strong> any movement of the file pointer. This flag<br />

conveys such status. If it is set <strong>to</strong> a "1", it indicates that the buffer<br />

contents have been changed since the buffer was read from the file. If it is<br />

set <strong>to</strong> a "0", the indication is that the buffer has not been modified. <strong>The</strong><br />

system will set this bit whenever a WRITE operation is performed on the<br />

buffer by either a PUT or the write of a record (of LRL < 256). <strong>The</strong> bit is<br />

reset by the system when the buffer is physically written <strong>to</strong> the disk via<br />

the @WRSEC SuperVisor Call request.<br />

Bit 3 <strong>The</strong> normal method <strong>to</strong> reflect changes in a file's direc<strong>to</strong>ry entry record data<br />

is <strong>to</strong> update the direc<strong>to</strong>ry entry only when the file is closed. Thus, the FCB<br />

contains all of the information pertinent <strong>to</strong> the modifications. This keeps<br />

the direc<strong>to</strong>ry accesses <strong>to</strong> a minimum and results in faster file throughput.<br />

However, it is important <strong>to</strong> note that if the system crashes after extensive<br />

file updating (specifically where the file has been extended), the added<br />

information will be unrecoverable without manual corrections <strong>to</strong> the file's<br />

direc<strong>to</strong>ry entry record. It is possible <strong>to</strong> force the system <strong>to</strong> always update<br />

the direc<strong>to</strong>ry whenever the system extends the file by writing another<br />

sec<strong>to</strong>r. Unattended operation may utilize this extra measure of file<br />

protection. It is specified by appending an exclamation mark "!" <strong>to</strong> the end<br />

of a file specification when the filespec is requested at open time. This<br />

bit will then be set by the system. It is used <strong>to</strong> specify that the direc<strong>to</strong>ry<br />

record is <strong>to</strong> be updated every time that the NRN exceeds the ERN.<br />

Bits 2-0 <strong>The</strong>se bits will contain the access protection level as retrieved from the<br />

direc<strong>to</strong>ry entry record of the file when the file is first opened. <strong>The</strong><br />

specific bit pattern will be adjusted <strong>to</strong> the protection level granted<br />

according <strong>to</strong> the password (OWNER vs USER) entered at file open time.<br />

6.4.3 PDS Member Origin Offset - <br />

When a Partitioned Data Set (PDS) has been opened for individual member access (a sec<strong>to</strong>r<br />

origin member), the PDS linkage routines will adjust the EOF contained in the FCB <strong>to</strong> be<br />

the logical EOF of the member. <strong>The</strong> member origin offset is the number of relative sec<strong>to</strong>rs<br />

between the logical ERN of the member and the first relative sec<strong>to</strong>r of the member. This<br />

byte will contain that forward offset so that the linkage routines may be able <strong>to</strong><br />

calculate the logical beginning of the member. <strong>The</strong> calculation is required for linkage <strong>to</strong><br />

all SuperVisor Calls that reference file positioning forward of the NRN (@BKSP, @REWIND,<br />

@POSN, @SEEKSC).<br />

6.4.4 Disk File Buffer Pointer - <br />

This is a pointer <strong>to</strong> the disk file buffer that is used for all disk I/O associated with<br />

the file. <strong>The</strong> pointer is a 16-bit address s<strong>to</strong>red in normal low-order - high-order format.<br />

This pointer is the buffer address specified in register pair HL at open time.<br />

6.4.5 Next Record Number Byte Offset - <br />

When a file is accessed with either character I/O or record I/O of Logical Record Length<br />

less than 256, requests for I/O may not necessarily require the transfer of a physical<br />

sec<strong>to</strong>r from/<strong>to</strong> the disk. <strong>The</strong>refore, the system needs a pointer <strong>to</strong> the byte position<br />

within the buffer that is <strong>to</strong> be used for the next I/O operation. This field contains that<br />

position - it is termed an OFFSET within the sec<strong>to</strong>r pointed <strong>to</strong> by the NRN. If this offset<br />

is a zero value, then the next byte <strong>to</strong> be transferred during an I/O operation is<br />

dependent on whether or not the buffer contains the current sec<strong>to</strong>r as noted by FCB+1, bit<br />

5. <strong>The</strong> system au<strong>to</strong>matically maintains this OFFSET byte during record and character I/O.<br />

If your application is performing full sec<strong>to</strong>r I/O for writing data while it is<br />

maintaining its own character buffering, then it is important for it <strong>to</strong> maintain this<br />

byte when the file is closed if the true end-of-file offset is not at a sec<strong>to</strong>r boundary.<br />

Remember, this offset is a pointer <strong>to</strong> the next available buffer position and not <strong>to</strong> the<br />

6-15

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!