home *** CD-ROM | disk | FTP | other *** search
- OPT REG=5
- OPT PREPROCESS
- OPT OSVERSION=37
-
- /*
- * MS-Dos partitiontable lister and Cross-Dos mounter for PC-HD's.
- *
- *
- * v1.0: (c) K.P. van Beem (patrick@aobh.xs4all.nl or 2:280/464.2)
- * v1.1 - v1.2: (c) Harry "Piru" Sintonen (sintonen@iki.fi)
- *
- * Based on information gained from the source of the Linux FDisk, by
- * A. V. Le Blanc (LeBlanc@mcc.ac.uk).
- * This program is free software. You can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * Version 1.0, 28-1-96, Initial version.
- * Version 1.1, 31-7-00, Fixed tempfile problems. Fixed QUIET-option
- * related memory loss. Blindly assumed String() always succeed,
- * crashed if it didn't. Added custom error message for
- * 'No disk in the drive' and 'Block len not supported' ioerr cases.
- * Version 1.2, 2-12-00, Added dozens of new partition identifiers.
- * Compacted the list output a bit. Now always add 'maxtransfer' to
- * mountlist to prevent problems, default $fffe00. Added 32-bit FAT
- * support with fat95. Changed BufMemType from MEMF_ANY to MEMF_PUBLIC.
- * Added 'buffers' to mountlist, default 20. Added MAXTRANSFER,
- * BUFFERS, FAT95 and INCLHIDDEN options. Fixed a deadly bug from
- * Workbench startup I introduced in v1.1, oops.
- */
-
- #define VERSION '$VER: MountDos 1.2 (2.12.00) PD, (c) Harry "Piru" Sintonen.\n'
-
- MODULE 'devices/trackdisk', 'exec/io', 'exec/ports'
- MODULE 'dos/dos', 'dos/dostags'
- MODULE 'utility/tagitem'
- MODULE 'icon', 'workbench/workbench', 'workbench/startup'
-
-
-
- /******************* Globals **********************/
-
- #define TEMPLATE 'DEVICE,UNIT/N,PREFIX,MAXTRANSFER,BUFFERS/N,FAT95/S,INCLHIDDEN/S,LIST/S,GENERATE/S,MOUNT/S,QUIET/S'
- #define ARG_DEVICE arg_ptrs[0]
- #define ARG_UNIT arg_ptrs[1]
- #define ARG_PREFIX arg_ptrs[2]
- #define ARG_MAXTRANSFER arg_ptrs[3]
- #define ARG_BUFFERS arg_ptrs[4]
- #define ARG_FAT95 arg_ptrs[5]
- #define ARG_INCLHIDDEN arg_ptrs[6]
- #define ARG_LIST arg_ptrs[7]
- #define ARG_GENERATE arg_ptrs[8]
- #define ARG_MOUNT arg_ptrs[9]
- #define ARG_QUIET arg_ptrs[10]
- #define NUMARGS 11
-
- #define EXTENDED $5
- #define EXTENDED32 $f
- #define SECTOR_SIZE 512
- #define PART_TABLE_FLAG $55AA
- -> Actually $AA55, but ix86's are little endian and we're not.
-
- -> Byte values. Highest two bits of sector are added to cylinder.
- #define SECTOR(s) (s AND $3F)
- #define CYLINDER(s,c) (c OR Shl(s AND $C0,2))
-
-
- -> This is how an MS-Dos partition entry looks like:
- OBJECT partition
- boot_ind :CHAR -> 0x80 - active
- head :CHAR -> starting head
- sector :CHAR -> starting sector
- cyl :CHAR -> starting cylinder
- sys_ind :CHAR -> What partition type
- end_head :CHAR -> end head
- end_sector :CHAR -> end sector
- end_cyl :CHAR -> end cylinder
- start_sect :LONG -> starting sector counting from 0
- nr_sects :LONG -> nr of sectors in partition
- ENDOBJECT
-
- -> Global return-code
- DEF rc = RETURN_OK -> Exceptionhandler will correct this.
-
- -> Program arguments
- DEF rargs = NIL
- DEF arg_ptrs = NIL : PTR TO LONG
- DEF device, unit -> Device and unit we work on
- DEF prefix
- DEF maxtransfer, buffers
-
- -> Device handling
- DEF tio = NIL :PTR TO ioexttd -> Trackdisk io blok.
-
- -> Count number of partitions found, for unique naming of mount-entries
- DEF dosparts, ndosparts
-
-
- /****************** Automatic exceptions **********************/
- -> What can go wrong...
- RAISE "CTLC" IF CtrlC() = TRUE,
- "DEV" IF OpenDevice() <> NIL,
- "DOS" IF ReadArgs() = NIL,
- "IO" IF DoIO() <> NIL,
- "LIB" IF OpenLibrary() = NIL,
- "RES" IF CreateIORequest() = NIL,
- "RES" IF CreateMsgPort() = NIL,
- "STAC" IF FreeStack() < 1000
-
-
-
- /****************** Main prog **********************/
-
- PROC main() HANDLE
-
- -> Device handling
- DEF msgport = NIL -> MsgPort for the trackdisk.device
- DEF topen = FALSE -> Flag if the trackdisk.device is opened.
-
- -> WB args
- DEF arg :PTR TO wbarg, dobj :PTR TO diskobject, wm :PTR TO wbstartup
- DEF olddir, item
-
- DEF tmp
-
- -> Check the parameters we got, first, initial and default values.
- NEW arg_ptrs[NUMARGS]
- device := 'scsi.device'
- prefix := ''
- maxtransfer := $fffe00
- buffers := 20
-
- IF wbmessage
- -> Started from workbench
- iconbase := OpenLibrary('icon.library', 37)
- wm := wbmessage
- arg := wm.arglist
- IF wm.numargs > 1 THEN arg++ -> We are called with a project.
- olddir := CurrentDir(arg.lock)
- dobj := GetDiskObject(arg.name)
- IF dobj
- IF FindToolType(dobj.tooltypes,'FAT95') THEN ARG_FAT95 := TRUE
- IF FindToolType(dobj.tooltypes,'INCLHIDDEN') THEN ARG_INCLHIDDEN := TRUE
- IF FindToolType(dobj.tooltypes,'LIST') THEN ARG_LIST := TRUE
- IF FindToolType(dobj.tooltypes,'GENERATE') THEN ARG_GENERATE := TRUE
- IF FindToolType(dobj.tooltypes,'MOUNT') THEN ARG_MOUNT := TRUE
- IF FindToolType(dobj.tooltypes,'QUIET') THEN ARG_QUIET := TRUE
-
- item := FindToolType(dobj.tooltypes,'DEVICE')
- IF item
- tmp := String(StrLen(item))
- IF tmp
- StrCopy(tmp, item)
- device := tmp
- ELSE
- device := 'out_of_memory'
- ENDIF
- ENDIF
-
- item := FindToolType(dobj.tooltypes,'UNIT')
- IF item THEN unit := eVal(item)
-
- item := FindToolType(dobj.tooltypes,'MAXTRANSFER')
- IF item THEN maxtransfer := eVal(item)
-
- item := FindToolType(dobj.tooltypes,'BUFFERS')
- IF item THEN buffers := eVal(item)
-
- item := FindToolType(dobj.tooltypes,'PREFIX')
- IF item
- tmp := String(StrLen(item))
- IF tmp
- StrCopy(tmp, item)
- prefix := tmp
- ENDIF
- ENDIF
-
- FreeDiskObject(dobj)
- ENDIF
- CurrentDir(olddir)
- -> be careful, code above must not throw exception
- CloseLibrary(iconbase)
- ELSE
- -> Started from CLI
- rargs := ReadArgs(TEMPLATE, arg_ptrs, NIL)
- IF ARG_DEVICE THEN device := ARG_DEVICE
- IF ARG_UNIT THEN unit := Long(ARG_UNIT)
- IF ARG_PREFIX THEN prefix := ARG_PREFIX
- IF ARG_MAXTRANSFER THEN maxtransfer := eVal(ARG_MAXTRANSFER)
- IF ARG_BUFFERS THEN buffers := Long(ARG_BUFFERS)
- ENDIF
-
- -> No options?
- IF (ARG_GENERATE=0) AND (ARG_MOUNT=0) AND (ARG_LIST=0)
- PrintF(VERSION+6)
- PrintF('Type: ''MountDos ?'' for an option summary.\n')
- Raise(0)
- ENDIF
-
- -> Validate options
- IF (buffers < 20) THEN buffers := 20
- IF (maxtransfer < $200) THEN maxtransfer := $200
-
- -> Redirect output if option quiet is specified
- IF (ARG_QUIET = TRUE)
- tmp := Open('NIL:', MODE_NEWFILE)
- IF tmp
- -> bugfix: Old conout was never closed in v1.0
- Close(conout)
- conout := stdout := tmp
- ENDIF
- ENDIF
-
- -> Trackdisk initialisation
- msgport := CreateMsgPort()
- tio := CreateIORequest(msgport, SIZEOF ioexttd)
- OpenDevice(device, unit, tio, 0)
- topen := TRUE
-
- -> Actions to perform <-
-
- IF ARG_LIST
- list_table()
- ENDIF
-
- IF ARG_GENERATE
- dosparts := ndosparts := 0
- generate(stdout)
- ENDIF
-
- IF ARG_MOUNT
- mount()
- ENDIF
-
-
- EXCEPT DO
-
- /* Inspect the error (if any) */
- IF exception
- rc := RETURN_FAIL
- SELECT exception
- CASE "DEV"
- PrintF('Unable to open device ''\s'', unit \d.\n', device, unit)
- CASE "DOS"
- PrintFault(IoErr(), NIL)
- CASE "CTLC"
- PrintF('Ctrl-C detected.\n')
- CASE "IO"
- tmp := tio.iostd.error
- SELECT tmp
- CASE $fc -> -4
- PrintF('Block len not supported (CD-ROM?)\n')
- CASE TDERR_DISKCHANGED
- PrintF('No disk in the drive\n')
- rc := RETURN_WARN
- DEFAULT
- PrintF('Device IO-error $\h.\n', tio.iostd.error)
- ENDSELECT
- CASE "LIB"
- PrintF('Unable to open a needed library.\n')
- CASE "MEM"
- PrintF('Unable to allocate memory.\n')
- CASE "RES"
- PrintF('Unable to allocate needed resources.\n')
- CASE "STAC"
- PrintF('Stack overflow.\n')
- DEFAULT
- PrintF('Unknown exception: $\h.\n', exception)
- ENDSELECT
- ENDIF
-
- /* Clean-up */
- IF topen THEN CloseDevice (tio)
- IF tio THEN DeleteIORequest(tio)
- IF msgport THEN DeleteMsgPort (msgport)
-
- IF rargs THEN FreeArgs (rargs)
-
- ENDPROC rc
-
-
- /************ Allow 0x and 0X hex notation with Val() *************/
- PROC eVal(str)
- DEF len, tstr
-
- str := TrimStr(str)
- len := StrLen(str)
- IF len > 2
- IF (str[0] = "0") AND ((str[1] = "x") OR (str[1] = "X"))
- IF (tstr := String(len))
- StringF(tstr, '$\s', str + 2)
- len := Val(tstr)
- Dispose(tstr)
- RETURN len
- ENDIF
- ENDIF
- ENDIF
- ENDPROC Val(str)
-
-
- /************ Read a partition-table block from disk *************/
- PROC readblock(buffer, block)
-
- tio.iostd.command := CMD_READ
- tio.iostd.data := buffer
- tio.iostd.length := SECTOR_SIZE
- tio.iostd.offset := Mul(block,SECTOR_SIZE)
- tio.iostd.flags := IOF_QUICK
- DoIO(tio)
-
- -> Check table ID
- IF Int(buffer + $01FE) <> PART_TABLE_FLAG
- PrintF('WARNING: Invalid table flag $\z\h[4].\n', Int(buffer + $01FE))
- rc := RETURN_WARN
- ENDIF
-
- ENDPROC
-
-
-
- /************ Auto-mount dos-partitions ************
- * Generate the mountlist-entries in a file and call the mount
- * command to mount each dos-partition in it.
- */
- PROC mount() HANDLE
- DEF cnt, tmpfh = 0, tmp, tmpname[20] :STRING
- DEF command[80] :STRING
-
- -> Generate `random' temp filename. Prevent clash if
- -> multiple mountdos instances are run simultanously.
- StringF(tmpname, 'T:MDTML\h', FindTask(NIL))
-
- tmpfh := Open(tmpname, MODE_NEWFILE)
- IF tmpfh = NIL
- PrintF('Unable to create a temporary mountlist.\n')
- rc := RETURN_ERROR
- RETURN
- ENDIF
-
- dosparts := ndosparts := 0
- generate(tmpfh, 0, TRUE)
- Close(tmpfh)
- tmpfh:=0
-
- FOR cnt := 1 TO dosparts
- CtrlC() -> User may want to cancel the mount-procedure
- PrintF('Mounting \sMD\d\d:\n', prefix, unit, cnt)
- StringF(command,'Mount \sMD\d\d: FROM \s', prefix, unit, cnt, tmpname)
- tmp := SystemTagList(command, [SYS_OUTPUT, stdout, TAG_DONE])
- IF tmp > rc THEN rc := tmp -> Copy highest return-code
- ENDFOR
-
- EXCEPT DO
-
- -> bugfix: In v1.0 if exception was raised inside generate()
- -> the temporaty mountlist filehandle was left unclosed. This
- -> prevented the DeleteFile() call from succeeding, and
- -> additionally caused further MountDos MOUNT calls to fail
- -> since Open('T:MountDosTmpMountlist',MODE_NEWFILE) failed.
- IF tmpfh
- Close(tmpfh)
- ENDIF
-
- DeleteFile(tmpname)
- ReThrow()
-
- ENDPROC
-
-
-
- /************ Generate mountlist-entries for partition chain ************/
- -> 'dosonly' indicates only dos-partitions should be generated.
-
- PROC generate(fh, block=0, dosonly=FALSE)
- DEF cnt, bpt, lowcyl, highcyl, isdos, ind
-
- -> Partition table
- DEF buffer[SECTOR_SIZE] : ARRAY OF CHAR
- DEF p:PTR TO partition -> Pointer to the partition table
-
- -> Recursive function, check Ctrl-C and stack (uses auto-exceptions).
- FreeStack()
- CtrlC()
-
- -> Read partition-table block
- readblock(buffer, block)
- p := buffer + $01BE
-
- FOR cnt := 1 TO 4
-
- -> Swap 'Intel'-values:
- p.start_sect := swapL(p.start_sect)
- p.nr_sects := swapL(p.nr_sects)
-
-
- ind := p.sys_ind
- IF ARG_INCLHIDDEN
- -> "Make" hidden partitions visible.
- ind := ind AND $EF
- ENDIF
-
-
- -> Can this partition be mounted or not ?
-
- IF ARG_FAT95
-
- -> fat95 support $1, $4, $6, $b, $c, $e
- IF (ind = $1) OR (ind = $4) OR (ind = $6) OR
- (ind = $b) OR (ind = $c) OR (ind = $e)
-
- INC dosparts
- isdos := TRUE
- ELSE
- INC ndosparts
- isdos := FALSE
- ENDIF
-
- ELSE
-
- -> crossdosfilesystem support $1, $4 and $6
- IF (ind = $1) OR (ind = $4) OR (ind = $6)
- INC dosparts
- isdos := TRUE
- ELSE
- INC ndosparts
- isdos := FALSE
- ENDIF
-
- ENDIF
-
- lowcyl := p.start_sect + block
- highcyl := lowcyl + p.nr_sects + block
- lowcyl, highcyl, bpt := smaller(lowcyl, highcyl)
-
- -> Note: Extended cannot be hidden.
- IF (p.sys_ind <> 0) AND (p.sys_ind <> EXTENDED) AND
- (p.sys_ind <> EXTENDED32) AND
- ( (dosonly AND isdos) OR Not(dosonly) )
-
- IF ARG_FAT95
-
- VfPrintf(fh,
- '\s\s\d\d:\n'+
- 'FileSystem = \s\n'+
- 'Device = \s\n'+
- 'Unit = \d\n'+
- 'Flags = 1\n'+
- 'Surfaces = 1\n'+
- 'BlocksPerTrack = \d\n'+
- 'MaxTransfer = 0x\h\n'+
- 'Reserved = 0\n'+
- 'LowCyl = \d\n'+
- 'HighCyl = \d\n'+
- 'Buffers = \d\n'+
- 'BufMemType = 1\n'+
- 'StackSize = 2048\n'+
- 'Priority = 10\n'+
- 'GlobVec = -1\n'+
- 'DosType = \s\n'+
- 'Activate = 1\n'+
- '#\n\n',
- [
- prefix,
- IF isdos THEN 'MD' ELSE 'ND', unit,
- IF isdos THEN dosparts ELSE ndosparts,
- IF isdos THEN 'L:fat95' ELSE systype(p.sys_ind), -> Show real type, even if INCLHIDEN!
- device, unit, bpt,
- maxtransfer,
- lowcyl, highcyl - 1,
- buffers,
- IF isdos THEN '0x46415401' ELSE '?'
- ]:LONG
- )
-
- ELSE
-
- VfPrintf(fh,
- '\s\s\d\d:\n'+
- 'FileSystem = \s\n'+
- 'Device = \s\n'+
- 'Unit = \d\n'+
- 'Surfaces = 1\n'+
- 'BlocksPerTrack = \d\n'+
- 'MaxTransfer = 0x\h\n'+
- 'Reserved = 0\n'+
- 'LowCyl = \d\n'+
- 'HighCyl = \d\n'+
- 'Buffers = \d\n'+
- 'BufMemType = 1\n'+
- 'StackSize = 2048\n'+
- 'Priority = 10\n'+
- 'GlobVec = -1\n'+
- 'DosType = \s\n'+
- 'Activate = 1\n'+
- '#\n\n',
- [
- prefix,
- IF isdos THEN 'MD' ELSE 'ND', unit,
- IF isdos THEN dosparts ELSE ndosparts,
- IF isdos THEN 'L:CrossDOSFileSystem' ELSE systype(p.sys_ind), -> Show real type, even if INCLHIDEN!
- device, unit, bpt,
- maxtransfer,
- lowcyl, highcyl - 1,
- buffers,
- IF isdos THEN '0x4D534400' ELSE '?'
- ]:LONG
- )
- ENDIF
-
- ENDIF
-
- -> Note: Extended cannot be hidden.
- IF ((p.sys_ind = EXTENDED) OR (p.sys_ind = EXTENDED32)) AND
- (p.start_sect <> 0)
- -> Recursive call of this funtion.
- generate(fh, p.start_sect + block, dosonly)
- ENDIF
-
- p++
- ENDFOR
-
- ENDPROC
-
-
-
- /************ Shows the contents of an partition chain. ************/
-
- PROC list_table(block=0)
- DEF cnt
-
- -> Partition table
- DEF buffer[SECTOR_SIZE] : ARRAY OF CHAR
- DEF p:PTR TO partition -> Pointer to the partition table
- DEF megs, size[8]:STRING
-
- -> Recursive function, check Ctrl-C and stack (uses auto-exceptions).
- FreeStack()
- CtrlC()
-
- -> Read partition-table block
- readblock(buffer, block)
- p := buffer + $01BE
-
- PrintF(' Start: End: Start Number of\n'+
- 'boot Head Cyl. Sect Head Cyl. Sect Sector Sectors MB System\n')
- FOR cnt := 1 TO 4
- -> Swap 'Intel'-values:
- p.start_sect := swapL(p.start_sect)
- p.nr_sects := swapL(p.nr_sects)
-
- megs := Div(p.nr_sects, ($100000/SECTOR_SIZE))
- IF (megs < 10000)
- StringF(size, '\d[4]', megs)
- ELSE
- -> at least 9GB
- StringF(size, '\d[2]GB', Shr(megs, 10))
- ENDIF
-
- PrintF('\d[1] \s \d[4]\d[5]\d[5] \d[4]\d[5]\d[5] \d[8] \d[9] \s \s\n',
- cnt, IF (p.boot_ind) THEN 'y ' ELSE 'n ',
- p.head, CYLINDER(p.sector, p.cyl), SECTOR(p.sector),
- p.end_head, CYLINDER(p.end_sector, p.end_cyl), SECTOR(p.end_sector),
- IF p.start_sect = 0 THEN 0 ELSE p.start_sect + block, p.nr_sects,
- size, systype(p.sys_ind)
- )
- p++
- ENDFOR
-
- -> Check for extended partitions.
- p := buffer + $01BE
- FOR cnt := 1 TO 4
-
- IF (p.sys_ind = EXTENDED) OR (p.sys_ind = EXTENDED32)
- IF p.start_sect = 0
- PrintF('Bad offset in extended partition number \d.\n', cnt)
- ELSE
- -> Recursive call of this funtion.
- PrintF('\nExtended partition at sector \d:\n', p.start_sect + block)
- list_table(p.start_sect + block)
- ENDIF
- ENDIF
-
- p++
- ENDFOR
-
- ENDPROC
-
-
-
- /********** System types of partitions *****************/
- PROC systype(t)
- DEF stypes: PTR TO LONG
-
- stypes := [
- $0, 'Empty',
- $1, 'DOS FAT12',
- $2, 'XENIX root',
- $3, 'XENIX /usr',
- $4, 'DOS FAT16 <32M',
- EXTENDED, 'DOS Extended Partition',
- $6, 'DOS FAT16 >=32M',
- $7, 'OS/2 HPFS / Windows NT NTFS', -> or QNX?
- $8, 'AIX boot',
- $9, 'AIX data',
- $a, 'OS/2 Boot / OPUS',
- $b, 'FAT32',
- $c, 'FAT32, LBA',
- $e, 'FAT16, LBA',
- EXTENDED32, 'Extended Partition, LBA',
- $10, 'OPUS',
- $11, 'Hidden DOS FAT12',
- $12, 'Compaq config partition',
- $14, 'Hidden DOS FAT16 <32M',
- $16, 'Hidden DOS FAT16 >=32M',
- $17, 'Hidden OS/2 HPFS',
- $18, 'AST Windows swapfile',
- $1b, 'Hidden FAT32',
- $1c, 'Hidden FAT32, LBA',
- $1e, 'Hidden FAT16, LBA',
- $24, 'NEC DOS 3.x',
- $38, 'THEOS v3 2gb',
- $39, 'THEOS v4 spanned',
- $3a, 'THEOS v4 4gb',
- $3b, 'THEOS v4 extended',
- $3c, 'PartitionMagic recovery',
- $40, 'Venix 80286',
- $41, 'Linux / Personal RISC',
- $42, 'Linux swap / Secure Filesystem',
- $43, 'Linux native',
- $4d, 'QNX4.x 2nd part',
- $4e, 'QNX4.x 2nd part',
- $4f, 'QNX4.x 3rd part',
- $50, 'OnTrack Disk Manager',
- $51, 'OnTrack Disk Manager / Novell',
- $52, 'CP/M / Microport',
- $53, 'Disk Manager 6.0 Aux3',
- $54, 'Disk Manager 6.0 DDO',
- $55, 'EZ-Drive',
- $56, 'Golden Bow VFeature',
- $5c, 'Priam EDisk',
- $61, 'SpeedStor',
- $63, 'Unix System V / Mach / GNU HURD',
- $64, 'Novell Netware',
- $65, 'Novell Netware',
- $67, 'Novell',
- $68, 'Novell',
- $69, 'Novell',
- $70, 'DiskSecure Multi-Boot',
- $75, 'IBM PC/IX',
- $80, 'Old MINIX', -> Minix 1.4a and earlier
- $81, 'Linux/MINIX', -> Minix 1.4b and later
- $82, 'Linux swap',
- $83, 'Linux native',
- $84, 'OS/2 hidden / Hibernation',
- $85, 'Linux extended',
- $86, 'NTFS volume set',
- $87, 'NTFS volume set',
- $93, 'Amoeba',
- $94, 'Amoeba BBT', -> (bad block table)
- $99, 'DCE376 logical drive',
- $a0, 'IBM Thinkpad hibernation / Phoenix NoteBIOS PM',
- $a5, 'NetBSD, FreeBSD',
- $a6, 'OpenBSD',
- $a7, 'NEXTSTEP',
- $aa, 'Olivetti FAT12 1.44Mb Service',
- $b7, 'BSDI fs',
- $b8, 'BSDI swap',
- $c0, 'CTOS',
- $c1, 'DRDOS/secured FAT16',
- $c4, 'DRDOS/secured FAT16 <32M',
- $c6, 'DRDOS/secured FAT16 >=32M / WinNT corrupted FAT16',
- $c7, 'WinNT corrupted NTFS / Syrinx boot',
- $d8, 'CP/M-86',
- $db, 'CP/M', -> or Concurrent DOS
- $e1, 'DOS access / SpeedStor FAT12 extended',
- $e3, 'DOS R/O / SpeedStor',
- $e4, 'SpeedStor FAT16 extended',
- $eb, 'BeOS',
- $f1, 'SpeedStor',
- $f2, 'DOS secondary',
- $f4, 'SpeedStor large partition',
- $fe, 'SpeedStor / LANstep / IBM PS/2 IML',
- $ff, 'BBT' -> (bad track table)
- ]
-
- WHILE (t <= $FF) AND (t > stypes[])
- stypes++
- stypes++
- ENDWHILE
-
- ENDPROC IF (t = stypes[]) THEN stypes[1] ELSE 'Unknown'
-
-
-
- /*** Some assembler routines for convenience... ***/
-
-
-
- /******** Lower the values of lowcyl and highcyl. ********
- * Some file-systems/devices can't handle high values for the cylinders
- * (probably higher than 65536). So we try to keep them low, by increasing
- * the number of cylinders.
- */
-
- PROC smaller(lowcyl, highcyl)
- DEF bpt
-
- MOVE.L lowcyl,D0
- MOVE.L highcyl,D1
-
- MOVEQ #1,D2 -> Sectors per track.
- smaller_iterate:
- BTST #0,D0
- BNE.B smaller_end
- BTST #0,D1
- BNE.B smaller_end
- ADD.W D2,D2
- LSR.L #1,D0
- LSR.L #1,D1
- CMP.W #$0800,D2 -> Don't overreact (or hang).
- BLT.B smaller_iterate
- smaller_end:
-
- MOVE.L D0,lowcyl
- MOVE.L D1,highcyl
- MOVE.L D2,bpt
-
- ENDPROC lowcyl, highcyl, bpt
-
-
- /****** Swap nibbles. Stupid Intel things... *********/
- PROC swapL(l)
- MOVE.L l,D0
- ROR.W #8,D0
- SWAP D0
- ROR.W #8,D0
- ENDPROC D0
-