Commit d52791ba authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Teach FileCore_LayoutStructure and Service_IdentifyDisc how to do 1 zone fixed discs.

From the change logs it was last fixed sometime around FileCore 2.50 era, but has been long broken.
The boot block was in the right place, but was overwritten by the root directory, and the wrong size entry was claimed in the map, amongst other errors.
Free'd up R6 in LayoutFreeSpaceMap to avoid having to keep reevaluating the number of zones - makes it a bit more readable. Corrected inaccurate comments. Checked the code paths for new map with and without boot block, with and without long filenames.
Test app 'Make1Zone' generates a small disc image which can be inspected in a hex editor for correctness.
In the identify code, be more strict about looking for a boot block only on fixed discs since they cannot occur on floppies (saves time, wasn't necessarily wrong).
The concept of a boot block at &C00 only works when 2 copies of the map can be fitted underneath that address, for future 2k and 4k sector sizes these do not fit and it is likely that 1 zone fixed discs are forbidden (a drive with 4k sectors would typically be > 512GB and 1 zone would be ~32MB so spilling into a second zone would waste < 0.01%).
Other minor changes:
* Free command now groups the 'K' with 'bytes' to match OS_ConvertFileSize.
* FileCore20 debug didn't assemble.
* FileCore33 beefed up comments.
* GenSWIs debug didn't assemble.
Tested with a special cut of RAMFS manually loading various 1 zone images into its dynamic area and checking they mount, have a sensible *MAP and *FREE result, can be written to, and don't have broken directories.

Version 3.46. Tagged as 'FileCore-3_46'
parent 9ae2d7ca
......@@ -24,8 +24,8 @@ DC1:| hat einen Defekt an Position %0.|M|J
AreYouSure:Sind Sie sicher (J/N)?
FC0:Bytes frei &%0 = %1|M|J
FC1:Bytes benutzt &%0 = %1|M|J
FCK0:Bytes frei &%0 = %1K bytes|M|J
FCK1:Bytes benutzt &%0 = %1K bytes|M|J
FCK0:Bytes frei &%0 = %1 Kbytes|M|J
FCK1:Bytes benutzt &%0 = %1 Kbytes|M|J
MC0:( Start, Länge) altes Organisationsformat, alte Verzeichnisse|M|J
MC1:( Start, Länge) altes Organisationsformat, neue Verzeichnisse|M|J
MC2:( Start, Länge) neues Organisationsformat, alte Verzeichnisse|M|J
......
......@@ -28,8 +28,8 @@ DC1:| has defect at offset %0|M|J
AreYouSure:Are you sure (Y/N) ?
FC0:Bytes free &%0 = %1|M|J
FC1:Bytes used &%0 = %1|M|J
FCK0:Bytes free &%0 = %1K bytes|M|J
FCK1:Bytes used &%0 = %1K bytes|M|J
FCK0:Bytes free &%0 = %1 Kbytes|M|J
FCK1:Bytes used &%0 = %1 Kbytes|M|J
MC0:( start, length) old map, old directories|M|J
MC1:( start, length) old map, new directories|M|J
MC2:( start, length) new map, old directories|M|J
......
File added
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "3.45"
Module_Version SETA 345
Module_MajorVersion SETS "3.46"
Module_Version SETA 346
Module_MinorVersion SETS ""
Module_Date SETS "14 Oct 2011"
Module_ApplicationDate SETS "14-Oct-11"
Module_Date SETS "25 Nov 2011"
Module_ApplicationDate SETS "25-Nov-11"
Module_ComponentName SETS "FileCore"
Module_ComponentPath SETS "castle/RiscOS/Sources/FileSys/FileCore"
Module_FullVersion SETS "3.45"
Module_HelpVersion SETS "3.45 (14 Oct 2011)"
Module_FullVersion SETS "3.46"
Module_HelpVersion SETS "3.46 (25 Nov 2011)"
END
/* (3.45)
/* (3.46)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 3.45
#define Module_MajorVersion_CMHG 3.46
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 14 Oct 2011
#define Module_Date_CMHG 25 Nov 2011
#define Module_MajorVersion "3.45"
#define Module_Version 345
#define Module_MajorVersion "3.46"
#define Module_Version 346
#define Module_MinorVersion ""
#define Module_Date "14 Oct 2011"
#define Module_Date "25 Nov 2011"
#define Module_ApplicationDate "14-Oct-11"
#define Module_ApplicationDate "25-Nov-11"
#define Module_ComponentName "FileCore"
#define Module_ComponentPath "castle/RiscOS/Sources/FileSys/FileCore"
#define Module_FullVersion "3.45"
#define Module_HelpVersion "3.45 (14 Oct 2011)"
#define Module_LibraryVersionInfo "3:45"
#define Module_FullVersion "3.46"
#define Module_HelpVersion "3.46 (25 Nov 2011)"
#define Module_LibraryVersionInfo "3:46"
......@@ -277,20 +277,16 @@ Check1 # 1 ;checksum on sector 1
; New map
ZoneDiscRecSz * 60 ;reserve additional bytes
Zone0Bits * ZoneDiscRecSz*8
ASSERT ZoneDiscRecSz >= SzDiscRec
^ 0
ZoneCheck # 1
FreeLink # 2 ;15 bit free space start link
CrossCheck # 1 ;EORing this byte for all zones should yield &FF
DummyLenBit bit 31 ;always set
ZoneDiscRecSz * 60 ;reserve additional bytes
ASSERT ZoneDiscRecSz>=SzDiscRec
ZoneHead # ZoneDiscRecSz
Zone0Bits * ZoneDiscRecSz*8
;zones are followed in RAM by table of one byte of flags per zone
ZoneValid bit 0
......@@ -479,7 +475,7 @@ BigDirTailSize * -@
BigDirMaxNameLen * 255 ; maximum name length is 255 chars
BigDirMinSize * 2048
BigDirMinSize * &800
BigDirMaxSize * 4*1024*1024
]
......
......@@ -125,7 +125,7 @@ WhatDiscCommon
BL SetVOnR0
[ Debug4 :LOR: DebugL
LDR lr, [r3, #RootDir]
LDR lr, [r3, #DiscRecord_Root]
DREG lr, "RootDir on Exit WhatDisc is: "
DREG R1, "<WhatDisc(Drv=",cc
......
......@@ -659,13 +659,13 @@ MapDiscAdd ROUT
|
Push "R0,LR"
]
MOV R0, #8
MOV R0, R0, LSL R7
MOV R0, #8 ; bits in a byte
MOV R0, R0, LSL R7 ; bits in a zone
LDR LR, [R5,#DiscRecord_ZoneSpare-2]
SUB R0, R0, LR, LSR #16 ;bits used in a zone
MOVS LR, R9, LSR #1 ;zone containing map
SUB R0, R0, LR, LSR #16 ; bits used in a zone
MOVS LR, R9, LSR #1 ; zone containing map
MULS R2, R0, LR
SUBNE R2, R2, #Zone0Bits
SUBNE R2, R2, #Zone0Bits ; adjust for zone 0 disc record
LDRB R0, [R5,#DiscRecord_Log2bpmb]
LDR LR, [R5,#DiscRecord_Root]
AND LR, LR,#DiscBits
......@@ -962,7 +962,7 @@ MapPtrToDiscAdd ROUT
LDRB LR, [R10,#ZoneHead+DiscRecord_Log2bpmb]
; when we get here, we have the disc address in units map bits. Just shift
; left by lg2bpmb, and if bigdisc also adjust for the sector size
; left by log2bpmb, and if bigdisc also adjust for the sector size
[ BigDisc
LDRB R10,[R10,#ZoneHead+DiscRecord_Log2SectorSize] ; log2 sector size
......@@ -1028,7 +1028,7 @@ MapPtrToZoneBase ROUT
LDRB LR, [R10,#ZoneHead+DiscRecord_Log2bpmb]
; when we get here, we have the disc address in units map bits. Just shift
; left by lg2bpmb, and if bigdisc also adjust for the sector size
; left by log2bpmb, and if bigdisc also adjust for the sector size
LDRB R10,[R10,#ZoneHead+DiscRecord_Log2SectorSize] ; log2 sector size
SUBS LR,LR,R10 ; get overall shift
......
This diff is collapsed.
......@@ -461,6 +461,11 @@ DO64_R2Offset * 4
ORR R2,R1,R2,LSL #(32-3) ; sector addr
EOR R2, R2, #bit31 ; Convert to internal drive numbering
[ DebugL :LOR: Debug2D
DREG R2, "Original address : "
DREG R3, "Log2SectorSize : "
]
Pull "R1,R3"
[ DebugL :LOR: Debug2D
DREG r1, "DriveOp(",cc
......@@ -473,10 +478,6 @@ DO64_R2Offset * 4
; LDR LR,DiscOp_ByteAddr ; get end addr
LDRB R5,[R5,#DiscRecord_Log2SectorSize]
LDR R1,[SP, #DO64_R2Offset]
[ DebugL :LOR: Debug2D
DREG R2, "Original address : "
DREG R3, "Log2SectorSize : "
]
BIC R2,R2,#DiscBits
RSB LR,R5,#32
MOV LR,R2,LSR LR
......
......@@ -18,7 +18,7 @@
; change log:
; 15 May 1997: SBP: Changed SanityCheckEDiscRecord to support LinkBits up to 16.
; 15 May 1997: SBP: Changed SanityCheckEDiscRecord to support idlen up to 16.
; ============
......@@ -153,7 +153,7 @@ IdentifyFileCoreDisc ROUT
MOV R12, R13
DREG R12, ","
]
MOV r12, r8
MOV r12, r8
[ DebugL
DREG r8, "r8 in is "
DREG r12, "Meaning ws is "
......@@ -755,7 +755,7 @@ SanityCheckEDiscRecord ROUT
CMP r0, #0
[ DebugL
BNE %FT01
DLINE "Failed on LinkBits = 0"
DLINE "Failed on idlen = 0"
01
]
BEQ %FT85
......@@ -788,7 +788,7 @@ SanityCheckEDiscRecord ROUT
MOVS r14, r1, LSR r0
[ DebugL
BEQ %FT01
DLINE "Failed on 2^LinkBits < Max Total objects"
DLINE "Failed on 2^idlen < Max Total objects"
01
]
BNE %FT85 ; If shifting right by idlen leaves a non-0
......@@ -800,7 +800,7 @@ SanityCheckEDiscRecord ROUT
LDRB r2, [sp, #DiscRecord_IdLen]
[ BigMaps
; if BigMaps then idlen can be more than MaxFreeLink, so test agains
; if BigMaps then idlen can be more than MaxFreeLink, so test against
; MaxFreeLink (we're being paranoid here, since maximum sector is 1024
; bytes, needing 13 link bits)
......@@ -851,7 +851,7 @@ SanityCheckEDiscRecord ROUT
LDRB r1, [sp, #DiscRecord_NZones]
]
MOV r1, r1, ASL #1
LDRB r0, [sp, #DiscRecord_BigMap_ShareSize] ; factor in sharesize
LDRB r0, [sp, #DiscRecord_BigMap_ShareSize] ; factor in sharesize
MOV lr, #1
ADD r1, r1, lr, LSL r0
SUB r1, r1, #1
......@@ -861,8 +861,8 @@ SanityCheckEDiscRecord ROUT
LDR r0, [sp, #DiscRecord_Root]
TEQ r0, r1
|
; Check RootDir is sensible:
; Must be &000002nn where nn=2*Zones+1
; Check RootDir is sensible: must be &000002nn
; where nn = (2*Zones) + 1
[ BigMaps
LDRB r1, [sp, #DiscRecord_NZones]
LDRB r0, [sp, #DiscRecord_BigMap_NZones2] ; r0 due to be corrupted
......@@ -883,20 +883,28 @@ SanityCheckEDiscRecord ROUT
]
BEQ %FT10
; or, if Zones == 1, then &000002nn where nn = (&e00 + 1<<DiscRecord_Log2SectorSize - 1)>>DiscRecord_Log2SectorSize + 1
LDRB r1, [sp, #DiscRecord_NZones]
TEQ r1, #1
; or, another last ditch attempt if Zones=1 and density=0
; where nn = ((bootblock + bootblocksize + (1<<DiscRecord_Log2SectorSize) - 1) >> DiscRecord_Log2SectorSize) + 1
[ BigMaps
LDREQB r1, [sp, #DiscRecord_BigMap_NZones2]
TEQEQ r1, #0 ; have to also check that Zones2 is 0
LDRB r1, [sp, #DiscRecord_NZones]
LDRB r14, [sp, #DiscRecord_BigMap_NZones2]
ORR r1, r1, r14, LSL #8
|
LDRB r1, [sp, #DiscRecord_NZones]
]
LDRB r14, [sp, #DiscRecord_Density]
ORR r14, r1, r14, LSL #16
TEQ r14, #1 ; EQ iff density=0 zones=1
BNE %FT85
[ DebugL
DLINE "Might be a 1 zone fixed disc"
]
MOV r14, #1
LDRB r1, [sp, #DiscRecord_Log2SectorSize]
MOV r14, r14, ASL r1
ADD r14, r14, #DefectListDiscAdd + SzDefectList
SUB r14, r14, #1
ADD r14, r14, #DefectListDiscAdd + SzDefectList
MOV r14, r14, LSR r1
ADD r14, r14, #1
ORR r14, r14, #&200
......@@ -1084,11 +1092,11 @@ SanityCheckNewMap ROUT
LDRB r9, [r5, #DiscRecord_NZones]
LDRB r7, [r5, #DiscRecord_BigMap_NZones2]
ADD r9, r9, r7, LSL #8
LDRB r7, [r5, #DiscRecord_Log2SectorSize]
|
LDRB r7, [r5, #DiscRecord_Log2SectorSize]
LDRB r9, [r5, #DiscRecord_NZones]
]
LDRB r7, [r5, #DiscRecord_Log2SectorSize]
BL MapDiscAdd
MOV r7, r2
......@@ -1188,10 +1196,12 @@ SanityCheckNewMap ROUT
BNE %FT85
; Try on the second map copy
LDRB r8, [r5, #DiscRecord_NZones]
[ BigMaps
LDRB r8, [r5, #DiscRecord_NZones]
LDRB r0, [r5, #DiscRecord_BigMap_NZones2]
ADD r8, r8, r0, LSL #8
|
LDRB r8, [r5, #DiscRecord_NZones]
]
LDRB r0, [r5, #DiscRecord_Log2SectorSize]
[ BigDisc
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment