home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Meeting Pearls 3
/
Meeting_Pearls_III.iso
/
Pearls
/
disk
/
DiskMon
/
ded
/
ded.doc
< prev
next >
Wrap
Text File
|
1993-11-02
|
19KB
|
680 lines
Disk-Editor, Version 1.1, User documentation
Edition 3-Nov-1993
Copyright 1992,3 Misoftware Computing
1. I'm sorry for my bad English.
--------------------------------
2. Requirements
---------------
Hardware:
An AMIGA, Version 1.2 or higher (tested on 1.3, 2.0 and 3.0, next version
will be 2.0+ only), NTSC or PAL, cca 100KB of memory free, 5 bytes per sector
for bitmap (for standard floppy format it's about 8800 bytes), 512 bytes for
sector data, some memory for CD, drive, disk...
Software:
Arp library, Req or Reqtools library. If you want nicer design, you need
Reqtools library. If DED is unable to open it, it will use Req, but the design
has been made for Reqtools.
3. Design
---------
On the screen title, there is the program version and number of sectors in
memory displayed. In the bottom of the screen, there is a status line
containing type of current sector, position in it, its number, its flags and
total free memory.
3.1 Type
Program recognises 21 types of sectors: BOOT, ROOT, USERDIR, FHEADER, EXT.,
DATA, BITMAP, DIRCACHE, LDIR, LFILE, LSEG, FSHD, PART., BAD BLK, RIGID, BMAP
EXT,???, SUSPECT, BITMAP?, FREE, DATA?
BOOT - Bootblock
ROOT - Rootblock
USERDIR - User directory
FHEADER - File header
EXT. - Extension of file header
DATA - Data block
BITMAP - Bitmap block
DIRCACHE - Directory cache block (introduced in OS V39, DED may handle them
under any OS version including 1.2)
LDIR - Linked directory (introduced in OS V36, DED may handle them under
any OS version including 1.2)
LFILE - Linked fileheader (introduced in OS V36, DED may handle them under
any OS version including 1.2)
LSEG - Load segment block
FSHD - Filesystem header block
PART. - Partition block
BAD BLK - Replacement of bad block
RIGID - Disk rigid block
BMAP EXT - Bitmap extension block
??? - Unknown type, but may be free (use "Load root & bitmap" for correct
identification)
SUSPECT - Unknown type, but allocated or something very suspicious
BITMAP? - Sector can be a bitmap
FREE - Free block
DATA? - May be a FFS data block (use "Load root & bitmap" for correct
identification)
3.2 Position in block
Format of numbers: there are six numbers, separated by slashes: pos in
bytes in dec/pos in words in dec/pos in longs in dec space pos in bytes in
hex/pos in words in hex/pos in longs in hex.
If you edit bitmap block in DOS edit mode, the number of the sector, pointed
to by mouse, is displayed here, instead.
3.3 Block
Number of block, pointed to by the cursor.
3.4 Sector flags
1st character: Sector is changed *=changed, #=not changed
2nd character: Sector is selected +=selected, #=not selected
3rd character: Checksum G=good, B=bad, Nothing=has no checksum
4th character: Status B=Busy
3.5 Free memory
Current amount of total free memory.
4. Control
----------
DED can be controlled using:
- menus
- cursor keys - move the cursor by one position in some way
- up and down arrows with shift - move the cursor by one screen
- up and down arrows with alt - move the cursor by 12 lines
- left and right arrows with alt - move the cursor by one byte
- TAB key - switches between ASCII and number edit modes
- CTRL and up/down/left/right - hotkeys for
Parent/Descendant/Previous object/Next object menu functions
- F-key functions - If you press CTRL + one of the F-keys, you may set your
own ASCII-code of this F-key. But this code is valid only in the edit mode.
CTRL + SHIFT + one of the F-keys => you will have to enter sector number. If
you press SHIFT and this F-key, DED will jump on sector you defined before.
You can clear the sector number by entering empty string or -1.
In number gadgets, you can enter an expression. Expressions can contain
numbers, operators (see the table below), variables (a-z), $ followed by
hexadecimal number, < (means: minimal allowed value), > (maximal allowed
value). If you want to set a variable, you must use the calculator function
to do it.
Operators: (sorted by priority)
*,/ multiplication, division
+,- addition, subtraction
& logical AND
^,| logical XOR and OR
Control in DOS edit mode:
- CTRL and up/down/left/right - hotkeys for
Parent/Descendant/Previous object/Next object menu functions
- up or left - same as menuitem "Previous sector"
- down or right - same as menuitem "Next sector"
- menuitem "Jump to byte ..." is changed to "Jump to bitmap flag of sector
..."
- You may change any information (including sector type) by clicking on it.
You cannot change BOOT, BITMAP, FREE and DATA? sector types and the ROOT
type can be switched only between ROOT and SUSPECT types.
- SHIFT + F-key functions (see above)
- up and down arrows with shift - scroll the display
5. Testing
----------
This version has been written on AMIGA 500 with 2MB of RAM, one external
disk drive and system 1.3.
Tested on:
My AMIGA
AMIGA 500+ with 6 MB of RAM, 50MB hard disk and kickstart 2.0
AMIGA 500 with 1MB of chip and 1MB of fast RAM, one external drive
and a 45 MB hard-disk.
AMIGA 1200 with 2 MB of CHIP-RAM, 80MB hard disk
6. Miscellaneous
----------------
This program is freely distributable, but the copyright remains with the
author at all times. It's provided "as is"; no warranties are made. All use
Is at your own risk, and no liability or responsibility is assumed.
This is a first public released version. Here are still some unknown bugs,
but I don't know where. If you know some, please write to:
Internet E-mail:
lemming@k332.feld.cvut.cz
or Michal Kara
Krosenska 543
Praha 8-Troja
181 00
Czech republic
If you call DED from CLI, you can also specify mounted device by giving it
as an argument - for example "ded df0:".
7. Thanks
---------
Thanks to Martin Mares of MJSoft System Software for testing, critics and
some information about AMIGA system,
Pavel Troller of SinSoft for language censoring,
Honza Kratochvil ("LACE") for testing and some ideas
and Petr Cisar (PCSoft) & "mr. Zub" for risking integrity of their hards.
No thanks to PC for its existency.
8. History
----------
History is stored in the ded.history file.
9. Plans for future
-------------------
- Check and repair disk (The Re-hash function in this version has some
repairing effects...)
- Recover actions
- User selectable screen mode
- Wildcards in search
- Optimize the code
- Dynamic bitmap of sectors (less than 5 bytes for every sector)
- Variable length of block
- The next release will be probably 2.0+ only (some 2.0+ features will be
added)
- Use only reqtools.library, no req
10. Appendixes
--------------
APPENDIX A
DOS STRUCTURES
(Thanks to Martin Mares for most of these structures)
Here are dos structures for the Old File System (OFS), offsets are in
longs:
ROOT BLOCK:
This block is in the middle of the medium. It's the root directory.
0 T.SHORT (=2)
1 0
2 0
3 HASH TABLE SIZE
4 0
5 CHECKSUM
6 HASH TABLE
...
SIZE-50 BITMAP FLAG (TRUE=BITMAP IS VALID)
SIZE-49 BITMAPBLOCKS
...
SIZE-24 BITMAP EXTENSION BLOCK
SIZE-23 DAYS LAST ACCESS
SIZE-22 MINS LAST ACCESS
SIZE-21 TICKS LAST ACCESS
SIZE-20 DISK NAME
...
SIZE-7 CREATE DAYS
SIZE-6 CREATE MINS
SIZE-5 CREATE TICKS
SIZE-4 0
SIZE-3 0
SIZE-2 FIRST DIRECTORY CACHE BLOCK
SIZE-1 ST.ROOT (=1)
USER DIR:
0 T.SHORT (=2)
1 POINTER TO SELF
2 0
3 0
4 0
5 CHECKSUM
6 HASH TABLE
...
SIZE-50 NOT USED
SIZE-48 PROTECTION BITS
SIZE-47 0
SIZE-46 COMMENT
...
SIZE-23 DAYS LAST ACCES
SIZE-22 MINS LAST ACCES
SIZE-21 TICKS LAST ACCES
SIZE-20 DIRECTORY NAME
...
SIZE-11 PREVIOUS BLOCK IN LINK-LIST - This value is always NULL.
SIZE-10 NEXT BLOCK IN LINK-LIST
SIZE-4 HASH CHAIN (NEXT ENTRY WITH SAME HASH VALUE)
SIZE-3 PARENT DIRECTORY
SIZE-2 FIRST DIRECTORY CACHE BLOCK
SIZE-1 ST.USERDIR (=2)
FILE HEADER:
0 T.SHORT (=2)
1 POINTER TO SELF
2 # OF DATA BLOCKS IN THIS PART
3 0
4 1.ST DATA BLOCK
5 CHECKSUM
6 ...
DATABLOCKS-
SIZE-52 2nd DATA BLOCK
SIZE-51 1ST DATA BLOCK
SIZE-50 NOT USED
SIZE-48 PROTECTION BITS
SIZE-47 BYTE SIZE
SIZE-46 COMMENT
...
SIZE-23 DAYS LAST ACCES
SIZE-22 MINS LAST ACCES
SIZE-21 TICKS LAST ACCES
SIZE-20 FILE NAME
...
SIZE-11 PREVIOUS BLOCK IN LINK-LIST - This value is always NULL.
SIZE-10 NEXT BLOCK IN LINK-LIST
SIZE-4 NEXT ENTRY WITH SAME HASH VALUE
SIZE-3 PARENT DIRECTORY
SIZE-2 POINTER TO EXTENSION OR NULL
SIZE-1 ST.FILE (=-3)
EXTENSION OF FILE HEADER:
0 T.LIST (=16)
1 POINTER TO SELF
2 # OF DATA BLOCKS IN THIS PART
3 0
4 0
5 CHECKSUM
6 ...
DATABLOCKS-
SIZE-52 2nd DATA BLOCK
SIZE-51 1ST DATA BLOCK
SIZE-50 NOT USED
SIZE-4 0
SIZE-3 FILE HEADER
SIZE-2 POINTER TO EXTENSION OR NULL
SIZE-1 ST.FILE (=-3)
DATA BLOCK:
0 T.DATA (8)
1 POINTER TO FILE HEADER
2 NUMBER IN FILE (1ST,2ND,20TH DATA BLOCK)
3 DATA SIZE
4 NEXT DATA BLOCK OR NULL
5 CHECKSUM
6 DATA
...
BITMAP EXTENSION BLOCK:
If there's more than 25 bitmap sectors, pointers to next bitmap blocks are
stored in this block. All longs (except the last one) are used as pointers to
the bitmap blocks. Last long points to the next BITMAP EXTENSION BLOCK (if it
exists).
0 BITMAP BLOCK POINTERS
...
SIZE-1 NEXT BITMAP EXTENSION BLOCK
BITMAP:
Bitmap is stored in longs. The bootblocks are not stored in the bitmap. If
there are two bootblocks, the first bit (Bit #0) of the first long of data is
for sector #2. The second bit (bit #1) of the third long is for sector #67...
If the bit is clear, sector is allocated. In dos edit mode, DED converts this
user unfriendly defined rule so sectors are displayed consecutively on the
screen.
0 CHECKSUM
1 DATA
...
For Fast File System (FFS) it's the same, but data block contain only data
(512 bytes).
DIRECTORY CACHE BLOCK:
0 (21)
1 SELFPOINTER
2 POINTER TO DIRECTORY
3 NUMBER ITEMS STORED IN THIS BLOCK
4 NEXT DIRECTORY CACHE BLOCK
5 CHECKSUM
6 - FIRST RECORD
RECORD STRUCTURE: ( !!! OFFSETS ARE IN BYTES !!! )
0 POINTER TO FILEHEADER OR USERDIR OF THIS RECORD
4 SIZE OF FILE
8 PROTECTION BITS
12 0
16 DAYS LAST ACCES
18 MINS LAST ACCES
20 TICKS LAST ACCES
22 RECORD TYPE ($FD=FILE, $FC=LINKED FILE, $02=DIR, $04=LINKED DIR)
23 NAME (BSTR)
COMMENT (BSTR)
THERE MAY BE NULL BYTE (FOR WORD-ALIGNMENT)
LINKED FILE:
0 T.SHORT (=2)
1 SELFPOINTER
2 0
3 0
4 0
5 CHECKSUM
SIZE-23 DAYS LAST ACCESS
SIZE-22 MINS LAST ACCESS
SIZE-21 TICKS LAST ACCESS
SIZE-20 FILE NAME
...
SIZE-11 PREVIOUS BLOCK IN LINK-LIST
SIZE-10 NEXT BLOCK IN LINK-LIST
SIZE-4 NEXT ENTRY WITH SAME HASH VALUE
SIZE-3 PARENT DIRECTORY
SIZE-1 ST.LINKED FILE (=-4)
LINKED DIRECTORY:
0 T.SHORT (=2)
1 POINTER TO SELF
2 0
3 0
4 0
5 CHECKSUM
...
SIZE-23 DAYS LAST ACCESS
SIZE-22 MINS LAST ACCESS
SIZE-21 TICKS LAST ACCESS
SIZE-20 DIRECTORY NAME
...
SIZE-11 PREVIOUS BLOCK IN LINK-LIST
SIZE-10 NEXT BLOCK IN LINK-LIST
SIZE-4 NEXT ENTRY WITH SAME HASH VALUE
SIZE-3 PARENT DIRECTORY
SIZE-1 ST.LINKED USERDIR (=4)
The following structures and texts were taken from the devices/hardblocks.i
include file.
Next types are blocks of data that exist on a hard disk to describe that
disk. They are not generically accessable to the user as they do not appear on
any DOS drive. The blocks are tagged with a unique identifier, checksummed,
and linked together. The root of these blocks is the RigidDiskBlock.
The RigidDiskBlock must exist on the disk within the first
RDB_LOCATION_LIMIT blocks. This inhibits the use of the zero cylinder in an
AmigaDOS partition: although it is strictly possible to store the
RigidDiskBlock data in the reserved area of a partition, this practice is
discouraged since the reserved blocks of a partition are overwritten by
"Format", "Install", "DiskCopy", etc. The recommended disk layout, then, is to
use the first cylinder(s) to store all the drive data specified by these
blocks: i.e. partition descriptions, file system load images, drive bad block
maps, spare blocks, etc.
NOTE: Optional block addresses below contain $FFFFFFFF to indicate a NULL
address.
Rigid disk block:
0 ID - text "RDSK"
1 Size of this checksummed structure (in longs)
2 Block checksum
3 SCSI Target ID of host
4 Size of disk blocks (in bytes)
5 Flags - Bit 0 = no disks exist to be configured after this one on this
controller
Bit 1 = no LUNs exist to be configured greater than this one at
this SCSI Target ID
Bit 2 = no Target IDs exist to be configured greater than this one
on this SCSI bus
Bit 3 = don't bother trying to perform reselection when talking to
this drive
Bit 4 = Disk identification valid
Bit 5 = Controller identification valid
Bit 6 = Drive supports scsi synchronous mode - CAN BE DANGEROUS TO
USE IF IT DOESN'T! (added 20-Jul-89)
6 Optional bad block list
7 Optional first partition block (PART)
8 Optional fule system header block (FSHD)
9 Optional drive-specific init code *DriveInit(lun,rdb,ior): "C" stk &
d0/a0/a1)
10 Six longs sets to -1
15 Number of drive cylinders
17 Sectors per track
18 Number of drive heads
19 Interleave
20 Landing zone cylinder (would be negative number)
21 Three unused longs
24 Starting cylinder: write precompensation
25 Starting cylinder: reduced write current
26 Drive step rate
27 Five unused longs
32 Low block of range reserved for hardblocks
33 High block of range for these hardblocks
34 Low cylinder of partitionable disk area
35 High cylinder of partitionable data area
36 Number of blocks available per cylinder
37 Seconds needed for autopark - zero for no auto park
38 Highest block used by RDSK (Not including replacement bad blocks)
39 One unused long
40 Two longs for disk vendor
42 Four longs for disk product
45 One long for disk revision
47 Two longs for controller vendor
49 Four longs for controller product
53 One long for controller revision
54 Ten unused longs
Bad block(s) block:
0 ID - text "BADB"
1 Size of this checksummed structure (in longs)
2 Block checksum
3 SCSI Target ID of host
4 Block number of the next Bad block(s) block (link)
5 One unused long
6 There are block pairs - First long - pointer to bad block to replace to
Second long - pointer to good block which replaces it
Partition block:
0 ID - text "PART"
1 Size of this checksummed structure (in longs)
2 Block checksum
3 SCSI Target ID of host
4 Block number of the next Partition block (or -1)
5 Flags - Bit 0 = This partition is bootable
Bit 1 = Do not automount this partition (e.g. manually mounted, but
space reserved here)
6 Two reserved longs
8 Preferred flags for OpenDevice
9 Eight longs for BSRT device name (e.g. DH0)
17 Fiveteen unused longs
The following structure (dos environment) was taken from the
dos/filehandler.i include file (but Partition block structure continuing!).
32 Size of table (in long without this, usually 16)
33 Size of block in longs
34 Sector org (??? - doc says that it's unused, set to 0)
35 Surfaces = number of heads
36 Sectors per block (not used, set to 1)
37 Number of blocks per track
38 Number of blocks reserved by DOS at the start of the partition (e.g.
bootblock)
39 Number of blocks reserved by DOS at the end of the partition (mostly zero)
40 Interleave
41 Starting cylinder of the partition
42 Last cylinder of the partition
43 Initial number of DOS buffers
44 Type of memory to allocate for buffers
45 Max number of bytes to transfer at a time
46 Address mask to block out certain memory (usually $FFFFFE)
47 Boot priority
48 Dos type ASCII (HEX) string showing filesystem type (like in bootblock):
0x444F5300 is old filesystem
0x444F5301 is fast file system
49 Fiveteen reserved longs
File system header:
0 ID text "FSHD"
1 Size of this checksummed structure (in longs)
2 Block checksum
3 SCSI Target ID of host
4 Size of disk blocks (in bytes)
5 Flags - No flags defined (???)
6 Two reserved longs
8 Dos type ASCII (HEX) string showing filesystem type (like in bootblock):
0x444F5300 is old filesystem
0x444F5301 is fast file system
9 Two words specifying release version of this code
10 Patching flags for next nine (or in future more) entries specifies, which of
these have to be patched to the device structure. Bit 0 = patch Device node
type, bit 7 = patch Segment list ..., $180 to patch Segment list Global
vector.
The following (device node) structure was taken from the dos/filehandler.i
include file (but File system header block structure continuing!).
11 Type - always 0 for dos "devices"
12 CPTR to task. If this is null when the node is accesses, a task will be
started up
13 BPTR to lock - not used for devices - leave null
14 BSTR Handler - filename to loadseg (if seglist is null)
15 Stacksize to use when starting task
16 Task priority when starting task
17 BPTR to startup msg: FileSysStartupMsg for disks
18 Pointer to first Load file system segment (LSEG) block.
19 BPTR to global vector - BCPL global vector to use when starting a task. -1
means that the Segment list (see long 19) is not for a bcpl program, so the dos
won't try and construct one. 0 tell the dos that you obey BCPL linkage rules,
and that it should construct a global vector for you.
20 Twenty three reserved longs
43 Twenty one reserved longs
Load file system segment (these block contains filesystem):
0 ID - text "LSEG"
1 Size of this checksummed structure (in longs)
2 Block checksum
3 SCSI Target ID of host
4 Block number of the next Load file system segment block (link)
5 There is 123 longs of data
...
APPENDIX B
THE HASHING FUNCTION
Hashing is a very good way to speed up the disk access. In AmigaDos, it's
used in directories (including ROOT). One block contains 72 hashchains. If
some items have the same hash value, the long in the directory points to the
first block, the entry 'next entry with same hash value' of the first block
points to the second block...
HASH_VALUE is number of long, where the number of block is stored in, name
is the name of object and name[n] is the n-th character of the string.
HASH_VALUE=f(STRLEN[name]) MOD 72 + 6
f(0)=STRLEN(name)
f(n)=13*f(n-1)+TOUPPER(name[n])
Here is source of hashing function.
INPUT: A0 = String to hash value compute to
OUTPUT: D0 = Hash value
hash_fn move.l a0,-(a7)
moveq #-1,d1
1$ add.l #1,d1
tst.b (a0)+
bne 1$
move.l (a7)+,a0
3$ move.b (a0)+,d0
beq 2$
mulu #13,d1
bsr to_upper
and.w #$00FF,d0
add.w d0,d1
and.w #$7FF,d1
bra 3$
2$ move.l d1,d0
rts