view defs/rbfdefs @ 1652:558cab468052

RG fixed a bug in the Vavasour emulator clock2 module. clock2 is now of type Sbrtn instead of Systm. clock.asm has been modified to link to this type.
author boisy
date Sat, 17 Jul 2004 12:20:31 +0000
parents d6f639eb9a0f
children b17a3a132bbb
line wrap: on
line source

         IFNE  RBFDEFS-1

RBFDEFS  set   1

********************************************************************
* RBFDefs - Random Block File Manager Definitions
*
* $Id$
*
* RBF stands for 'Random Block Filemanager' and is a package of subroutines
* that define the logical structure of a disk and allows access to the files
* in that structure.
*
* The data structures in this file give RBF its 'personality' and are used
* by RBF itself, as well as applications that will require disk I/O.
*
* Edt/Rev  YYYY/MM/DD  Modified by
* Comment
* ------------------------------------------------------------------
*          1982/07/13  Robert F. Doggett
* PD.Exten added to path descriptor and PE Entries defined.
*
*          1982/07/15  Robert F. Doggett
* V.FileHd inserted in driver static storage.
*
*          1982/09/10  WGP
* Level One/Level Two condionals added.
*
*          1982/09/17  WGP
*
*          1982/09/17  Robert F. Doggett
* PD.SLE renamed to PD.Creat.
*
*          1982/09/17  Robert F. Doggett
* V.DiskID, V.BMapSz, V.MapSct added for smart multi-sector bitmap searching.
*
*          1982/09/20  Robert F. Doggett
* Reserved areas added in static storage.

*          1983/06/07  Robert F. Doggett
* Added InDriver flag in PD.SMF.
*
*          1983/06/13  Robert F. Doggett
* Added PE.Req tmp save for PE.Lock.
*
*          1983/08/08  Robert F. Doggett
* Reserved PD.SToff for Japanese.
*
*          1983/11/19  Robert F. Doggett
* Added V.ResBit in drive tables.
*
*          1983/12/12  Robert F. Doggett
* Added PE.Prior to save process priority.
*
*          1983/12/13  Robert F. Doggett
* Added BufBusy bit in state flag (PD.SMF).
*
*          1984/07/06  Mark G. Hawkins
* Added Bit Definitions for DD.FMT.
*
*          1987/06/23  Kevin K. Darling
* Updated with Dev Desc Info
*
*          2003/06/02  Boisy G. Pitre
* Updated comments for clarity.
* Added TYP.256-TYP.2048 definitions for future expansion.
*
*          2004/04/14  Boisy G. Pitre
* Added new entries to device descriptor as per OS-9 Level One V2.00.00
* addendum.  Pointed out by Rodney Hamilton.

         nam   RBFDefs
         ttl   Random Block File Manager Definitions


         pag
*******************************
* RBF Device Descriptor Offsets
*
* These definitions are for RBF device descriptors.

         org   M$DTyp
         rmb   1          Device type (DT.RBF)
IT.DRV   rmb   1          Drive number
IT.STP   rmb   1          Step rate
IT.TYP   rmb   1          Disk device type information
IT.DNS   rmb   1          Density capability
IT.CYL   rmb   2          Number of cylinders
IT.SID   rmb   1          Number of surfaces
IT.VFY   rmb   1          Verify disk writes (0 = verify, 1 = don't)
IT.SCT   rmb   2          Default sectors/track
IT.T0S   rmb   2          Default sectors/track for track 0 sector 0
IT.ILV   rmb   1          Sector interleave offset
IT.SAS   rmb   1          Segment allocation size
* The following fields are from the OS-9 Level One V2.00.00 Addendum
IT.TFM   rmb   1          DMA Transfer Mode
IT.Exten rmb   2          Path Extension (PE) for record locking
IT.SToff rmb   1          Sector/Track offsets (for "foreign" disk formats)
* The following fields are not copied to the path descriptor
IT.WPC   rmb   1          Write precomp cyl/4 (HD)
IT.OFS   rmb   2          Starting cylinder offset (HD)
IT.RWC   rmb   2          Reduced write current cylinder (HD)


* IT.TYP Definitions
*
TYP.HARD equ   %10000000	Hard disk
TYP.FLP  equ   %00000000	Floppy disk
TYP.NSF  equ   %01000000	Non-standard format
TYP.SOF  equ   %00000000	Standard NitrOS-9 format

* IT.TYP bit definitions if bit 7 of IT.TYP is set (hard disk)
TYPH.256  equ  %00000000	256 byte sector media
TYPH.512  equ  %00000001	512 byte sector media
TYPH.1024 equ  %00000010	1024 byte sector media
TYPH.2048 equ  %00000011	2048 byte sector media
TYPH.SSM  equ  %00000011	Sector size mask
TYPH.DRSV equ  %00001100	Driver-reserved bits
TYPH.DSQ  equ  %00010000        Drive size query flag

* IT.TYP bit definitions if bit 7 of IT.TYP is clear (floppy disk)
TYP.5    equ   %00000000	5" media
TYP.8    equ   %00000001	8" media
TYP.256  equ   %00000000	256 byte sector media
TYP.512  equ   %00000100	512 byte sector media
TYP.CCF  equ   %00100000	CoCo format
TYP.NCCF equ   %00000000	Non-CoCo format

* IT.DNS Definitions
*

* If bit 7 of IT.TYP is set, IT.DNS is driver-dependent

* IT.DNS bit definitions if bit 7 of IT.TYP is clear (floppy disk)
DNS.FM   equ   %00000000        Single-density (FM)
DNS.MFM  equ   %00000001        Double-density (MFM)
DNS.STD  equ   %00000000        Single track density (48 tpi)
DNS.DTD  equ   %00000010        Double track density (96/135 tpi)

* Floppy disk step rate definitions
STP.30ms equ   0                30ms step rate
STP.20ms equ   1                20ms step rate
STP.12ms equ   2                12ms step rate
STP.6ms  equ   3                6ms step rate

         pag
*************************************
* Random Block Path Descriptor Format
*
* A path descriptor is created for every new path that is open
* via the I$Open system call (processed by IOMan).  Process
* descriptors track state information of a path.
*
         org   PD.FST
PD.SMF   rmb   1          State flags
PD.CP    rmb   4          Current logical byte position
PD.SIZ   rmb   4          File size
PD.SBL   rmb   3          Segment beginning lsn
PD.SBP   rmb   3          Segment beginning psn
PD.SSZ   rmb   3          Segment size
PD.DSK   rmb   2          Disk id
PD.DTB   rmb   2          Drive table ptr
         org   PD.OPT
         rmb   1          Device type
PD.DRV   rmb   1          Drive number
PD.STP   rmb   1          Step rate
PD.TYP   rmb   1          Disk device type (5" 8" other)
PD.DNS   rmb   1          Density capability
PD.CYL   rmb   2          Number of cylinders
PD.SID   rmb   1          Number of surfaces
PD.VFY   rmb   1          0=verify disk writes
PD.SCT   rmb   2          Default sectors/track
PD.T0S   rmb   2          Default sectors/track tr00,s0
PD.ILV   rmb   1          Sector interleave offset
PD.SAS   rmb   1          Segment allocation size
PD.TFM   rmb   1          DMA Transfer Mode
PD.Exten rmb   2          Path Extension (PE) for record locking
PD.SToff rmb   1          Sector/Track offsets (for "foreign" disk formats)
PD.ATT   rmb   1          File attributes
PD.FD    rmb   3          File descriptor psn
PD.DFD   rmb   3          Directory file descriptor psn
PD.DCP   rmb   4          File directory entry ptr
PD.DVT   rmb   2          User readable dev tbl ptr

* State Flags
BUFMOD   equ   $01        Buffer modified
SINBUF   equ   $02        Sector in buffer
FDBUF    equ   $04        File descriptor in buffer
*EOFSEC equ $08 End of file sector
*EOF equ $10 End of file
InDriver equ   $20        Currently in Disk Driver, or queued
BufBusy  equ   $40        Buffer is currently busy

         IFNE  Level-1
************************************
* Random Block Path Extension Format
*
* RBF paths under Level Two have additional information that
* is referenced by the path extension area.
*
         org   0
PE.PE    rmb   1          PE path number
PE.PDptr rmb   2          Back ptr to this PE's Path Descriptor
PE.NxFil rmb   2          Drive Open-File list ptr
PE.Confl rmb   2          Circular File Conflict list
PE.Lock  rmb   1          Path lockout status
PE.LoLck rmb   4          Low Locked Logical addr
PE.HiLck rmb   4          High Locked Logical addr
PE.Wait  rmb   2          PE ptr to (next) locked-out PE
PE.TmOut rmb   2          Max ticks to wait for locked segment
PE.Owner rmb   1          Process ID of owner of locked segment
PE.Req   rmb   1          Temp for PE.Lock in GAIN when LockSeg fails
PE.Prior rmb   1          Temp for process priority while in driver
PE.SigSg rmb   1          Signal code to send
PE.SigID rmb   1          Process ID to send the signal to
         rmb   32-.       Reserved
PE.FilNm rmb   32         Temp for filename during directory search

* PE.Lock status codes
Unlocked equ   0          No portion of file is locked
RcdLock  equ   1          Record from LoLck to HiLck locked
FileLock equ   2          Entire file locked
EofLock  equ   4          End of file is locked
         ENDC  


         pag
***********************
* LSN0 Disk Data Format
*
* Logical Sector Number 0 is the first sector on an RBF formatted device
* and contains information about the device's size and format.
*
         org   0
DD.TOT   rmb   3          Total number of sectors
DD.TKS   rmb   1          Track size in sectors
DD.MAP   rmb   2          Number of bytes in allocation bit map
DD.BIT   rmb   2          Number of sectors/bit
DD.DIR   rmb   3          Address of root directory fd
DD.OWN   rmb   2          Owner
DD.ATT   rmb   1          Attributes
DD.DSK   rmb   2          Disk ID
DD.FMT   rmb   1          Disk format; density/sides
DD.SPT   rmb   2          Sectors/track
DD.RES   rmb   2          Reserved for future use
DD.SIZ   equ   .          Device descriptor minimum size
DD.BT    rmb   3          System bootstrap sector
DD.BSZ   rmb   2          Size of system bootstrap
DD.DAT   rmb   5          Creation date
DD.NAM   rmb   32         Volume name
DD.OPT   rmb   32         Option area

* DD.FMT Bit Definitions - valid only if device is a floppy disk
FMT.SIDE equ   %00000001  Single Sided=0, Double Sided=1
FMT.DNS  equ   %00000010  Single Density=0, Double Density=1
FMT.TDNS equ   %00000100  Track Density: 48 TPI=0, 96/135 TPI=1
FMT.T0DN equ   %00100000  Track 0 Density, see FMT.DNS


         pag
************************
* File Descriptor Format
*
* The file descriptor is a sector that is present for every file
* on an RBF device.  It contains attributes, modification dates,
* and segment information on a file.
*
         org   0
FD.ATT   rmb   1          Attributes
FD.OWN   rmb   2          Owner
FD.DAT   rmb   5          Date last modified
FD.LNK   rmb   1          Link count
FD.SIZ   rmb   4          File size
FD.Creat rmb   3          Segment list extension
FD.SEG   equ   .          Beginning of segment list
* Segment List Entry Format
         org   0
FDSL.A   rmb   3          Segment beginning physical sector number
FDSL.B   rmb   2          Segment size
FDSL.S   equ   .          Segment list entry size
FD.LS1   equ   FD.SEG+((256-FD.SEG)/FDSL.S-1)*FDSL.S
FD.LS2   equ   (256/FDSL.S-1)*FDSL.S
MINSEC   set   16


         pag
************************
* Directory Entry Format
*
* Directory entries are part of a directory and define the name
* of the file, as well as a pointer to its file descriptor.
*
         org   0
DIR.NM   rmb   29         File name
DIR.FD   rmb   3          File descriptor physical sector number
DIR.SZ   equ   .          Directory record size


         pag
********************
* RBF Static Storage
*
* Overall Disk Static Storage
*
* Note:  This does not reserve any memory for drive tables.  Each
*        driver is responsible for reserving sufficient memory for
*        the appropriate number of tables.
*
         org   V.USER     Reserve required           ($06)
V.NDRV   rmb   1          Number of drives           ($07)
         rmb   8          reserved                   ($08)
DRVBEG   equ   .          Beginning of drive tables  ($10)


         pag
****************
* Global Storage For Disk Drive Tables
*
* Each table contains the first 'DD.SIZ' bytes from
* LSN 0, and the current track, stepping rate,
* bitmap use flag, and disk type.
*
         org   0
         rmb   DD.SIZ     Device descriptor, LSN 0
V.TRAK   rmb   2          Current track
V.BMB    rmb   1          Bit-map use flag
V.FileHd rmb   2          Open file list for this drive
V.DiskID rmb   2          Disk ID
V.BMapSz rmb   1          Bitmap Size
V.MapSct rmb   1          Lowest reasonable bitmap sector
V.ResBit rmb   1          Reserved bitmap sector (for compaction)
V.ScTkOf rmb   1          Sector/Track byte (Combined from descriptor)
V.ScOfst rmb   1          Sector offset split from byte above
V.TkOfst rmb   1          Track offset split from byte above
         rmb   4          Reserved
DRVMEM   equ   .

         ENDC