[Fuse-for-macosx-commits] SF.net SVN: fuse-for-macosx: [442] vendor/libdsk/current
Brought to you by:
fredm
|
From: <fr...@us...> - 2007-08-06 00:43:58
|
Revision: 442
http://fuse-for-macosx.svn.sourceforge.net/fuse-for-macosx/?rev=442&view=rev
Author: fredm
Date: 2007-08-05 17:43:48 -0700 (Sun, 05 Aug 2007)
Log Message:
-----------
Load . into vendor/libdsk/current.
Modified Paths:
--------------
vendor/libdsk/current/ChangeLog
vendor/libdsk/current/configure
vendor/libdsk/current/configure.in
vendor/libdsk/current/doc/libdsk.lyx
vendor/libdsk/current/doc/libdsk.pdf
vendor/libdsk/current/doc/libdsk.txt
vendor/libdsk/current/dos16ppd/Makefile
vendor/libdsk/current/dos32gcc/Makefile
vendor/libdsk/current/include/libdsk.h
vendor/libdsk/current/lib/Makefile.am
vendor/libdsk/current/lib/Makefile.in
vendor/libdsk/current/lib/drivers.h
vendor/libdsk/current/lib/drivers.inc
vendor/libdsk/current/lib/dsksgeom.c
vendor/libdsk/current/man/apriboot.1
vendor/libdsk/current/man/dskdump.1
vendor/libdsk/current/man/dskform.1
vendor/libdsk/current/man/dskid.1
vendor/libdsk/current/man/dskscan.1
vendor/libdsk/current/man/dsktrans.1
vendor/libdsk/current/man/dskutil.1
vendor/libdsk/current/man/md3serial.1
vendor/libdsk/current/tools/dsktrans.c
vendor/libdsk/current/win16bc5/libdsk.ide
vendor/libdsk/current/win16vc1/LIBDSK16.MAK
vendor/libdsk/current/win32bc5/libdsk.ide
vendor/libdsk/current/win32vc6/atlibdsk.dsp
vendor/libdsk/current/win32vc6/atlibdsk.h
vendor/libdsk/current/win32vc6/atlibdsk_i.c
vendor/libdsk/current/win32vc6/atlibdsk_p.c
vendor/libdsk/current/win32vc6/libdsk.dsp
Added Paths:
-----------
vendor/libdsk/current/lib/drvlogi.c
vendor/libdsk/current/lib/drvlogi.h
vendor/libdsk/current/lib/drvtele.c
vendor/libdsk/current/lib/drvtele.h
Property Changed:
----------------
vendor/libdsk/current/win32vc6/atlibdsk.dsp
vendor/libdsk/current/win32vc6/libdsk.dsp
Modified: vendor/libdsk/current/ChangeLog
===================================================================
--- vendor/libdsk/current/ChangeLog 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/ChangeLog 2007-08-06 00:43:48 UTC (rev 442)
@@ -1,6 +1,37 @@
+2007-07-27 John Elliott
+
+ * libdsk-1.1.14 released.
+
+2007-06-11 Stuart Brady
+
+ * Added a new geometry (FMT_TRDOS640).
+
+2007-06-10 John Elliott
+
+ * Updated the DOS and Windows projects with the new drivers
+ (the Teledisk one didn't compile under Win16).
+
+2007-06-09 John Elliott
+
+ * libdsk-1.1.13 released.
+
+ * New driver: Logical. This is a raw disc image as generated by
+ 'dsktrans -logical'; that is, it is arranged in logical sector order
+ rather than SIDES_ALT order. Useful for dealing with raw disc images
+ that were dumped in logical order.
+ * dsktrans: The -logical option has accordingly been deprecated,
+ since '-otype logical' should have the same effect.
+
+2007-06-02 John Elliott
+
+ * New driver: Teledisk, based on the file format documentation at
+ <http://www.fpns.net/willy/wteledsk.htm>. This driver is read-only.
+ No code from WTELEDSK has been used, because it's GPLed rather than
+ LGPLed.
+
2006-11-18 John Elliott
- * libdsk-1.1.11 released.
+ * libdsk-1.1.12 released.
2006-08-02 John Elliott
Modified: vendor/libdsk/current/configure
===================================================================
--- vendor/libdsk/current/configure 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/configure 2007-08-06 00:43:48 UTC (rev 442)
@@ -814,8 +814,8 @@
NONENONEs,x,x, &&
program_prefix=${target_alias}-
-VERSION=1.1.12
-UPDATED='November 18, 2006'
+VERSION=1.1.14
+UPDATED='July 27, 2007'
am__api_version="1.4"
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
Modified: vendor/libdsk/current/configure.in
===================================================================
--- vendor/libdsk/current/configure.in 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/configure.in 2007-08-06 00:43:48 UTC (rev 442)
@@ -2,8 +2,8 @@
AC_INIT(lib/dskopen.c)
AC_CONFIG_AUX_DIR(config)
AC_CANONICAL_SYSTEM
-VERSION=1.1.12
-UPDATED='November 18, 2006'
+VERSION=1.1.14
+UPDATED='July 27, 2007'
AM_INIT_AUTOMAKE(libdsk, $VERSION)
AM_CONFIG_HEADER(config.h)
Modified: vendor/libdsk/current/doc/libdsk.lyx
===================================================================
--- vendor/libdsk/current/doc/libdsk.lyx 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/doc/libdsk.lyx 2007-08-06 00:43:48 UTC (rev 442)
@@ -26,7 +26,7 @@
\layout Title
-LibDsk v1.1.12
+LibDsk v1.1.14
\layout Author
John Elliott
@@ -83,9 +83,12 @@
\begin_inset Quotes erd
\end_inset
- images;
+ images;
\layout Itemize
+Raw images in logical filesystem order;
+\layout Itemize
+
CPCEMU-format .DSK images (normal and extended);
\layout Itemize
@@ -103,6 +106,10 @@
NanoWasp-format disc images, used by the eponymous emulator.
\layout Itemize
+Disc images created by the Sydex imaging programs Teledisk and CopyQM (read
+ only in both cases).
+\layout Itemize
+
The floppy drive under Linux;
\layout Itemize
@@ -136,6 +143,25 @@
For full details, see the file ChangeLog.
\layout Itemize
+Added two new drivers:
+\begin_inset Quotes eld
+\end_inset
+
+teledisk
+\begin_inset Quotes erd
+\end_inset
+
+ and
+\begin_inset Quotes eld
+\end_inset
+
+logical
+\begin_inset Quotes erd
+\end_inset
+
+.
+\layout Itemize
+
Changes by Ramlaid <www.ramlaid.com> to the DSK and NTWDM drivers to improve
compatibility, and another fix to stop file handles leaking.
\layout Itemize
@@ -322,6 +348,23 @@
\begin_inset Quotes eld
\end_inset
+logical
+\begin_inset Quotes erd
+\end_inset
+
+ : Raw disc image in logical filesystem order.
+ Previous versions of LibDsk could generate such images (for example, by
+ using the now-deprecated
+\family typewriter
+ -logical
+\family default
+ option to dsktrans) but couldn't then write them back or use them in emulators.
+\layout Description
+
+
+\begin_inset Quotes eld
+\end_inset
+
floppy
\begin_inset Quotes erd
\end_inset
@@ -406,6 +449,18 @@
\begin_inset Quotes eld
\end_inset
+teledisk
+\begin_inset Quotes erd
+\end_inset
+
+ : Disc images created by Sydex's TeleDisk.
+ This is a read-only driver.
+\layout Description
+
+
+\begin_inset Quotes eld
+\end_inset
+
nanowasp
\begin_inset Quotes erd
\end_inset
@@ -2788,7 +2843,7 @@
Used to set callbacks from LibDsk to your own code, for LibDsk to display
messages during processing that may take time.
- The code should be used to set the text on the status line of your program
+ The code could be used to set the text on the status line of your program
window, for example.
\layout LyX-Code
@@ -6372,7 +6427,7 @@
\layout Itemize
-pDriver contains the pointer to our instance data.
+pDriver points to a DSK_DRIVER containing the pointer to your instance data.
\layout Itemize
name is the filename as passed to LibDsk, starting with
Modified: vendor/libdsk/current/doc/libdsk.pdf
===================================================================
(Binary files differ)
Modified: vendor/libdsk/current/doc/libdsk.txt
===================================================================
--- vendor/libdsk/current/doc/libdsk.txt 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/doc/libdsk.txt 2007-08-06 00:43:48 UTC (rev 442)
@@ -1,4 +1,4 @@
-LibDsk v1.1.12
+LibDsk v1.1.14
John Elliott
@@ -163,8 +163,10 @@
disc images transparently. It currently supports the
following disc image formats:
- Raw "dd if=foo of=bar" images;
+ Raw "dd if=foo of=bar" images;
+ Raw images in logical filesystem order;
+
CPCEMU-format .DSK images (normal and extended);
MYZ80-format hard drive images;
@@ -178,6 +180,9 @@
NanoWasp-format disc images, used by the eponymous emulator.
+ Disc images created by the Sydex imaging programs
+ Teledisk and CopyQM (read only in both cases).
+
The floppy drive under Linux;
The floppy drive under Windows. Windows support is a
@@ -198,6 +203,8 @@
For full details, see the file ChangeLog.
+ Added two new drivers: "teledisk" and "logical".
+
Changes by Ramlaid <www.ramlaid.com> to the DSK and
NTWDM drivers to improve compatibility, and another
fix to stop file handles leaking.
@@ -283,6 +290,12 @@
. On systems other than Linux, DOS or Windows, this
is also used to access the host system's floppy drive.
+ "logical" : Raw disc image in logical filesystem order.
+ Previous versions of LibDsk could generate such
+ images (for example, by using the now-deprecated
+ -logical option to dsktrans) but couldn't then write
+ them back or use them in emulators.
+
"floppy" : Host system's floppy drive (under Linux, DOS
or Windows).
@@ -301,6 +314,9 @@
"qm" : Disc images created by Sydex's CopyQM. This is a
read-only driver.
+ "teledisk" : Disc images created by Sydex's TeleDisk.
+ This is a read-only driver.
+
"nanowasp" : Disc image in the 400k Microbee format
used by the NanoWasp emulator. This is similar to "raw"
, but the tracks are stored in a different order.
@@ -1188,7 +1204,7 @@
Used to set callbacks from LibDsk to your own code, for
LibDsk to display messages during processing that may
-take time. The code should be used to set the text on
+take time. The code could be used to set the text on
the status line of your program window, for example.
typedef void (*DSK_REPORTFUNC)(const char *message);
@@ -2707,7 +2723,8 @@
Connect to a remote server.
- pDriver contains the pointer to our instance data.
+ pDriver points to a DSK_DRIVER containing the pointer
+ to your instance data.
name is the filename as passed to LibDsk, starting
with "driver:" and containing any connection parameters
Modified: vendor/libdsk/current/dos16ppd/Makefile
===================================================================
--- vendor/libdsk/current/dos16ppd/Makefile 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/dos16ppd/Makefile 2007-08-06 00:43:48 UTC (rev 442)
@@ -9,7 +9,8 @@
OBS7=drvcpcem.obj dskcheck.obj dskpars.obj dskwrite.obj dskcmt.obj
OBS8=drvadisk.obj drvrcpm.obj drvqm.obj crctable.obj dskretry.obj
OBS9=dskreprt.obj dskdirty.obj dskrtrd.obj dsktrkid.obj remote.obj
-OBSA=rpcfossl.obj crc16.obj drvint25.obj int25l.obj
+OBSA=rpcfossl.obj crc16.obj drvint25.obj int25l.obj drvtele.obj
+OBSB=drvlogi.obj
OBS10=dskid.obj utilopts.obj libdsk.lib
OBS11=dskform.obj utilopts.obj formname.obj libdsk.lib
OBS12=dsktrans.obj utilopts.obj formname.obj bootsec.obj libdsk.lib
@@ -47,7 +48,7 @@
$(CC) $(CFLAGS) $(OBS13)
libdsk.lib: $(OBS1) $(OBS2) $(OBS3) $(OBS4) $(OBS5) $(OBS6) $(OBS7) \
- $(OBS8) $(OBS9) $(OBSA)
+ $(OBS8) $(OBS9) $(OBSA) $(OBSB)
libr r $@ $(OBS1)
libr r $@ $(OBS2)
libr r $@ $(OBS3)
@@ -58,6 +59,7 @@
libr r $@ $(OBS8)
libr r $@ $(OBS9)
libr r $@ $(OBSA)
+ libr r $@ $(OBSB)
%.obj: %.as
$(CC) -c $(CFLAGS) $<
Modified: vendor/libdsk/current/dos32gcc/Makefile
===================================================================
--- vendor/libdsk/current/dos32gcc/Makefile 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/dos32gcc/Makefile 2007-08-06 00:43:48 UTC (rev 442)
@@ -10,7 +10,8 @@
drvcpcem.o dskcheck.o dskpars.o dskwrite.o dskretry.o \
drvadisk.o drvrcpm.o drvqm.o dskretry.o dskcmt.o \
dskreprt.o crctable.o dskdirty.o dskrtrd.o dsktrkid.o \
- remote.o rpcfossl.o crc16.o drvint25.o
+ remote.o rpcfossl.o crc16.o drvint25.o drvtele.o \
+ drvlogi.o
OBS1 = dskid.o utilopts.o libdsk.a
OBS2 = dskform.o utilopts.o formname.o libdsk.a
Modified: vendor/libdsk/current/include/libdsk.h
===================================================================
--- vendor/libdsk/current/include/libdsk.h 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/include/libdsk.h 2007-08-06 00:43:48 UTC (rev 442)
@@ -1,7 +1,7 @@
/***************************************************************************
* *
* LIBDSK: General floppy and diskimage access library *
- * Copyright (C) 2001-6 John Elliott <jc...@se...> *
+ * Copyright (C) 2001-7 John Elliott <jc...@se...> *
* *
* Modifications to add dsk_dirty() *
* (c) 2005 Philip Kendall <pak...@sr...> *
@@ -58,7 +58,7 @@
extern "C" {
#endif
-#define LIBDSK_VERSION "1.1.12"
+#define LIBDSK_VERSION "1.1.14"
/************************* TYPES ********************************/
@@ -148,6 +148,7 @@
FMT_BBC200, /* 10 sectors, 80 tracks, 1 side, FM */
FMT_MBEE400, /* 10 sectors, 80 tracks, 1 side */
FMT_MGT800, /* 10 sectors, 80 tracks, 2 sides out and out */
+ FMT_TRDOS640, /* 16 sectors, 256 bytes/sector, 2 sides */
FMT_UNKNOWN = -1
} dsk_format_t;
Modified: vendor/libdsk/current/lib/Makefile.am
===================================================================
--- vendor/libdsk/current/lib/Makefile.am 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/lib/Makefile.am 2007-08-06 00:43:48 UTC (rev 442)
@@ -29,7 +29,7 @@
# If interfaces have been removed set the right-hand number to 0.
#
#
-libdsk_la_LDFLAGS = -version-info 5:1:2
+libdsk_la_LDFLAGS = -version-info 5:3:2
libdsk_la_SOURCES = dskread.c dskwrite.c dskcheck.c dskstat.c \
dsklphys.c dskfmt.c dskopen.c dskpars.c \
dskerror.c dskseek.c dsksecid.c dskgeom.c \
@@ -57,10 +57,12 @@
drvdos16.h drvdos16.c \
drvdos32.h drvdos32.c \
drvcpcem.h drvcpcem.c \
+ drvlogi.h drvlogi.c \
drvposix.h drvposix.c \
drvnwasp.h drvnwasp.c \
drvadisk.h drvadisk.c \
drvrcpm.h drvrcpm.c \
+ drvtele.h drvtele.c \
drvmyz80.h drvmyz80.c \
drvcfi.h drvcfi.c \
drvqm.h drvqm.c
Modified: vendor/libdsk/current/lib/Makefile.in
===================================================================
--- vendor/libdsk/current/lib/Makefile.in 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/lib/Makefile.in 2007-08-06 00:43:48 UTC (rev 442)
@@ -114,8 +114,8 @@
# If interfaces have been removed set the right-hand number to 0.
#
#
-libdsk_la_LDFLAGS = -version-info 5:1:2
-libdsk_la_SOURCES = dskread.c dskwrite.c dskcheck.c dskstat.c dsklphys.c dskfmt.c dskopen.c dskpars.c dskerror.c dskseek.c dsksecid.c dskgeom.c dsktread.c dsksgeom.c dskjni.c dskreprt.c dskcmt.c dskretry.c dskdirty.c dsktrkid.c dskrtrd.c comp.h compi.h compress.h compress.inc compress.c compsq.c compsq.h compgz.c compgz.h compbz2.c compbz2.h crctable.c crctable.h crc16.c crc16.h rpccli.c rpcfuncs.h rpcmap.c rpcpack.c rpcserv.c remote.c remote.h remote.inc remall.h rpctios.c rpctios.h rpcfork.c rpcfork.h rpcfossl.c rpcfossl.h rpcwin32.c rpcwin32.h drv.h drvi.h drivers.h drivers.inc drvlinux.h drvlinux.c drvntwdm.h drvntwdm.c drvwin32.h drvwin32.c w95defs.h drvwin16.h drvwin16.c w16defs.h drvint25.h drvint25.c drvdos16.h drvdos16.c drvdos32.h drvdos32.c drvcpcem.h drvcpcem.c drvposix.h drvposix.c drvnwasp.h drvnwasp.c drvadisk.h drvadisk.c drvrcpm.h drvrcpm.c drvmyz80.h drvmyz80.c drvcfi.h drvcfi.c drvqm.h drvqm.c
+libdsk_la_LDFLAGS = -version-info 5:3:2
+libdsk_la_SOURCES = dskread.c dskwrite.c dskcheck.c dskstat.c dsklphys.c dskfmt.c dskopen.c dskpars.c dskerror.c dskseek.c dsksecid.c dskgeom.c dsktread.c dsksgeom.c dskjni.c dskreprt.c dskcmt.c dskretry.c dskdirty.c dsktrkid.c dskrtrd.c comp.h compi.h compress.h compress.inc compress.c compsq.c compsq.h compgz.c compgz.h compbz2.c compbz2.h crctable.c crctable.h crc16.c crc16.h rpccli.c rpcfuncs.h rpcmap.c rpcpack.c rpcserv.c remote.c remote.h remote.inc remall.h rpctios.c rpctios.h rpcfork.c rpcfork.h rpcfossl.c rpcfossl.h rpcwin32.c rpcwin32.h drv.h drvi.h drivers.h drivers.inc drvlinux.h drvlinux.c drvntwdm.h drvntwdm.c drvwin32.h drvwin32.c w95defs.h drvwin16.h drvwin16.c w16defs.h drvint25.h drvint25.c drvdos16.h drvdos16.c drvdos32.h drvdos32.c drvcpcem.h drvcpcem.c drvlogi.h drvlogi.c drvposix.h drvposix.c drvnwasp.h drvnwasp.c drvadisk.h drvadisk.c drvrcpm.h drvrcpm.c drvtele.h drvtele.c drvmyz80.h drvmyz80.c drvcfi.h drvcfi.c drvqm.h drvqm.c
JARCLASSES = $(CLASSDPRE)/Drive.class $(CLASSDPRE)/DskException.class $(CLASSDPRE)/FormatData.class $(CLASSDPRE)/FormatType.class $(CLASSDPRE)/Geometry.class $(CLASSDPRE)/Reporter.class $(CLASSDPRE)/LibDsk.class
@@ -141,8 +141,8 @@
compsq.lo compgz.lo compbz2.lo crctable.lo crc16.lo rpccli.lo rpcmap.lo \
rpcpack.lo rpcserv.lo remote.lo rpctios.lo rpcfork.lo rpcfossl.lo \
rpcwin32.lo drvlinux.lo drvntwdm.lo drvwin32.lo drvwin16.lo drvint25.lo \
-drvdos16.lo drvdos32.lo drvcpcem.lo drvposix.lo drvnwasp.lo drvadisk.lo \
-drvrcpm.lo drvmyz80.lo drvcfi.lo drvqm.lo
+drvdos16.lo drvdos32.lo drvcpcem.lo drvlogi.lo drvposix.lo drvnwasp.lo \
+drvadisk.lo drvrcpm.lo drvtele.lo drvmyz80.lo drvcfi.lo drvqm.lo
noinst_PROGRAMS = @LIBDSKJAR@
PROGRAMS = $(noinst_PROGRAMS)
@@ -325,6 +325,8 @@
../include/libdsk.h drv.h drvint25.h
drvlinux.lo drvlinux.o : drvlinux.c drvi.h ../config.h \
../include/libdsk.h drv.h drvlinux.h
+drvlogi.lo drvlogi.o : drvlogi.c ../include/libdsk.h drvi.h ../config.h \
+ drv.h drvlogi.h
drvmyz80.lo drvmyz80.o : drvmyz80.c ../include/libdsk.h drvi.h \
../config.h drv.h drvmyz80.h
drvntwdm.lo drvntwdm.o : drvntwdm.c drvi.h ../config.h \
@@ -337,6 +339,8 @@
drvqm.h crctable.h
drvrcpm.lo drvrcpm.o : drvrcpm.c ../include/libdsk.h drvi.h ../config.h \
drv.h drvrcpm.h
+drvtele.lo drvtele.o : drvtele.c drvi.h ../config.h ../include/libdsk.h \
+ drv.h drvtele.h
drvwin16.lo drvwin16.o : drvwin16.c drvi.h ../config.h \
../include/libdsk.h drv.h drvwin16.h
drvwin32.lo drvwin32.o : drvwin32.c drvi.h ../config.h \
Modified: vendor/libdsk/current/lib/drivers.h
===================================================================
--- vendor/libdsk/current/lib/drivers.h 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/lib/drivers.h 2007-08-06 00:43:48 UTC (rev 442)
@@ -32,6 +32,8 @@
extern DRV_CLASS dc_cfi; /* CFI driver */
extern DRV_CLASS dc_adisk; /* APRIDISK driver */
extern DRV_CLASS dc_qm; /* CopyQM driver */
+extern DRV_CLASS dc_tele; /* Teledisk driver */
+extern DRV_CLASS dc_logical; /* Raw, in logical sector order */
extern DRV_CLASS dc_rcpmfs; /* Reverse-CP/MFS driver */
extern DRV_CLASS dc_remote; /* All remote drivers */
#ifdef LINUXFLOPPY
Modified: vendor/libdsk/current/lib/drivers.inc
===================================================================
--- vendor/libdsk/current/lib/drivers.inc 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/lib/drivers.inc 2007-08-06 00:43:48 UTC (rev 442)
@@ -61,6 +61,7 @@
* library. */
&dc_adisk, /* APRIDISK image */
&dc_qm, /* CopyQM */
+ &dc_tele, /* Teledisk */
/* 4. Raw files with no magic number. */
&dc_posix,
@@ -69,6 +70,7 @@
* explicitly specified. */
&dc_myz80,
&dc_nwasp,
+ &dc_logical,
&dc_cfi, /* RLE-compressed raw. The reasons that this isn't
* handled by the general compression system are:
* 1. No magic number, so can't autodetect.
Added: vendor/libdsk/current/lib/drvlogi.c
===================================================================
--- vendor/libdsk/current/lib/drvlogi.c (rev 0)
+++ vendor/libdsk/current/lib/drvlogi.c 2007-08-06 00:43:48 UTC (rev 442)
@@ -0,0 +1,262 @@
+/***************************************************************************
+ * *
+ * LIBDSK: General floppy and diskimage access library *
+ * Copyright (C) 2001,2007 John Elliott <jc...@se...> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free *
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
+ * MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+/* This driver implements access to a flat file, like drvposix, but with the
+ * sides laid out in the order specified by the disk geometry. What you end
+ * up with is a logical filesystem image, hence the name. */
+
+#include <stdio.h>
+#include "libdsk.h"
+#include "drvi.h"
+#include "drvlogi.h"
+
+
+/* This struct contains function pointers to the driver's functions, and the
+ * size of its DSK_DRIVER subclass */
+
+DRV_CLASS dc_logical =
+{
+ sizeof(LOGICAL_DSK_DRIVER),
+ "logical",
+ "Raw file logical sector order",
+ logical_open, /* open */
+ logical_creat, /* create new */
+ logical_close, /* close */
+ logical_read, /* read sector, working from physical address */
+ logical_write, /* write sector, working from physical address */
+ logical_format, /* format track, physical */
+ NULL, /* get geometry */
+ NULL, /* sector ID */
+ logical_xseek, /* seek to track */
+ logical_status, /* drive status */
+};
+
+dsk_err_t logical_open(DSK_DRIVER *self, const char *filename)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+
+ /* Sanity check: Is this meant for our driver? */
+ if (self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ lpxself->lpx_fp = fopen(filename, "r+b");
+ if (!lpxself->lpx_fp)
+ {
+ lpxself->lpx_readonly = 1;
+ lpxself->lpx_fp = fopen(filename, "rb");
+ }
+ if (!lpxself->lpx_fp) return DSK_ERR_NOTME;
+/* v0.9.5: Record exact size, so we can tell if we're writing off the end
+ * of the file. Under Windows, writing off the end of the file fills the
+ * gaps with random data, which can cause mess to appear in the directory;
+ * and under UNIX, the entire directory is filled with zeroes. */
+ if (fseek(lpxself->lpx_fp, 0, SEEK_END)) return DSK_ERR_SYSERR;
+ lpxself->lpx_filesize = ftell(lpxself->lpx_fp);
+
+ return DSK_ERR_OK;
+}
+
+
+dsk_err_t logical_creat(DSK_DRIVER *self, const char *filename)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+
+ /* Sanity check: Is this meant for our driver? */
+ if (self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ lpxself->lpx_fp = fopen(filename, "w+b");
+ lpxself->lpx_readonly = 0;
+ if (!lpxself->lpx_fp) return DSK_ERR_SYSERR;
+ lpxself->lpx_filesize = 0;
+ return DSK_ERR_OK;
+}
+
+
+dsk_err_t logical_close(DSK_DRIVER *self)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+
+ if (self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ if (lpxself->lpx_fp)
+ {
+ if (fclose(lpxself->lpx_fp) == EOF) return DSK_ERR_SYSERR;
+ lpxself->lpx_fp = NULL;
+ }
+ return DSK_ERR_OK;
+}
+
+
+dsk_err_t logical_read(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+ dsk_lsect_t offset;
+ dsk_err_t err;
+
+ if (!buf || !self || !geom || self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ if (!lpxself->lpx_fp) return DSK_ERR_NOTRDY;
+
+ err = dg_ps2ls(geom, cylinder, head, sector, &offset);
+ if (err) return err;
+ offset *= geom->dg_secsize;
+
+ if (fseek(lpxself->lpx_fp, offset, SEEK_SET)) return DSK_ERR_SYSERR;
+
+ if (fread(buf, 1, geom->dg_secsize, lpxself->lpx_fp) < geom->dg_secsize)
+ {
+ return DSK_ERR_NOADDR;
+ }
+ return DSK_ERR_OK;
+}
+
+
+static dsk_err_t seekto(LOGICAL_DSK_DRIVER *self, unsigned long offset)
+{
+ /* 0.9.5: Fill any "holes" in the file with 0xE5. Otherwise, UNIX would
+ * fill them with zeroes and Windows would fill them with whatever
+ * happened to be lying around */
+ if (self->lpx_filesize < offset)
+ {
+ if (fseek(self->lpx_fp, self->lpx_filesize, SEEK_SET)) return DSK_ERR_SYSERR;
+ while (self->lpx_filesize < offset)
+ {
+ if (fputc(0xE5, self->lpx_fp) == EOF) return DSK_ERR_SYSERR;
+ ++self->lpx_filesize;
+ }
+ }
+ if (fseek(self->lpx_fp, offset, SEEK_SET)) return DSK_ERR_SYSERR;
+ return DSK_ERR_OK;
+}
+
+dsk_err_t logical_write(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ const void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+ dsk_lsect_t offset;
+ dsk_err_t err;
+
+ if (!buf || !self || !geom || self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ if (!lpxself->lpx_fp) return DSK_ERR_NOTRDY;
+ if (lpxself->lpx_readonly) return DSK_ERR_RDONLY;
+
+ err = dg_ps2ls(geom, cylinder, head, sector, &offset);
+ if (err) return err;
+ offset *= geom->dg_secsize;
+
+ err = seekto(lpxself, offset);
+ if (err) return err;
+
+ if (fwrite(buf, 1, geom->dg_secsize, lpxself->lpx_fp) < geom->dg_secsize)
+ {
+ return DSK_ERR_NOADDR;
+ }
+ if (lpxself->lpx_filesize < offset + geom->dg_secsize)
+ lpxself->lpx_filesize = offset + geom->dg_secsize;
+ return DSK_ERR_OK;
+}
+
+
+dsk_err_t logical_format(DSK_DRIVER *self, DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ const DSK_FORMAT *format, unsigned char filler)
+{
+/*
+ * Note that we completely ignore the "format" parameter, since raw LOGICAL
+ * images don't hold track headers.
+ */
+ LOGICAL_DSK_DRIVER *lpxself;
+ dsk_lsect_t offset;
+ unsigned long trklen;
+ dsk_err_t err;
+
+ (void)format;
+ if (!self || !geom || self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ if (!lpxself->lpx_fp) return DSK_ERR_NOTRDY;
+ if (lpxself->lpx_readonly) return DSK_ERR_RDONLY;
+
+ trklen = geom->dg_sectors * geom->dg_secsize;
+
+ err = dg_ps2ls(geom, cylinder, head, geom->dg_secbase, &offset);
+ if (err) return err;
+ offset *= geom->dg_secsize;
+
+ err = seekto(lpxself, offset);
+ if (err) return err;
+ if (lpxself->lpx_filesize < offset + trklen)
+ lpxself->lpx_filesize = offset + trklen;
+
+ while (trklen--)
+ if (fputc(filler, lpxself->lpx_fp) == EOF) return DSK_ERR_SYSERR;
+
+ return DSK_ERR_OK;
+}
+
+
+
+dsk_err_t logical_xseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+ dsk_err_t err;
+ long offset;
+
+ if (!self || !geom || self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ if (!lpxself->lpx_fp) return DSK_ERR_NOTRDY;
+
+ if (cylinder >= geom->dg_cylinders || head >= geom->dg_heads)
+ return DSK_ERR_SEEKFAIL;
+
+ err = dg_ps2ls(geom, cylinder, head, geom->dg_secbase, &offset);
+ if (err) return err;
+ offset *= geom->dg_secsize;
+
+ if (fseek(lpxself->lpx_fp, offset, SEEK_SET)) return DSK_ERR_SEEKFAIL;
+
+ return DSK_ERR_OK;
+}
+
+dsk_err_t logical_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_phead_t head, unsigned char *result)
+{
+ LOGICAL_DSK_DRIVER *lpxself;
+
+ if (!self || !geom || self->dr_class != &dc_logical) return DSK_ERR_BADPTR;
+ lpxself = (LOGICAL_DSK_DRIVER *)self;
+
+ if (!lpxself->lpx_fp) *result &= ~DSK_ST3_READY;
+ if (lpxself->lpx_readonly) *result |= DSK_ST3_RO;
+ return DSK_ERR_OK;
+}
+
Added: vendor/libdsk/current/lib/drvlogi.h
===================================================================
--- vendor/libdsk/current/lib/drvlogi.h (rev 0)
+++ vendor/libdsk/current/lib/drvlogi.h 2007-08-06 00:43:48 UTC (rev 442)
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * *
+ * LIBDSK: General floppy and diskimage access library *
+ * Copyright (C) 2001, 2007 John Elliott <jc...@se...> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free *
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
+ * MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+/* Declarations for the logically-sectored POSIX driver */
+
+typedef struct
+{
+ DSK_DRIVER lpx_super;
+ FILE *lpx_fp;
+ int lpx_readonly;
+ unsigned long lpx_filesize;
+} LOGICAL_DSK_DRIVER;
+
+dsk_err_t logical_open(DSK_DRIVER *self, const char *filename);
+dsk_err_t logical_creat(DSK_DRIVER *self, const char *filename);
+dsk_err_t logical_close(DSK_DRIVER *self);
+dsk_err_t logical_read(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector);
+dsk_err_t logical_write(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ const void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector);
+dsk_err_t logical_format(DSK_DRIVER *self, DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ const DSK_FORMAT *format, unsigned char filler);
+dsk_err_t logical_xseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head);
+dsk_err_t logical_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_phead_t head, unsigned char *result);
+
Added: vendor/libdsk/current/lib/drvtele.c
===================================================================
--- vendor/libdsk/current/lib/drvtele.c (rev 0)
+++ vendor/libdsk/current/lib/drvtele.c 2007-08-06 00:43:48 UTC (rev 442)
@@ -0,0 +1,655 @@
+/***************************************************************************
+ * *
+ * LIBDSK: General floppy and diskimage access library *
+ * Copyright (C) 2001-2,2007 John Elliott <jc...@se...> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free *
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
+ * MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+/* This driver provides limited read-only support for Teledisk files. It is
+ * based entirely on the file format documentation at
+ * <http://www.fpns.net/willy/wteledsk.htm>. No code from wteledsk has been
+ * used, since it is under GPL and LibDsk is under LGPL.
+ *
+ * Current bugs / limitations:
+ * - No write support. The Teledisk format isn't really adapted to
+ * in-place rewrites of the sort that LibDsk likes to do, but in
+ * theory it would be possible to support writing to sectors that are
+ * stored uncompressed (type 0). This would require updating sector CRCs.
+ *
+ * - No support for images split into multiple files (.TD0, .TD1, .TD2...)
+ *
+ * - No support for advanced compression. There are two ways to get round
+ * this. One is to hack compression into this driver, and the other is to
+ * write a new compression method that checks for the 'td' signature and
+ * does an LZSS decompress when the image is opened and an LZSS compress
+ * when it's closed. I prefer the second. Note that the source referred
+ * to by wteledsk.htm (lz_comp2.zip) cannot be used by LibDsk as its
+ * licence disallows commercial use.
+ *
+ * There's also an "old advanced" compression, which uses 12-bit LZ
+ * compression in 6k blocks, so another 'comp' driver would be needed for
+ * that.
+ *
+ *
+ */
+
+
+#include "drvi.h"
+#include "drvtele.h"
+
+DRV_CLASS dc_tele =
+{
+ sizeof(TELE_DSK_DRIVER),
+ "tele",
+ "TeleDisk file driver",
+ tele_open,
+ NULL, /* tele_creat */
+ tele_close,
+ tele_read,
+ NULL, /* tele_write */
+ NULL, /* tele_format */
+ tele_getgeom,
+ tele_secid,
+ tele_xseek,
+ tele_status,
+ tele_xread,
+ NULL, /* tele_xwrite */
+ NULL, /* tele_tread */
+ NULL, /* tele_xtread */
+ tele_option_enum,
+ tele_option_set,
+ tele_option_get,
+ NULL, /* tele_trackids */
+ NULL /* tele_rtread */
+};
+
+/* #define MONITOR(x) printf x */
+
+#define MONITOR(x)
+
+
+#define DC_CHECK(s) \
+ TELE_DSK_DRIVER *self; \
+ if (s->dr_class != &dc_tele) return DSK_ERR_BADPTR; \
+ self = (TELE_DSK_DRIVER *)s;
+
+/* Check that the data rate and recording mode match those used when the
+ * disk was imaged. */
+static dsk_err_t check_rate(TELE_DSK_DRIVER *self, const DSK_GEOMETRY *geom)
+{
+ int fm;
+
+ switch(self->tele_head.datarate & 0x7F)
+ {
+/* Allow SD / DD interchangeably with 250/300. */
+ case 0:
+ case 1: if (geom->dg_datarate != RATE_SD &&
+ geom->dg_datarate != RATE_DD) return DSK_ERR_NOADDR;
+ break;
+ case 2: if (geom->dg_datarate != RATE_HD) return DSK_ERR_NOADDR;
+ break;
+ }
+ fm = (geom->dg_fm) ? 0x80 : 0;
+ if (fm != (self->tele_head.datarate & 0x80))
+ {
+ return DSK_ERR_NOADDR;
+ }
+ return DSK_ERR_OK;
+}
+
+static dsk_err_t tele_fread(TELE_DSK_DRIVER *self, tele_byte *buf, int count)
+{
+ if (!buf)
+ {
+ if (fseek(self->tele_fp, count, SEEK_CUR))
+ return DSK_ERR_SYSERR;
+ }
+ else
+ {
+ if (fread(buf, 1, count, self->tele_fp) < (size_t)count)
+ return DSK_ERR_SYSERR;
+ }
+ return DSK_ERR_OK;
+}
+
+static dsk_err_t tele_readsechead(TELE_DSK_DRIVER *self)
+{
+ dsk_err_t err;
+ tele_byte buf[6];
+
+ memset(&self->tele_sechead, 0, sizeof(self->tele_sechead));
+ err = tele_fread(self, buf, 6);
+ if (err) return err;
+ self->tele_sechead.cylinder_id = buf[0];
+ self->tele_sechead.head_id = buf[1];
+ self->tele_sechead.sector_id = buf[2];
+ self->tele_sechead.sector_len = (128 << buf[3]);
+ self->tele_sechead.syndrome = buf[4];
+ self->tele_sechead.header_crc = buf[5];
+
+ /* Syndromes 0x10 and 0x20 omit sector data */
+ if ((self->tele_sechead.syndrome & 0x30) == 0)
+ {
+ err = tele_fread(self, buf, 3);
+ if (err) return err;
+ self->tele_sechead.compressed_len = (((tele_word)buf[1]) << 8) |
+ buf[0];
+ self->tele_sechead.encoding = buf[2];
+ }
+ return DSK_ERR_OK;
+}
+
+/* Read the sector described by tele_sechead */
+static dsk_err_t tele_readsec(TELE_DSK_DRIVER *self, unsigned char *buf)
+{
+ int n, w, wleft, plen, ptype;
+ dsk_err_t err;
+ size_t len = self->tele_sechead.sector_len;
+ tele_byte pattern[257];
+
+ if (self->tele_sechead.syndrome & 0x30) /* Nothing there */
+ {
+ if (buf) memset(buf, 0xF6, len);
+ return DSK_ERR_OK;
+ }
+ switch(self->tele_sechead.encoding)
+ {
+ case 0: /* Uncompressed */
+ MONITOR(("tele_readsec @ 0x%08lx: Type 0 len %d\n",
+ ftell(self->tele_fp), len));
+ return tele_fread(self, buf, len);
+ case 1: /* One pattern */
+ MONITOR(("tele_readsec @ 0x%08lx: Type 1 len 4\n",
+ ftell(self->tele_fp)));
+ err = tele_fread(self, pattern, 4);
+ if (err) return err;
+
+ if (buf) for (n = 0; n < (int)len; n+= 2)
+ {
+ buf[n] = pattern[2];
+ buf[n+1] = pattern[3];
+ }
+ return DSK_ERR_OK;
+ case 2: /* More than one pattern */
+ w = 0;
+ MONITOR(("tele_readsec @ 0x%08lx: Type 2 \n",
+ ftell(self->tele_fp)));
+ while ((size_t)w < len)
+ {
+ wleft = len - w;
+ err = tele_fread(self, pattern, 2);
+ if (err) return err;
+ ptype = pattern[0];
+ plen = pattern[1];
+ MONITOR(("tele_readsec @ 0x%08lx: Type 2 ptype=%d plen=%d\n",
+ ftell(self->tele_fp), ptype, plen));
+ if (ptype == 0)
+ {
+ err = tele_fread(self, pattern, plen);
+ if (err) return err;
+ if (plen > wleft) plen = wleft;
+ if (buf) memcpy(buf + w, pattern, plen);
+ w += plen;
+ continue;
+ }
+ err = tele_fread(self, pattern, (1 << ptype));
+ for (n = 0; n < plen; n++)
+ {
+ if (buf)
+ {
+/* Ensure the amount of data written does not exceed len */
+ if ((1 << ptype) > wleft)
+ memcpy(buf + w,
+ pattern,wleft);
+ else memcpy(buf + w,
+ pattern, 1 << ptype);
+ }
+ w += (1 << ptype);
+ wleft -= (1 << ptype);
+ }
+ }
+ return DSK_ERR_OK;
+ default:
+#ifndef WIN16
+ fprintf(stderr, "Teledisk: Unsupported sector compression method %d!\n", self->tele_sechead.encoding);
+#endif
+ break;
+ }
+ return DSK_ERR_NOTIMPL;
+}
+
+/* We cache previously-encountered track addresses in self->tele_track_addr
+ * to avoid doing a linear search every time a track is needed. */
+static dsk_err_t tele_seektrack(TELE_DSK_DRIVER *self, dsk_pcyl_t cylinder,
+ dsk_phead_t head)
+{
+ long startpos;
+ int c, h, s;
+ dsk_err_t err;
+
+ h = head;
+ c = cylinder;
+ startpos = 0;
+ MONITOR(("tele_seektrack: cylinder=%d head=%d\n", cylinder, head));
+
+ do
+ {
+ MONITOR(("tele_seektrack: Trying c%d h%d\n", c, h));
+ if (c < 100 && h < 2 && self->tele_track_addr[c][h] != 0)
+ {
+ MONITOR(("tele_seektrack: starting at c%d h%d\n", c, h));
+ startpos = self->tele_track_addr[c][h];
+ }
+ if (h == 0)
+ {
+ h = 1;
+ --c;
+ }
+ else
+ {
+ --h;
+ }
+ }
+ while (startpos == 0 && c >= 0);
+
+ if (startpos == 0)
+ {
+#ifndef WIN16
+ fprintf(stderr, "drv_tele internal error: Cannot find cylinder 0 head 0\n");
+#endif
+ return DSK_ERR_CTRLR;
+ }
+
+ if (fseek(self->tele_fp, startpos, SEEK_SET))
+ return DSK_ERR_SYSERR;
+
+ do
+ {
+ tele_byte buf[4];
+ startpos = ftell(self->tele_fp);
+ err = tele_fread(self, buf, 4);
+ if (err)
+ {
+ return DSK_ERR_NOADDR;
+ }
+ self->tele_trackhead.sectors = buf[0];
+ self->tele_trackhead.cylinder = buf[1];
+ self->tele_trackhead.head = buf[2];
+ self->tele_trackhead.crc = buf[3];
+ c = self->tele_trackhead.cylinder;
+ h = self->tele_trackhead.head;
+ MONITOR(("tele_seektrack: c%d h%d at 0x%08lx\n", c, h, startpos));
+ if (c < 100 && h < 2 && self->tele_track_addr[c][h] == 0)
+ {
+ self->tele_track_addr[c][h] = startpos;
+ }
+ if ((dsk_pcyl_t)c == cylinder && (dsk_phead_t)h == head)
+ {
+ return DSK_ERR_OK;
+ }
+ for (s = 0; s < self->tele_trackhead.sectors; s++)
+ {
+ err = tele_readsechead(self);
+ if (err) return err;
+ err = tele_readsec(self, NULL);
+ if (err) return err;
+ }
+
+ }
+ while(1);
+/* Should never happen, but need to shut Pacific C up */
+ return DSK_ERR_UNKNOWN;
+}
+
+dsk_err_t tele_seeksec(TELE_DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head, dsk_pcyl_t cyl_expected,
+ dsk_phead_t head_expected, dsk_psect_t sector,
+ size_t *request_len, size_t *sseclen)
+{
+ dsk_err_t err;
+ int s;
+ long pos;
+
+ err = tele_seektrack(self, cylinder, head);
+
+ for (s = 0; s < self->tele_trackhead.sectors; s++)
+ {
+ pos = ftell(self->tele_fp);
+ err = tele_readsechead(self);
+ if (err) return err;
+ MONITOR(("tele_seeksec: c%d h%d s%d at 0x%08lx (%d/%d)\n",
+ self->tele_sechead.cylinder_id,
+ self->tele_sechead.head_id,
+ self->tele_sechead.sector_id, pos,
+ s, self->tele_trackhead.sectors));
+ if (self->tele_sechead.sector_id == sector &&
+ self->tele_sechead.cylinder_id == cylinder &&
+ self->tele_sechead.head_id == head)
+ {
+ *sseclen = self->tele_sechead.sector_len;
+/* Sector shorter than expected. Report a data error, and set
+ * request_len to the actual size. */
+ if (*sseclen < *request_len)
+ {
+ *request_len = *sseclen;
+ err = DSK_ERR_DATAERR;
+ }
+/* Sector longer than expected. Report a data error but don't change
+ * request_len */
+ else if ((*sseclen) > (*request_len))
+ {
+ err = DSK_ERR_DATAERR;
+ }
+ return err;
+ }
+ /* Skip over that sector and on to the next */
+ err = tele_readsec(self, NULL);
+ }
+ return DSK_ERR_NOADDR;
+}
+
+
+dsk_err_t tele_open(DSK_DRIVER *s, const char *filename)
+{
+ unsigned char header[12];
+ DC_CHECK(s);
+
+ self->tele_fp = fopen(filename, "rb");
+ if (!self->tele_fp) return DSK_ERR_NOTME;
+ /* This does use fread not tele_fread, because it's not compressed
+ * by the Advanced compression */
+ if (fread(header, 1, sizeof(header), self->tele_fp) < (int)sizeof(header) ||
+ (memcmp(header, "TD", 2) && memcmp(header, "td", 2)))
+ {
+ fclose(self->tele_fp);
+ return DSK_ERR_NOTME;
+ }
+ memcpy(self->tele_head.magic, header, 2);
+ self->tele_head.magic[2] = 0;
+ self->tele_head.volume_seq = header[2];
+ self->tele_head.volume_id = header[3];
+ self->tele_head.ver = header[4];
+ self->tele_head.datarate = header[5];
+ self->tele_head.drivetype = header[6];
+ self->tele_head.doubletrack = header[7];
+ self->tele_head.dosmode = header[8];
+ self->tele_head.sides = header[9];
+ self->tele_head.crc = ((tele_word)header[11]) << 8 | header[10];
+ /* XXX Advanced compression not supported */
+ if (!strcmp((char *)header, "td"))
+ {
+#ifndef WIN16
+ fprintf(stderr, "LibDsk TD0 driver: Advanced compression not supported\n");
+#endif
+ fclose(self->tele_fp);
+ return DSK_ERR_NOTIMPL;
+ }
+ /* Read a comment if there is one */
+ if (self->tele_head.doubletrack & 0x80)
+ {
+ int comment_len, n;
+ if (tele_fread(self, header, 10))
+ {
+ fclose(self->tele_fp);
+ return DSK_ERR_SYSERR;
+ }
+ comment_len = ((int)(header[3])) << 8 | header[2];
+ self->tele_comment = dsk_malloc(comment_len + sizeof(TELE_COMMENT));
+ if (!self->tele_comment)
+ {
+ fclose(self->tele_fp);
+ return DSK_ERR_NOMEM;
+ }
+ self->tele_comment->year = header[4] + 1900;
+ self->tele_comment->mon = header[5];
+ self->tele_comment->day = header[6];
+ self->tele_comment->hour = header[7];
+ self->tele_comment->min = header[8];
+ self->tele_comment->sec = header[9];
+ if (tele_fread(self, self->tele_comment->text, comment_len))
+ {
+ fclose(self->tele_fp);
+ return DSK_ERR_SYSERR;
+ }
+ self->tele_comment->text[comment_len] = 0;
+ for (n = 0; n < comment_len; n++)
+ {
+ if (self->tele_comment->text[n] == 0 &&
+ self->tele_comment->text[n+1] == 0)
+ {
+ self->tele_comment->text[n] = '\r';
+ self->tele_comment->text[n+1] = '\n';
+ }
+ }
+ dsk_set_comment(s, self->tele_comment->text);
+ }
+ self->tele_track_addr[0][0] = ftell(self->tele_fp);
+
+ return DSK_ERR_OK;
+}
+
+dsk_err_t tele_creat(DSK_DRIVER *self, const char *filename)
+{
+ return DSK_ERR_RDONLY;
+}
+dsk_err_t tele_close(DSK_DRIVER *s)
+{
+ DC_CHECK(s);
+
+ if (fclose(self->tele_fp)) return DSK_ERR_SYSERR;
+ if (self->tele_comment)
+ {
+ dsk_free(self->tele_comment);
+ self->tele_comment = NULL;
+ }
+ return DSK_ERR_OK;
+}
+
+
+
+dsk_err_t tele_write(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ const void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector)
+{
+ return DSK_ERR_RDONLY;
+}
+dsk_err_t tele_format(DSK_DRIVER *self, DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ const DSK_FORMAT *format, unsigned char filler)
+{
+ return DSK_ERR_RDONLY;
+}
+dsk_err_t tele_secid(DSK_DRIVER *s, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ DSK_FORMAT *result)
+{
+ unsigned int n, m;
+ dsk_err_t err;
+
+ DC_CHECK(s);
+
+ /* Single-sided? */
+ if (head > 0 && self->tele_head.sides < 2)
+ {
+ return DSK_ERR_NOADDR;
+ }
+ err = check_rate(self, geom); if (err) return err;
+ err = tele_seektrack(self, cylinder, head);
+ if (err) return err;
+
+ m = self->tele_sector % self->tele_trackhead.sectors;
+ ++self->tele_sector;
+ for (n = 0; n < m; n++)
+ {
+ err = tele_readsechead(self);
+ if (err) return err;
+ err = tele_readsec(self, NULL);
+ if (err) return err;
+ }
+ err = tele_readsechead(self);
+ if (result)
+ {
+ result->fmt_cylinder = self->tele_sechead.cylinder_id;
+ result->fmt_head = self->tele_sechead.head_id;
+ result->fmt_sector = self->tele_sechead.sector_id;
+ result->fmt_secsize = self->tele_sechead.sector_len;
+ }
+ return DSK_ERR_OK;
+}
+dsk_err_t tele_xseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head)
+{
+ return DSK_ERR_NOTIMPL;
+}
+
+
+dsk_err_t tele_read(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector)
+{
+ return tele_xread(self, geom, buf, cylinder, head, cylinder, head,
+ sector, geom->dg_secsize, NULL);
+}
+
+
+dsk_err_t tele_xread(DSK_DRIVER *s, const DSK_GEOMETRY *geom, void *buf,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ dsk_pcyl_t cyl_expected,
+ dsk_phead_t head_expected,
+ dsk_psect_t sector, size_t sector_size,
+ int *deleted)
+{
+ dsk_err_t err = DSK_ERR_OK;
+ unsigned char *secbuf;
+ size_t len = sector_size;
+ size_t sseclen;
+ int want_deleted = 0;
+ int try_again = 0;
+
+ DC_CHECK(s);
+
+ /* Single-sided? */
+ if (head > 0 && self->tele_head.sides < 2)
+ {
+ return DSK_ERR_NOADDR;
+ }
+
+/* Check that the requested data rate is compatible. */
+ err = check_rate(self, geom); if (err) return err;
+ if (deleted && *deleted) want_deleted = 4;
+ do
+ {
+ err = tele_seeksec(self, geom, cylinder, head,
+ cyl_expected, head_expected,
+ sector, &len, &sseclen);
+/* Are we retrying because we are looking for deleted data and found
+ * nondeleted or vice versa?
+ *
+ * If so, and we have run out of sectors in this track, AND we are on head 0,
+ * AND the disc has 2 heads, AND we are in multitrack mode, then look on head 1
+ * as well. Amazing.
+ * */
+ if (try_again == 1 && err == DSK_ERR_NOADDR)
+ {
+ err = DSK_ERR_NODATA;
+ if ((!geom->dg_nomulti) && head == 0 &&
+ self->tele_head.sides > 1)
+ {
+ head++;
+ sector = geom->dg_secbase;
+ continue;
+ }
+ }
+ try_again = 0;
+ if (err == DSK_ERR_NOADDR) self->tele_sector = 0;
+ if (err != DSK_ERR_DATAERR && err != DSK_ERR_OK)
+ return err;
+ /* We have the sector. But does it contain deleted data? */
+ if (deleted) *deleted = 0;
+ if ((self->tele_sechead.syndrome & 4) != want_deleted)
+ {
+ if (geom->dg_noskip)
+ {
+ if (deleted) *deleted = 1;
+ }
+ else
+ {
+ try_again = 1;
+ ++sector;
+ continue;
+ }
+ }
+ /* Read the whole sector into the buffer (if it's there) */
+ secbuf = dsk_malloc(sseclen);
+ if (!secbuf) return DSK_ERR_NOMEM;
+ err = tele_readsec(self, secbuf);
+ if (sseclen > sector_size) sseclen = sector_size;
+ memcpy(buf, secbuf, sseclen);
+ dsk_free(secbuf);
+ err = DSK_ERR_OK;
+ if (self->tele_sechead.syndrome & 2) err = DSK_ERR_DATAERR;
+ if (self->tele_sechead.syndrome & 32) err = DSK_ERR_NODATA;
+
+ }
+ while(try_again);
+
+ return err;
+}
+
+
+dsk_err_t tele_xwrite(DSK_DRIVER *self, const DSK_GEOMETRY *geom, const void *buf,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ dsk_pcyl_t cyl_expected, dsk_phead_t head_expected,
+ dsk_psect_t sector, size_t sector_size, int deleted)
+{
+ return DSK_ERR_RDONLY;
+}
+
+dsk_err_t tele_trackids(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ dsk_psect_t *count, DSK_FORMAT **result)
+{
+ return DSK_ERR_NOTIMPL;
+}
+
+dsk_err_t tele_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_phead_t head, unsigned char *result)
+{
+ return DSK_ERR_NOTIMPL;
+}
+
+dsk_err_t tele_option_enum(DSK_DRIVER *self, int idx, char **optname)
+{
+ return DSK_ERR_NOTIMPL;
+}
+
+dsk_err_t tele_option_set(DSK_DRIVER *self, const char *optname, int value)
+{
+ return DSK_ERR_NOTIMPL;
+}
+
+dsk_err_t tele_option_get(DSK_DRIVER *self, const char *optname, int *value)
+{
+ return DSK_ERR_NOTIMPL;
+}
+
+/* Don't bother to implement this one. Fall back on the standard version. */
+dsk_err_t tele_getgeom(DSK_DRIVER *self, DSK_GEOMETRY *dg)
+{
+ return DSK_ERR_NOTIMPL;
+}
Added: vendor/libdsk/current/lib/drvtele.h
===================================================================
--- vendor/libdsk/current/lib/drvtele.h (rev 0)
+++ vendor/libdsk/current/lib/drvtele.h 2007-08-06 00:43:48 UTC (rev 442)
@@ -0,0 +1,140 @@
+/***************************************************************************
+ * *
+ * LIBDSK: General floppy and diskimage access library *
+ * Copyright (C) 2001-2,2007 John Elliott <jc...@se...> *
+ * *
+ * This library is free software; you can redistribute it and/or *
+ * modify it under the terms of the GNU Library General Public *
+ * License as published by the Free Software Foundation; either *
+ * version 2 of the License, or (at your option) any later version. *
+ * *
+ * This library is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free *
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, *
+ * MA 02111-1307, USA *
+ * *
+ ***************************************************************************/
+
+/* Declarations for the Teledisk driver */
+
+/* This structure (for the file header) is based on
+ * <http://www.fpns.net/willy/wteledsk.htm>
+ */
+
+typedef unsigned char tele_byte;
+typedef unsigned short tele_word;
+
+typedef struct
+{
+ char magic[3];
+ tele_byte volume_seq; /* 0 for first file in sequence, 1 for 2nd... */
+ tele_byte volume_id; /* All files must have the same volume ID */
+ tele_byte ver; /* Version of Teledisk used to create file */
+ tele_byte datarate; /* 0=250Kbps (360k/720k) 1=300Kbps (1.2M)
+ 2=500Kbps (1.4M). Bit 7 set for FM. */
+ tele_byte drivetype; /* 1=360k 2=1.2M 3=720k 4=1.4M */
+ tele_byte doubletrack; /* 0=media matched drive
+ 1=48tpi media, 96tpi drive
+ 2=96tpi media, 48tpi drive
+
+ Bit 7 set if comment present. */
+ tele_byte dosmode; /* Only allocated sectors backed up? */
+ tele_byte sides; /* Number of heads */
+ tele_word crc;
+} TELE_HEADER;
+
+typedef struct
+{
+ int year, mon, day;
+ int hour, min, sec;
+ char text[1];
+} TELE_COMMENT;
+
+typedef struct
+{
+ tele_byte sectors;
+ tele_byte cylinder;
+ tele_byte head;
+ tele_byte crc;
+} TELE_TRKHEAD;
+
+typedef struct
+{
+ tele_byte cylinder_id; /* On-disk sector ID */
+ tele_byte head_id;
+ tele_byte sector_id;
+ size_t sector_len;
+ tele_byte syndrome; /* Various errors:
+ * bit 0: Sector appeared more than once
+ * bit 1: CRC error
+ * bit 2: Deleted data
+ * bit 4: Unallocated sector not saved
+ * bit 5: Sector ID but no data
+ * bit 6: Data but no sector ID */
+ tele_byte header_crc;
+/* Strictly speaking the last 2 members are the start of the sector data
+ * rather than the end of the sector header. But there's not a lot of
+ * difference - you just have to be sure not to load them if
+ * (syndrome & 0x30). */
+ tele_word compressed_len;
+ tele_byte encoding;
+} TELE_SECHEAD;
+
+typedef struct
+{
+ DSK_DRIVER tele_super;
+ TELE_HEADER tele_head;
+ FILE *tele_fp;
+ TELE_COMMENT *tele_comment;
+ /* Fake sector for READ ID command */
+ unsigned int tele_sector;
+ /* Addresses of track headers */
+ long tele_track_addr[100][2];
+ TELE_TRKHEAD tele_trackhead;
+ TELE_SECHEAD tele_sechead;
+} TELE_DSK_DRIVER;
+
+
+dsk_err_t tele_open(DSK_DRIVER *self, const char *filename);
+dsk_err_t tele_creat(DSK_DRIVER *self, const char *filename);
+dsk_err_t tele_close(DSK_DRIVER *self);
+dsk_err_t tele_read(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector);
+dsk_err_t tele_write(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ const void *buf, dsk_pcyl_t cylinder,
+ dsk_phead_t head, dsk_psect_t sector);
+dsk_err_t tele_format(DSK_DRIVER *self, DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ const DSK_FORMAT *format, unsigned char filler);
+dsk_err_t tele_secid(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ DSK_FORMAT *result);
+dsk_err_t tele_xseek(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head);
+dsk_err_t tele_xread(DSK_DRIVER *self, const DSK_GEOMETRY *geom, void *buf,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ dsk_pcyl_t cyl_expected, dsk_phead_t head_expected,
+ dsk_psect_t sector, size_t sector_size, int *deleted);
+dsk_err_t tele_xwrite(DSK_DRIVER *self, const DSK_GEOMETRY *geom, const void *buf,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ dsk_pcyl_t cyl_expected, dsk_phead_t head_expected,
+ dsk_psect_t sector, size_t sector_size, int deleted);
+dsk_err_t tele_trackids(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_pcyl_t cylinder, dsk_phead_t head,
+ dsk_psect_t *count, DSK_FORMAT **result);
+dsk_err_t tele_status(DSK_DRIVER *self, const DSK_GEOMETRY *geom,
+ dsk_phead_t head, unsigned char *result);
+
+dsk_err_t tele_option_enum(DSK_DRIVER *self, int idx, char **optname);
+
+dsk_err_t tele_option_set(DSK_DRIVER *self, const char *optname, int value);
+dsk_err_t tele_option_get(DSK_DRIVER *self, const char *optname, int *value);
+
+dsk_err_t tele_getgeom(DSK_DRIVER *self, DSK_GEOMETRY *dg);
+
Modified: vendor/libdsk/current/lib/dsksgeom.c
===================================================================
--- vendor/libdsk/current/lib/dsksgeom.c 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/lib/dsksgeom.c 2007-08-06 00:43:48 UTC (rev 442)
@@ -34,6 +34,8 @@
struct dsk_namedgeom *next;
} DSK_NAMEDGEOM;
+/* These must match the order of the entries in dsk_format_t in libdsk.h */
+
static DSK_NAMEDGEOM stdg[] =
{
/* sidedness cyl hd sec psn sz rate rwgap fmtgap fm nomulti*/
@@ -60,6 +62,11 @@
{"bbc200", { SIDES_ALT, 80, 1,10, 0, 256, RATE_SD, 0x2A, 0x50, 1, 0 }, "BBC 200k" }, /* 200k */
{"mbee400", { SIDES_ALT, 40, 1,10, 0, 512, RATE_SD, 0x0C, 0x17, 0, 0 }, "Microbee 400k" }, /* 400k */
{"mgt800", { SIDES_OUTOUT, 80, 2,10, 1, 512, RATE_SD, 0x0C, 0x17, 0, 0 }, "MGT 800k" }, /* MGT 800k */
+{"trdos640",{ SIDES_ALT, 80, 2,16, 1, 256, RATE_SD, 0x12, 0x60, 0, 0 }, "TR-DOS 640k" }, /* TR-DOS 640k */
+
+/* Geometries below this line don't appear in dsk_format_t and can be accessed
+ * only by name. */
+
{"myz80", { SIDES_ALT, 64, 1,128, 0,1024, RATE_ED, 0x2A, 0x52, 0, 0 }, "MYZ80 8Mb" }, /* MYZ80 8Mb */
};
Modified: vendor/libdsk/current/man/apriboot.1
===================================================================
--- vendor/libdsk/current/man/apriboot.1 2007-08-03 10:15:21 UTC (rev 441)
+++ vendor/libdsk/current/man/apriboot.1 2007-08-06 00:43:48 UTC (rev 442)
@@ -1,7 +1,7 @@
.\" -*- nroff -*-
.\"
.\" apriboot.1: apriboot man page
-.\" Copyright (c) 2006 John Elliott
+.\" Copyright (c) 2006-7 John Elliott
.\"
.\" This library is free software; you can redistribute it and/or modify it
.\" under the terms of the GNU Library General Public License as published by
@@ -20,7 +20,7 @@
.\" Author contact information:
.\" John Elliott: email: jc...@se...
.\"
-.TH apriboot 1 "18 November, 2006" "Version 1.1.12" "Emulators"
+.TH apriboot 1 "27 July, 2007" "Version 1.1.14" "Emulators"
.\"
.\...
[truncated message content] |