; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;


        SUBT    Exported FileCore constants

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

; ***********************************
; ***    C h a n g e   L i s t    ***
; ***********************************

; Date       Name  Description
; ----       ----  -----------
; 28-Nov-90  JSR   Created
; 28-Jan-91  JSR   Added FileCore_DiscFormat and FileCore_LayoutStructure
;                       Added Format_Floppy and Format_ D, E, F and L
; 14-May-91  JSR   Added WinnieMounts and WinniePollChanges
; 14-Jul-93  JSR   Added G format to list
; 17-May-94  AMcC  Changed to using the preferred SWI base and name symbols
; 21-Sep-94  SBP   Added BigDiscSupport flag
; 14-Mar-95  SBP   Added Misc_DriveStatus and DriveStatusWorks

SWIClass        SETS    FileCoreSWI_Name

        ^       FileCoreSWI_Base

        AddSWI  DiscOp
        AddSWI  Create
        AddSWI  Drives
        AddSWI  FreeSpace
        AddSWI  FloppyStructure
        AddSWI  DescribeDisc
        AddSWI  DiscardReadSectorsCache
        AddSWI  DiscFormat
        AddSWI  LayoutStructure
        AddSWI  MiscOp
        AddSWI  SectorDiscOp
        AddSWI  FreeSpace64
        AddSWI  DiscOp64
        AddSWI  Features

;
; FileCore_Create layout of incarnation descriptor block
                                        ^ 0
Create_Flags                            # 3
CreateFlag_FixedDiscNeedsFIQ            * 1:SHL:0
CreateFlag_FloppyNeedsFIQ               * 1:SHL:1
CreateFlag_Reserved                     * 1:SHL:2  ; Was background transfer supported in RO2
CreateFlag_NoBigBuf                     * 1:SHL:3  ; Use scratch space for small data moves
CreateFlag_FixedDiscsMountLikeFloppy    * 1:SHL:4  ; And fill the geometry in the disc record
CreateFlag_FixedDiscPollChangeSupport   * 1:SHL:5  ; Support poll change calls and lock calls
CreateFlag_FloppyEjects                 * 1:SHL:6  ; Floppies support MiscOp_Eject
CreateFlag_FixedDiscEjects              * 1:SHL:7  ; Fixed discs support MiscOp_Eject
CreateFlag_DriveStatusWorks             * 1:SHL:8  ; Drive status supported MiscOp_DriveStatus
CreateFlag_BigDiscSupport               * 1:SHL:9  ; Uses sector addresses not byte addresses
CreateFlag_NewErrorSupport              * 1:SHL:10 ; Errors in top bit set addresses
CreateFlag_FloppyDiscsMountLikeFixed    * 1:SHL:11 ; Floppy driver only reads the boot block, FileCore validates it and sets up the disc record
CreateFlag_MiscOp8Support               * 1:SHL:12 ; Filing system supports MiscOp 8
Create_Id                               # 1
Create_Title                            # 4
Create_BootText                         # 4
Create_LowLevel                         # 4
Create_Misc                             # 4
SzCreateDesc                            # 0

;
; FileCore_Create drive configuration register R3
DriveConfig_FloppyCount_Mask            * &FF
DriveConfig_FloppyCount_Shift           * 0
DriveConfig_FixedDiscCount_Mask         * &FF
DriveConfig_FixedDiscCount_Shift        * 8
DriveConfig_DefaultDrive_Mask           * &FF
DriveConfig_DefaultDrive_Shift          * 16
DriveConfig_StartupOpt_Mask             * &FF
DriveConfig_StartupOpt_Shift            * 24
DriveConfig_StartupOpt_NoDir            * 1:SHL:30 ; Start with no directory

;
; FileCore_Create map size guesses in register R6 (unused with big discs)
MapSizeEstimate_Drive4_Mask             * &FF
MapSizeEstimate_Drive4_Shift            * 0
MapSizeEstimate_Drive5_Mask             * &FF
MapSizeEstimate_Drive5_Shift            * 8
MapSizeEstimate_Drive6_Mask             * &FF
MapSizeEstimate_Drive6_Shift            * 16
MapSizeEstimate_Drive7_Mask             * &FF
MapSizeEstimate_Drive7_Shift            * 24

;
; FileCore_DiscFormat format densities
DensityFixedDisc                        * 0
DensitySingle                           * 1
DensityDouble                           * 2        ; 250kbps
DensityDoublePlus                       * 3        ; 300kbps
DensityQuad                             * 4
DensityOctal                            * 8

;
; FileCore_DiscFormat format specifiers
Format_L                                * 0
Format_D                                * 1
Format_E                                * 2
Format_F                                * 3
Format_G                                * 4
Format_Floppy                           * 1:SHL:7

;
; FileCore_FloppyStructure flags in R2
FloppyStructure_Force_OldMap            * 1:SHL:6
FloppyStructure_Force_OldDir            * 1:SHL:7

;
; Defect list end markers
DefectList_End                          * &20000000
DefectList_BigMap_End                   * &40000000

;
; FileCore_Features bits
Feature_NewErrors                       * 1:SHL:0
Feature_FloppyDiscsCanMountLikeFixed    * 1:SHL:1

;
; FileCore_DiscOp and FileCore_SectorDiscOp legacy disc addresses
LegacyDiscAddress_DriveNumber_Mask      * 2_111
LegacyDiscAddress_DriveNumber_Shift     * (32 - 3)
LegacyDiscAddress_SectorOffset_Mask     * &1FFFFFFF
LegacyDiscAddress_SectorOffset_Shift    * 0
LegacyDiscAddress_ByteOffset_Mask       * &1FFFFFFF
LegacyDiscAddress_ByteOffset_Shift      * 0

;
; FileCore_DiscOp64 extended address block
                                        ^ 0
ExtendedDiscAddress_DriveNumber         # 1
ExtendedDiscAddress_Reserved            # 3        ; Must be zero
ExtendedDiscAddress_LowWord             # 4
ExtendedDiscAddress_HighWord            # 4
SzExtendedDiscAddress                   # 0

;
; FileCore disc record
                                        ^ 0
DiscRecord_Log2SectorSize               # 1        ; log2 sector size
DiscRecord_SecsPerTrk                   # 1
DiscRecord_Heads                        # 1        ; n-1 for old adfs floppy format
DiscRecord_Density                      # 1        ; 0/1/2/3/4/8 fixed/single/double/double+/quad/octal
DiscRecord_IdLen                        # 1        ; Length in bits of id field in the map
DiscRecord_Log2bpmb                     # 1        ; log2 bytes for each bit in map, 0 for old format
DiscRecord_Skew                         # 1        ; track to track sector skew for random access
DiscRecord_BootOpt                      # 1        ; boot option for *OPT4
DiscRecord_LowSector                    # 1        ; Lowest sector number on a track and flags:
DiscRecord_LowSector_Shift              * 0
DiscRecord_LowSector_Mask               * &3F      ; 0-5  Lowest numbered sector on a track
DiscRecord_SequenceSides_Flag           * 1:SHL:6  ; 6    Tracks are numbered 0..s-1 on side 0, then s..2s-1 on side 1, etc
DiscRecord_DoubleStep_Flag              * 1:SHL:7  ; 7    Double step
DiscRecord_NZones                       # 1        ; # zones in map
DiscRecord_ZoneSpare                    # 2        ; # bits in zones after 0 which are not map bits
DiscRecord_Root                         # 4        ; Disc address of the root directory
DiscRecord_DiscSize                     # 4        ; in bytes
DiscRecord_DiscId                       # 2        ; Cycle number
DiscRecord_DiscName                     # 10
SzDiscRecSig                            # 0
DiscRecord_DiscType                     # 4        ; FileType of disc: FileType_Data indicates
                                                   ; that the disc is, as yet, unidentified.
                                                   ; This may occur as a result of the identification
                                                   ; process failing, or the identification process
                                                   ; not yet happening. FileType_Data discs have no
                                                   ; concept of a unique identifier so drive independance
                                                   ; when accessing them is not possible.
DiscRecord_BigMap_DiscSize2             # 4        ; top 32bits of the disc size.  This combines with
                                                   ; DiscSize to give the full size of the disc.
DiscRecord_BigMap_ShareSize             # 1        ; sharing granularity, in sectors
DiscRecord_BigMap_Log2ShareSize_Mask    * &F
DiscRecord_BigMap_Log2ShareSize_Shift   * 0
DiscRecord_BigMap_Flags                 # 1        ; flags
DiscRecord_BigMap_BigFlag               * 1        ; 0 for small disc, 1 for big
DiscRecord_BigMap_NZones2               # 1        ; high byte of number of zones
DiscRecord_BigMap_Reserved              # 1
DiscRecord_BigDir_DiscVersion           # 4        ; version number of disc format
DiscRecord_BigDir_RootDirSize           # 4        ; size of root dir
SzDiscRecSig2                           # 0
DiscRecord_BigDir_Reserved              # 8
SzDiscRecSigSpace                       # 0
        ASSERT  (DiscRecord_ZoneSpare :MOD: 4)=2

;
; FileCore_DiscOp reason codes
                                        ^ 0
DiscOp_Verify                           # 1
DiscOp_ReadSecs                         # 1
DiscOp_WriteSecs                        # 1
DiscOp_ReadTrk                          # 1
DiscOp_WriteTrk                         # 1
DiscOp_Seek                             # 1
DiscOp_Restore                          # 1
DiscOp_StepIn                           # 1        ; floppy only
DiscOp_StepOut                          # 1        ; floppy only
DiscOp_CachedReadSecs                   # 1
DiscOp_Reserved0                        # 1
DiscOp_Reserved1                        # 1
DiscOp_Reserved2                        # 1
DiscOp_Reserved3                        # 1
DiscOp_Reserved4                        # 1
DiscOp_Specify                          # 1        ; fixed disc only
DiscOp_Op_Mask                          * &F
DiscOp_Op_AltDefectList_Flag            * 1:SHL:4
DiscOp_Op_ScatterList_Flag              * 1:SHL:5
DiscOp_Op_IgnoreEscape_Flag             * 1:SHL:6
DiscOp_Op_IgnoreTimeout_Flag            * 1:SHL:7
DiscOp_Op_Atomic_Flag                   * 3:SHL:6  ; ignore both escape and timeout
DiscOp_Op_BackgroundOp_Flag             * 1:SHL:8  ; internal use only

;
; FileCore_MiscOp reason codes
                                        ^ 0
MiscOp_Mount                            # 1
MiscOp_PollChanged                      # 1
MiscOp_PollChanged_NotChanged_Flag      * 1:SHL:0
MiscOp_PollChanged_MaybeChanged_Flag    * 1:SHL:1
MiscOp_PollChanged_Changed_Flag         * 1:SHL:2
MiscOp_PollChanged_Empty_Flag           * 1:SHL:3
MiscOp_PollChanged_Ready_Flag           * 1:SHL:4
MiscOp_PollChanged_40Track_Flag         * 1:SHL:5
MiscOp_PollChanged_EmptyWorks_Flag      * 1:SHL:6
MiscOp_PollChanged_ChangedWorks_Flag    * 1:SHL:7
MiscOp_PollChanged_HiDensity_Flag       * 1:SHL:8
MiscOp_PollChanged_DensityWorks_Flag    * 1:SHL:9
MiscOp_PollChanged_ReadyWorks_Flag      * 1:SHL:10
MiscOp_LockDrive                        # 1
MiscOp_UnlockDrive                      # 1
MiscOp_PollPeriod                       # 1
MiscOp_Eject                            # 1
MiscOp_ReadInfo                         # 1
MiscOp_DriveStatus                      # 1     ; for checking status of a drive
MiscOp_DriveLocked_Flag                 * 1:SHL:0
MiscOp_DriveHidden_Flag                 * 1:SHL:1
MiscOp_PostMount                        # 1
MiscOp_FirstUnknown                     # 0

        OPT     OldOpt
        END
