aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-05-09 02:41:04 -0400
committerB. Watson <urchlay@slackware.uk>2024-05-09 02:41:04 -0400
commit516fd094e69c64cecab68ce7a7751c0fa5d868ef (patch)
tree4a82d295e1f0b8729b6f889bb6ddc86856ff0194
parentab5cc383546a5d2dfa3a0ebc737a4512db60f77b (diff)
downloadbw-atari8-tools-516fd094e69c64cecab68ce7a7751c0fa5d868ef.tar.gz
fenders: hack to support DOS 2.5 extended files.
-rw-r--r--fenders.134
-rw-r--r--fenders.c30
-rw-r--r--fenders.rst32
3 files changed, 57 insertions, 39 deletions
diff --git a/fenders.1 b/fenders.1
index 56c82d7..ba1d7d4 100644
--- a/fenders.1
+++ b/fenders.1
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.TH "FENDERS" 1 "2024-05-08" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.TH "FENDERS" 1 "2024-05-09" "0.2.1" "Urchlay's Atari 8-bit Tools"
.SH NAME
fenders \- Install Fenders 3-sector loader in boot sectors of an ATR image
.\" RST source for fenders(1) man page. Convert with:
@@ -63,7 +63,7 @@ Print this help message.
DON\(aqT reboot (coldstart) the Atari if Reset is pressed. The default is to coldstart.
.TP
.B \-b
-Create \fBinfile\fP as a blank ATR image and update it
+Create \fBinfile\fP as a blank single\-density ATR image and update it
in\-place. This option requires \fBaxe\fP to be present on
\fIPATH\fP\&. May not be used when reading standard input.
.TP
@@ -145,18 +145,20 @@ When installing the boot loader on a double\-density disk, sector 720 is
sector 720 is either unusable by DOS, or not used unless the disk is
completely full, so this is less of a problem than you might think.
.sp
-\fBfenders\fP and the \fBfenders\fP boot\-loader code will work with DOS
-2.5 "enhanced density" formatted floppies, but only partially: files
-that use sectors above 720 will not appear in the menu (these are the
-same files that DOS 2.5 lists with <> around the filename).
-.sp
-\fBfenders\fP only works on Atari DOS 2.x and compatible (MyDOS, DOS XL, et
-al) single\-sided disk images, either single\-density (720 sectors, 90K),
-double\-density (720 sectors, 180K), or "1050 enhanced" density (1040
-sectors, 130K, although 1050 enhanced density images must be in DOS 2.5
-format, \fInot\fP MyDOS, and see \fBLIMITATIONS\fP below). Other non\-standard DOS
-formats such as SpartaDOS or Atari DOS 3.0 and 4.0 are not supported.
-Atari DOS 1.0 may or may not work (untested).
+\fBfenders\fP has better compatibility with DOS 2.5 than the original
+Atari version. Any files occupying sectors >=720 (the ones with <>
+around the name) have their directory status bytes adjusted to make
+them look like regular DOS 2.0 files. This allows them to display and
+load correctly. The original Atari Fenders installer doesn\(aqt do this,
+but the \fBfenders\fP author wrote a BASIC program to do the job, ages
+ago.
+.sp
+\fBfenders\fP only works on Atari DOS 2.x and compatible (MyDOS, DOS XL,
+et al) single\-sided disk images, either single\-density (720 sectors,
+90K), double\-density (720 sectors, 180K), or "1050 enhanced" density
+(1040 sectors, 130K, although 1050 enhanced density images must be in
+DOS 2.5 format, \fInot\fP MyDOS). Other incompatible DOS formats such as
+SpartaDOS or Atari DOS 1.0/3.0/4.0 are not supported.
.sp
The \fBfenders\fP boot loader source code distributed with \fBfenders\fP
is not the original source code (which has never been
@@ -233,10 +235,6 @@ be used for file storage.
No checking for non\-standard formats (SpartaDOS, DOS 3, MyDOS with
subdirectories, dedicated bootdisks, etc) is done.
.sp
-If an "enhanced" 1050 density disk image has the bootloader installed,
-it won\(aqt display the files using sectors above 720 (the ones which
-would appear as \fI<filename.ext>\fP in the DOS 2.5 directory).
-.sp
Actually, the above limitations are a direct result of the fact that
\fBfenders\fP deals with the disk image at the "sector" level, and contains
no code that understands the files, directory, or VTOC on the image.
diff --git a/fenders.c b/fenders.c
index ce3b242..e14b6ed 100644
--- a/fenders.c
+++ b/fenders.c
@@ -380,9 +380,33 @@ int main(int argc, char **argv) {
}
if(dens == SD) {
- /* single density can just use a simple copy loop */
- while( (c = getc(in)) != EOF )
+ int offs = 0, sectorcount = 0, fixcount = 0;
+ /* single density can just use a simple copy loop... except we want
+ to make DOS 2.5 extended files visible. <FILE> in the dir listing
+ means the status byte is $03, change it to normal file ($42). */
+ while( (c = getc(in)) != EOF ) {
+ if(offs == 45569) { /* LSB of number-of-sectors, VTOC offset 1 */
+ sectorcount = c;
+ } else if(offs == 45570) { /* MSB of number-of-sectors, VTOC offset 2 */
+ sectorcount |= (c << 8);
+ if(sectorcount == 1010)
+ fprintf(stderr, SELF ": DOS 2.5 disk detected, fixing extended files.\n");
+ } else if(offs >= 45696 && offs < 46720 && (offs % 16 == 0)) {
+ if(sectorcount == 1010 && c == 0x03) {
+ c = 0x42;
+ fixcount++;
+ }
+ }
putc(c, out);
+ offs++;
+ }
+ if(sectorcount == 1010) {
+ if(fixcount)
+ fprintf(stderr, SELF ": fixed %d extended file%s.\n",
+ fixcount, (fixcount == 1 ? "" : "s"));
+ else
+ fprintf(stderr, SELF ": no extended files to fix.\n");
+ }
} else {
/* double density: copy sectors 4-719 as-is... */
for(c=4; c<720; c++) {
@@ -413,8 +437,6 @@ int main(int argc, char **argv) {
density images. */
/* TODO: examine directory sectors, look for:
- - DOS 2.5 extended files. Either warn about them, or clear the
- extended flag (which causes the bootloader to load them just fine).
- MyDOS subdirectories. It's probably best to abort in that case.
- Non-DOS-compatible disk formats (boot disks, SpartaDOS, Atari
DOS 3 or 4).
diff --git a/fenders.rst b/fenders.rst
index fc46798..bc0bc17 100644
--- a/fenders.rst
+++ b/fenders.rst
@@ -44,7 +44,7 @@ OPTIONS
DON'T reboot (coldstart) the Atari if Reset is pressed. The default is to coldstart.
-b
- Create **infile** as a blank ATR image and update it
+ Create **infile** as a blank single-density ATR image and update it
in-place. This option requires **axe** to be present on
*PATH*. May not be used when reading standard input.
@@ -125,18 +125,20 @@ When installing the boot loader on a double-density disk, sector 720 is
sector 720 is either unusable by DOS, or not used unless the disk is
completely full, so this is less of a problem than you might think.
-**fenders** and the **fenders** boot-loader code will work with DOS
-2.5 "enhanced density" formatted floppies, but only partially: files
-that use sectors above 720 will not appear in the menu (these are the
-same files that DOS 2.5 lists with <> around the filename).
-
-**fenders** only works on Atari DOS 2.x and compatible (MyDOS, DOS XL, et
-al) single-sided disk images, either single-density (720 sectors, 90K),
-double-density (720 sectors, 180K), or "1050 enhanced" density (1040
-sectors, 130K, although 1050 enhanced density images must be in DOS 2.5
-format, *not* MyDOS, and see **LIMITATIONS** below). Other non-standard DOS
-formats such as SpartaDOS or Atari DOS 3.0 and 4.0 are not supported.
-Atari DOS 1.0 may or may not work (untested).
+**fenders** has better compatibility with DOS 2.5 than the original
+Atari version. Any files occupying sectors >=720 (the ones with <>
+around the name) have their directory status bytes adjusted to make
+them look like regular DOS 2.0 files. This allows them to display and
+load correctly. The original Atari Fenders installer doesn't do this,
+but the **fenders** author wrote a BASIC program to do the job, ages
+ago.
+
+**fenders** only works on Atari DOS 2.x and compatible (MyDOS, DOS XL,
+et al) single-sided disk images, either single-density (720 sectors,
+90K), double-density (720 sectors, 180K), or "1050 enhanced" density
+(1040 sectors, 130K, although 1050 enhanced density images must be in
+DOS 2.5 format, *not* MyDOS). Other incompatible DOS formats such as
+SpartaDOS or Atari DOS 1.0/3.0/4.0 are not supported.
The **fenders** boot loader source code distributed with **fenders**
is not the original source code (which has never been
@@ -215,10 +217,6 @@ be used for file storage.
No checking for non-standard formats (SpartaDOS, DOS 3, MyDOS with
subdirectories, dedicated bootdisks, etc) is done.
-If an "enhanced" 1050 density disk image has the bootloader installed,
-it won't display the files using sectors above 720 (the ones which
-would appear as *<filename.ext>* in the DOS 2.5 directory).
-
Actually, the above limitations are a direct result of the fact that
**fenders** deals with the disk image at the "sector" level, and contains
no code that understands the files, directory, or VTOC on the image.