;> CoreErrors

; error codes are 32 bits and have different internal and external formats

; Internal format
; b31=1 => disc error
; b0 to b20 disc byte address / 256
; b21 t0 b23 drive
; b24 to b29 disc error num

;  b30        0 (to distinguish from other peoples errors)
; b31=0 => not disc error
; b0 to b6 error num
; b8 to b29 clear
;  b30        0 (to distinguish from other peoples errors)
; b31 set if disc error

; External Format
; b0 to b7 error num
; b8 to b29 module number
; b30 0
; b31 0

;except for 'escape' and 'disc error' internal error num = external error num

MaxDiscErr      * 2_00111111

ExternalErrorBit bit 30

DiscErrorBit     bit 31

FileCoreModuleNum * &108

        MACRO
$num error $name,$str
        ASSERT  &$num>0         ;word aligned 0 byte marks entry end 
        ASSERT  &$num<&100
$name.Err *     &$num
        &       &$num :OR: (FileCoreModuleNum :SHL: 8)
        =       "$str",0
        %       (4-(.-org):MOD:4):MOD:4 ;align with zeroes
        MEND

ErrorTable
IntEscapeErr * &80

11      error   ExtEscape,Escape
;92 ABORTED
;93 WONT
94      error   Defect,Can't map defect out
;95 TOO MANY DEFECTS
96      error   CantDelCsd,Can't delete current directory
97      error   CantDelLib,Can't delete library
98      error   CompactReq,Compaction required
99      error   MapFull,Free space map full
9A      error   BadDisc,Bad disc        ;not ADFS format
9B      error   TooManyDiscs,Too many discs
;9C      error   LibUnset,Library unset
9D      error   BadUp,Illegal use of ^
9E      error   AmbigDisc,Ambiguous disc name
9F      error   NotRefDisc,Not same disc
A0      error   InUse,FileCore in use
A1      error   BadParms,Bad parameters
A2      error   CantDelUrd,Can't delete user root directory
;A3      error   IsADir,Is a directory
;A4      error   IsAFile,Is a file
A5      error   Buffer,No room for buffer
A6      error   Workspace,FileCore Workspace corrupt
A7      error   MultipleClose,Multiple file closing errors
A8      error   BrokenDir,Broken directory
A9      error   BadFsMap,Bad free space map
AA      error   OneBadFsMap,One copy of map corrupt (use *CheckMap)
AB      error   BadDefectList,Bad defect list
AC      error   BadDrive,Bad drive
AD      error   Size,Sizes don't match                          ;BACKUP
AE      error   SameDisc,Same disc                              ;BACKUP
AF      error   DestDefects,Destination disc has defects        ;BACKUP
B0      error   BadRename,Bad RENAME
B3      error   DirFull,Directory full
B4      error   DirNotEmpty,Directory not empty
;B7 OUTSIDE FILE
BD      error   Access,Access violation
C0      error   TooManyOpen,Too many open files
;C1 NOT OPEN FOR UPDATE
C2      error   Open,File open
C3      error   Locked,Locked
C4      error   Exists,Already exists
C5      error   Types,Types don't match
C6      error   DiscFull,Disc full
DiscErr * &C7
C9      error   WriteProt,Protected disc
[ FileCache
CA      error   DataLost,Data lost
]
;CB BAD OPT
CC      error   BadName,Bad name
;CD DRIVE NOT READY
CF      error   BadAtt,Bad attribute
D3      error   DriveEmpty,Drive empty
D4      error   DiscNotFound,Disc not found
D5      error   DiscNotPresent,Disc not present
D6      error   NotFound,Not found
DE      error   Channel,Channel
;DF EOF
FD      error   WildCards,Wild cards
FE      error   BadCom,Bad command
        &       FileCoreModuleNum :SHL: 8 ;end of table marker
        Text    "File Core error"          ;failsafe in case no match found
        END