Disc Handling (Data Records)

Copy Sectors

JSBR

 

3000-

Overlay Module 005

P1=Address of Parameter Block

 

 

 

Copies the specified sectors from the Master Disc to the Copy Disc.

The Master and Copy Discs may be the same disc.

The transfer is carried out in blocks of 8 sectors (the last transfer being a short block if necessary). The program must provide a core buffer area large enough to contain the block (i.e. 1K in the case of 8 or more sectors).

Each block written to the Copy Disc is read back and a hash sum calculated and compared with the Master hash sum. The message HASHFAIL is flashed if the sums are not equal, and the transfer is retried.

Control returns to the step following P1 upon completion of the Copy.

Parameter Block

P1

Master Disc Number.

P2

Start Sector Number, Master Disc.

P3

Copy Disc Number.

P4

Start Sector Number, Copy Disc.

P5

Address of Transfer Buffer.

P6

Number of Sectors to be copied.

The module occupies one sector and is loaded at 3000-

Extract from File Control Block or File Status Block

JSBR

IZ

1700

P1=Control Word

 

 

The subroutine returns to the step following P1 with the A-Register holding the contents of the specified word and with the B-Register pointing to the absolute core location of the word.

Control Word

B17

0

B16:B13

Either Word Number in File Status Block,
Or
Zero to extract from File Control Block.

B12:B9

Word Number in File Control Block

B8:B1

File Identifier

Direct Access File Control Block

Word No

 

0

201421 if Binary
201422 if Ordinary

1

B16:B9

No of Sectors per transfer

B8:B1

Disc Number

2

Either Address of Buffer Control Block,
Or
Zero (buffer is Task Master Buffer).

3

Minimum Record Number.

4

Maximum Record Number.

5

Logical Record Length (Words)

6

Ordinary files: Number of records per transfer.
Binary files: Log2 of Number of records per transfer.

7

Absolute Sector containing Record Number 1.

8

Address of File Status Block.

Notes

  1. A File Control Block connects the symbolic File Identifier with a physical data-set held on disc. A program that extracts its file information from the FCB will not require to be modified should the file itself be modified.

  2. If B16:B13 are non-zero then B12:B9 must hold the Word Number within the FCB of the FSB pointer (=Word 8 if the file is a Direct Access File).

  3. FCB words are numbered from 0, whereas FSB words are numbered from 1.

  4. File Control Blocks exists somewhere in the OS core space. Word 0 is a mask defining the file type. A binary direct access file is one where the number of records per transfer is expressed (in Word 6) as a power of two (allowing the OS to calculate the absolute sector number more efficiently). Other file types currently recognised are:

201420

Undefined File

201423

Directory File (containing program names).

201424

Overlay Library (containing overlay modules).

201425

Program File.

Buffers

Disc/Core transfers always involve one or more consecutive sectors of 128 words each. Thus a core buffer area is required, equal in size to the number of sectors specified in the top byte of FCB Word 1. If FCB Word 2 is zero, then the buffer area used will be the Master Buffer of the Task requesting the transfer (in this case the number of sectors per transfer will be one, or possibly two if the spool buffer area is being used as an extension); otherwise FCB Word 2 points to a two-word Shared Buffer Control Block:

Shared Buffer Control Block

Word

 

1

Absolute Sector Number currently in Buffer.

2

Address of Buffer.

Notes

  1. The buffer is shared by all tasks.

  2. To prevent another task overlaying the buffer prematurely, the OS automatically locks all transfers to/from a shared buffer (the lock will be broken by a SUSPEND or I/O routine call).

  3. On FETCH, FSB Word 1 is checked against the required sector(s). If they are the same, a disc Read does not take place and the issuing task retains control (i.e. it jumps the disc queue).

  4. More than one file may share the same shared buffer, provided each FCB Word 2 points to the same Shared Buffer Control Block (if the files are on different discs, their Absolute Sector Numbers must not overlap).

  5. The Buffer exists somewhere in the OS core space. Word 1 of the Shared Buffer Control Block must be zero initially.

File Status Block

This is an optional one or four word block containing the file’s dynamic data. The FSB will normally exist within the System Control Record, which should be STOWED whenever the block is updated.

Word No

 

1

Count of Live Records.

2

Count of Chained Records.

3

First Free Chained Record Number

4

Chain Update Flag (non-zero if updatre is in progress).

Notes

  1. All words of the status block must be zero when the data set is first allocated.

  2. Chain files do not require pre-formatting into an empty chain.

  3. Non-chain files: FSB Words 2:4 are not required. File Maintenance applications routines are responsible for maintaining the Count of Live Records. If this count is not required, then neither is the File Status Block.

Fetch (Direct Access File)

JSBR

IZ

1670

P1=Control Word

 

 

P2=Address of Record Number

 

 

P3= Address of Extract Area

 

 

The record identified by the File Identifier (specified in P1) and relative record number within the file (a single word binary field pointed to by P2) is read into the issuing task’s Master Buffer.

If (and only if) the TEST option is specified in P1, the first word of the record is compared with the relative record number (pointed to by P2). If not equal, the subroutine returns to the step following P3 (record not loaded). If equal, the subroutine skips this step on return (record loaded).

When the TEST option is not specified, the subroutine always returns to the step following P3.

The record may be automatically de-buffered by specifying in P3 the address to which it is to be copied (this process is referred to as extraction). If extraction is not required, P3 must be zero. Extraction does not take place if the reord is found to be not loaded by the TEST option.

If the issuing task is fetching the record in order to perform an update, the LOCK option must be specified in P1.

On return from FETCH, 0/0151 points to the first word of the record within the Master Buffer, and 0/0152 contains the logical record length.

Control Word

B17

1 if LOCK. Lock instructs the system not to initiate any disc transfers on behalf of any task once the record arrives in core, until the issuing task releases the LOCK (which occurs implicitly upon first entry to the task scheduler following return from FETCH).

B16

1 if TEST.

B15:B7

000000000

B6:B1

File Identifier.

Notes

  1. Task HALTS at 001374 if the File Identifier is undefined (A-Register contains FETCH back address).

  2. Task HALTS at 001377 if the Record Number is outside the file limits (A-Register contains FETCH back address).

  3.  If the disc containing the required record is not on-line, a message to this effect is flashed and the task will be held waiting until the disc comes on-line.

  4.  If hardware status is reported from the disc controller during FETCH, the system will retry the transfer anticipating that the fault will clear. A message will be flashed at suitable intervals whilst the fault persists or until the disc is taken off-line. It may be possible to clear the fault by placing the disc onto another drive.

  5. Notes 3 & 4 above apply to all disc transfers by all subroutines within LOS.

Fetch (Overlay Module)

JSBR

IZ

1670

P1=Control Word

 

 

P2=Address of Module Number

 

 

The overlay module identified by the File Identifier (specified in P1) and Module Number (a single word binary field pointed to by P2) is read into core.

Control returns to the step following P2 upon completion of the transfer, unless the LINK option is specified in P1 in which case control is passed to the first word of the overlay module.

The absolute address of the first word of the module will be found in core location 0/0144 upon completion of the transfer.

Control Word

B17:B12

000000

B11

1 if LINK

B10:B7

0000

B6:B1

File Identifier (= 02).

Notes

  1. Automatic Offset Address Resolution does not occur.

  2. Task HALTS at 001377 if the Module Number is invalid (A-Register contains FETCH back address).

  3. Task HALTS at 001373 if a software hash fail is detected (A-Register contains FETCH back address).

Fetch (Program)

JSBR

IZ

1670

P1=Control Word

 

 

P2=Address of four-character ASCII name

 

 

The overlay module identified by the File Identifier (specified in P1) and name (a double word pointed to by P2) is read into core.

Automatic Offset Address Resolution will be carried out if (and only if) this option is set in the program’s Overlay Module Index entry.

If the LINK option is specified in P1 control is passed to the logical entry point within the Overlay Module associated with the four-character program name.

If the program is not found the subroutine returns to the step following P2. If the program is found but LINK is not requested, the subroutine skips this step on return.

On completion of the transfer, 0/0153 contains the Overlay Module Number, 0/0144 points to the first word of the Overlay Module and 0/0154 points to the logical entry point.

Control Word

B17:B12

000000

B11

1 if LINK

B10:B7

0000

B6:B1

File Identifier (= 05 for I/O Station programs, = 06 for Printer programs).

Note

  1. Byte Addressing of the program name is not supported. All four characters addressed by P2 comprise the name (a NUL byte does not act as terminator).

Rewrite

JSBR

IZ

1671

The record just FETCHED from a Direct Access File is written back to disc. The subroutine returns to the step following JSBR upon completion of the transfer.

There are no parameters. All relevant information is defined in the preceding FETCH parameters. The FETCH must specify the LOCK option.

If, and only if, the record was extracted by FETCH, it will be automatically replaced (i.e. re-buffered) by REWRITE.

Note

  1. Task HALTS at 001376 if REWRITE called out-of-context (A-Register contains FETCH back address). Out-of-context occurs if there is no LOCK in force on the record, if there was no preceding FETCH & LOCK, or if the File Type is not Direct Access.

Overwrite

JSBR

IZ

1672

P1=Address of new record

 

 

The record just FETCHED from a Direct Access File is overwritten in its core buffer by the new record pointed to by P1, and the buffer is written back to disc. The subroutine returns to the step following P1 upon completion of the transfer.

Notes

  1. Task HALTS at 001376 if OVERWRITE called out-of-context (A-Register contains FETCH back address).

  2. Consideration should be given to TEST the record fetched for a not loaded condition before going ahead with an OVERWRITE.

Stow System Control Record

JSBR

IZ

1667

Writes the System Control Record to disc and returns to the step following JSBR upon completion of the transfer.

There are no parameters.

The System Control Record is permanently core resident at 0/0400 and occupies 1, 2 or 3 sectors as required by the application. The record is the only record (number 1) in the System Control File, File Identifier 10.

The System Control Record is never read from disc, except once when the system is started via control panel switches, but it is necessary to write the record to disc whenever updates are carried out within it, as a security precaution.

The first 64 words (0/0400 to 0/0477) are reserved for systems use, the remainder for applications use.

0/0477 contains the System Date in packed format.