🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #4664

Re: HD disks & reading IBMPC disks

#4664
From: Hartmut Semken
Date: Sun, 08 Oct 1989 07:47
195 lines
6789 bytes
In article <PINKAS.89Oct6115615@cadev2.intel.com> pinkas@cadev2.intel.com (Israel Pinkas ~) writes:
>1) Is there any way to get a 1040ST (TOS 1.4) to use HD (1.4M) disks?  I
>   tried to format one and the machine refused.  (Gave the same error as
>   when you try to format a write-protected disk.

Yes. It is possible; it requires hacking the hardware:

1.4 Megabyte drives use 300 rounds per minute rotation speed and a 500
kBit per second data rate; twice the data rate/density as the regular
drives do.

If You get a HD drive (TEAC FD135 HFN for example) and wire it up to the
ST, it will work just as a 720 k-drive, cause the controller chip is
still fixed to 250 kBit per second.

We have to speed up the controller; looks easy: the controller manual
says all time constants of the controller are take from its 8 MHz clock. 
If we would just switch it to 16 MHz?

That is, what I have done to my ST. I use the 16 MHz output of the
SHIFTER as clock source and switch the controller clock between 16 and 8
MHz based on the High-Denity-Enable output of my TEAC FD 135HFN (Shugard
BUS pin 2).

It works fine, if the step-rate (the time between 2 consecutive Step
pulses sent to the drive) is set to 6 milliseconds. The controller will
now step every 3 milliseconds (since we doubled the his clock) in HD
mode, and every 6 milliseconds in DD mode; this does not hurt the drive
or performance too much.

I have some problems with it: no program will load from HD disks and
access to folders does not seem to work too well from DESKTOP.
Everything works fine from msh, as far as I can tell. Even copying files
from HD to DD disks (DD disk in drive B; not tested for single drive
copy) works fine.

All we still need is the software to set the step rate to 6 milliseconds
and to format a drive with 18 Sectors per track.

Here ist goes:

seek6.s: set seek rate for all (both) drives to 6 milliseconds
/	module name seek6

	.shri

	.globl main_
main_:
	clr.l	-(sp)
	move.w	$0x20,-(sp)
	trap	$1
	addq.l	$6,a7
	move.l	d0,_save_ssp
	move.w	$0,0x440 / 0 => 6 ms, 1 => 12 ms, 2 => 2 ms, 3 => 3 ms
	lea	0x46a,a0
	move.l	(a0),d0
	movea.l	d0,a0
	jsr	(a0)
	move.l	_save_ssp,-(sp)
	move.w	$0x20,-(sp)
	trap	$1
	addq.l	$6,a7
	.even
_save_ssp:
	.blkl	1
-----------------------
formath.c: format high density disk
/* formath.c Formatter fuer High Density Disketten */
/* nur fuer angepasste Hardware! Floppycontroller und Laufwerk */
/* muessen High-Density tauglich sein! */
/* Hartmut Semken, Lupsteiner Weg 67 1000 Berlin 37 */
/* hase@netmbx.UUCP */
/* 03-SEP-89 */
/*formath.c: format High Density disks on modified ST (controller clock
switcheble to 16 MHz) using HD disks and drive.
Quickly hacked in from example given in Mark Williams C documentation */

#include <stdio.h>
#include <osbind.h>
#include <time.h>

#define SLEEPTIME 1	/* 1: Zeitschleife, 0: Taste */
#define BLANK (0xE5E5)
#define MAGIC (0x87654321L)
#define BUFSIZE (20*1024) /* Platz fuer mehr als 18 Sektoren... */

#define DEVICE 0	/* 0 = Floppy A, 1 = Floppy B	*/
#define SIDES 2		/* je  				*/
#define SECTORS 18	/* nach				*/
#define TRACKS 80	/*Belieben			*/

#define TOTSEC (TRACKS * SIDES * SECTORS)

extern int errno;

main(){
	int track;
	int side;
	int status;
	short *bf;
	register char reply;
	short *middle;
	char buffer[512];
		
	printf("\033E\n");
	printf("Public Domain High Density Mini Formatter\n");
	printf("von H. Semken\nDer Autor garantiert in keiner Weise fr die Funktion\nDieses Programmes.\nBenutzung auf eigene Gefahr.\n");
	printf("\n\n\n");
	printf("\007\033pFormatiere Diskette in Drive %c\033q\n%d Seiten\n%d Sektoren pro Spur\n%d Spuren\n\n", (65+DEVICE), SIDES, SECTORS, TRACKS);
	printf("Wirklich formatieren? ");
	fflush(stdout);
	if ((reply = Crawcin()) != 'y' && reply != 'Y' && reply != 'j' && reply != 'J') {
		printf("Nein. Floppy nicht formatiert.\n");
		sleep(1);
		Pterm0();
	}
	printf("Ja.\n");
	printf("Diskette einlegen; Taste drcken...");
	fflush(stdout);
	Crawcin();
	printf("\n");
	bf = malloc(BUFSIZE);
	for (track = TRACKS-1; track >= 0; track--) {
		for (side = 0; side < SIDES; side++) {
			printf("Formatiere Spur %d, Seite %d", track, side);
			fflush(stdout);
			status = Flopfmt(bf, 0L, DEVICE, SECTORS, track, side, 1, MAGIC, BLANK);
			if (status) {
				middle = bf;
				printf("\t%d\n", status);
				while (*middle) {
					printf("\tDefekter Sektor %d\n", *middle++);
				}
			} else {
				printf("\tokay\r");
			}
		}
	}
	printf("\n\nAlle Spuren formatiert\n");
	printf("Initialisiere Directory\n");
	for (track = 0; track < (BUFSIZE>>1); bf[track++] = 0);
	for (track = 0; track < 2;track++) {
		for (side = 0; side < SIDES; side++){
		if (status = Flopwr(bf, 0L, DEVICE, 1, track, side, SECTORS)) {
			errno = -status;
			perror("Write Error");
		}
		}
	}
	Protobt(buffer, (long)Random(),3,0); /* Prototyp Bootsector fr 
	                                      * 80 * 2 * 9 Sektoren */
	/* Prototyp Bootsektor fr das neue Format anpassen */
	/* Bytes 19 und 20 enthalten die Sektoren pro Disk */

	/* unteres Byte von TOTSEC */
	buffer[19] = (char)(((TOTSEC>>8)<<8)^TOTSEC);
	/* oberes Byte von TOTSEC; es lebe das Intel int-Format */
	buffer[20] = (char)(TOTSEC>>8);
	buffer[24] = (char)SECTORS; /* Sektoren pro Spur */
	status = Flopwr(buffer, 0L, DEVICE, 1, 0, 0, 1);
	if (status) {
		errno = -status;
		perror("Write Error (Bootsector)");
	}
	status = Flopver(buffer, 0L, DEVICE, 1, 0, 0, 1);
	if (status) {
		errno = -status;
		perror("Verify Error (Bootsector)");
	}
	printf("Diskette in Laufwerk %c formatiert\n", (65+DEVICE));
	sleep(1);
	Pterm0();
}

sleep(seconds)
int seconds;
#if SLEEPTIME
{
	clock_t t;
	for(t = clock();clock() < (t + CLK_TCK*seconds););
}
#else
{
	printf("Taste druecken\n");
	fflush(stdout);
	Crawcin();
}
#endif
/* end of formath.c */

-- 
Hartmut Semken, Lupsteiner Weg 67, 1000 Berlin 37 hase@netmbx.UUCP
Dennis had stepped up into the top seat whet its founder had died of a
lethal overdose of brick wall, taken while under the influence of a
Ferrari and a bottle of tequila. (Douglas Adams; the long dark teatime...)
Technical Details
Message-ID: <3578@netmbx.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!bloom-beacon!eru!luth!sunic!mcsun!unido!tub!tmpmbx!netmbx!hase
References: <PINKAS.89Oct6115615@cadev2.intel.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!bloom-beacon!eru!luth!sunic!mcsun!unido!tub!tmpmbx!netmbx!hase
From: hase@netmbx.UUCP (Hartmut Semken)
Newsgroups: comp.sys.atari.st
Subject: Re: HD disks & reading IBMPC disks
Message-ID: <3578@netmbx.UUCP>
Date: 8 Oct 89 07:47:08 GMT
References: <PINKAS.89Oct6115615@cadev2.intel.com>
Reply-To: hase@netmbx.UUCP (Hartmut Semken)
Distribution: comp
Organization: netmbx Public Access Unix, Berlin, West Germany
Lines: 195