Path: tut!enea!mcvax!uunet!lll-winken!lll-lcc!ames!mailrus!umix!nancy!eecae!upba!unocss!cs002
From: cs002@unocss.UUCP (Stan Wileman)
Newsgroups: comp.os.minix
Subject: Re: minix 1.2 on 3.5" drives.
Summary: Minix lives on Z-181s
Message-ID: <260@unocss.UUCP>
Date: 21 Apr 88 16:39:53 GMT
References: <5525@sigi.Colorado.EDU>
Organization: U. of Nebraska at Omaha
Lines: 249

In article <5525@sigi.Colorado.EDU>, hartzell@boulder.Colorado.EDU
		(George Hartzell) writes:
> I am looking into putting minix on a zenith 183 portable.  ...
> 		...  Is it compatible enough or am I wasting my time?

Yes, MINIX runs well on the Zenith laptops.  I haven't any experience
with the Z-183 (with the builtin wini), but my external 20 MB wini on
the Z-181 works fine.  Now, for the fun part -- getting it there...

I moved MINIX from 5.25" to 3.5" diskettes using a procedure that should
work for most folks, especially those with both types of drives on the
same machine.  It involves three steps:
1. Create an MS-DOS file that contains a sector-for-sector image of a
   MINIX 5.25" floppy.
2. Copy this MS-DOS file to a machine that has 3.5" diskettes.  Note
   that this step is unnecessary if you have both 5.25" and 3.5" drives
   on the same machine; I don't, so I used a product called the "Brooklyn
   Bridge" to achieve the transfer; any asynchronous comm. program (Cross-
   talk, mirror, kermit, etc.) should be usable, but slower than the Bridge.
3. Copy the MINIX disk image from the MS-DOS file sector-for-sector to the
   3.5" disk (which was previously formatted).

Once you've transferred a boot disk, a root fs, and a /usr fs you should be
able to run MINIX on the Z-18?.  Note that the disks will be treated as
360K filesystems, but that's okay, since they have at least that much.  The
floppy driver in 1.2 handles the 3.5"-ers on the Z-181 without difficulty
(although I'm certain some parameter-tweaking could result in improved
performance :-)  You CAN make 720K filesystems by using mkfs and NO SOURCE
CODE CHANGES!  The only problem I've not found sufficient time to correct
is the keyboard encoding; the Z-18? machines use the extra "function" shift
key to get some of the codes normally found on a PC's keyboard, and they're
encoded in a way that's got my little mind buggered!

Incidentally, steps (1) and (3) in the procedure given above were accomplished
with a pair of complementary C programs that run under MS-DOS.  These were
compiled using MS C 4.0, but other compilers should work just as well.

GETDI.C
-------

/*
 * Make an image of the diskette in selected disk drive.
 * The order in which the information is written is
 *
 * Side 0, Track 0, Sector 1 ... Sector MAXSEC
 * Side 1, Track 0, Sector 1 ... Sector MAXSEC
 * Side 0, Track 1, Sector 1 ... Sector MAXSEC
 * ...
 * Side 1, Track MAXTRK, Sector 1 ... Sector MAXSEC
 *
 * The output file is always named DISK.ALL
 */

#include <stdio.h>
#include <dos.h>
#include <fcntl.h>

#define MAXSEC 9
#define MAXTRK 39

union REGS inregs;
union REGS outregs;
struct SREGS sregs;
char buffer[512*MAXSEC];	/* where to place the track copy */
int drive;
int trkno, headno;
int out;			/* output file descriptor */

main()
{
	int ok, tries;
	
	inregs.h.ah = 0;		/* reset disk system */
	int86(0x13, &inregs, &outregs);

	out = creat("C:DISK.ALL",0666);
	if (out < 0) {
		printf("Can't create C:DISK.ALL\n");
		exit(1);
	}
	close(out);
	out = open("C:DISK.ALL",O_WRONLY | O_BINARY);
	if (out < 0) {
		printf("Can't open C:DISK.ALL\n");
		exit(1);
	}
	printf("Drive: ");
	if (scanf("%d",&drive) != 1) exit(0);
	trkno = 0;
	headno = 0;
	
	printf("Reading track/head ");
	for (trkno=0;trkno<=MAXTRK;trkno++)
		for (headno=0;headno<2;headno++) {
			printf("%2d/%2d\b\b\b\b\b", trkno, headno);
			ok = 0;
			tries = 5;
			while (!ok && tries) {
				ok = !readtrk();
				tries--;
			}
			if (ok)	savetrk();
			else {
				printf("\nError reading diskette.\n");
				exit(1);
			}
		}
	
}


readtrk()
{
	int i,j;

	inregs.h.ah = 2;	/* read sector */
	inregs.h.al = MAXSEC;	/* read all of one track */	
	inregs.h.ch = trkno;	/* track 0 */
	inregs.h.cl = 1;	/* sector 1 */
	inregs.h.dh = headno;	/* head 0 */
	inregs.h.dl = drive;	/* drive 0 */

	segread(&sregs);	/* setup es same as ds */
	sregs.es = sregs.ds;
	inregs.x.bx = buffer;

	int86x(0x13, &inregs, &outregs, &sregs);	/* do it! */
	return(outregs.x.cflag);

}

savetrk()
{
	int i, n;
	
	for (i=0;i<MAXSEC;i++) {
		n = write(out,buffer+i*512,512);	/* save one sector */
		if (n != 512) {				/* test for an error */
			printf("\nError writing C:DISK.ALL\n");
			exit(1);
		}
	}
}


PUTDI.C
-------

/*
 * Write drive 1 from the contents of file DISK.ALL
 * The order in which the information is written is
 *
 * Side 0, Track 0, Sector 1 ... Sector MAXSEC
 * Side 1, Track 0, Sector 1 ... Sector MAXSEC
 * Side 0, Track 1, Sector 1 ... Sector MAXSEC
 * ...
 * Side 1, Track MAXTRK, Sector 1 ... Sector MAXSEC
 *
 */

#include <stdio.h>
#include <dos.h>
#include <fcntl.h>

#define MAXSEC 9
#define MAXTRK 39

union REGS inregs;
union REGS outregs;
struct SREGS sregs;
char buffer[512*MAXSEC];	/* where to place the track */
int drive;
int trkno, headno;
int in;				/* input file descriptor */

main()
{
	int ok, tries;
	
	inregs.h.ah = 0;		/* reset disk system */
	int86(0x13, &inregs, &outregs);

	in = open("DISK.ALL",O_RDONLY | O_BINARY);
	if (in < 0) {
		printf("Can't open DISK.ALL\n");
		exit(1);
	}
	printf("Drive: ");
	if (scanf("%d",&drive) != 1) exit(0);
	trkno = 0;
	headno = 0;
	
	printf("Writing cylinder/head ");
	for (trkno=0;trkno<=MAXTRK;trkno++)
		for (headno=0;headno<2;headno++) {
			printf("%2d/%2d\b\b\b\b\b", trkno, headno);
			gettrk();	/* get one track from DISK.ALL */
			ok = 0;
			tries = 5;
			while (!ok && tries) {
				ok = !writetrk();
				tries--;
			}
			if (!ok) {
				printf("Error writing disk.\n");
				exit(1);
			}
		}
}


writetrk()
{
	int i,j;

	inregs.h.ah = 3;	/* write sector */
	inregs.h.al = MAXSEC;	/* write all of one track */	
	inregs.h.ch = trkno;	/* track number */
	inregs.h.cl = 1;	/* sector 1 */
	inregs.h.dh = headno;	/* head number */
	inregs.h.dl = drive;	/* drive number */

	segread(&sregs);	/* setup es same as ds */
	sregs.es = sregs.ds;
	inregs.x.bx = buffer;

	int86x(0x13, &inregs, &outregs, &sregs);	/* do it! */
	return(outregs.x.cflag);
}

gettrk()
{
	int i, n;
	
	for (i=0;i<MAXSEC;i++) {
		n = read(in, buffer+i*512, 512);	/* read one sector */
		if (n != 512) {				/* test for an error */
			printf("\nError reading DISK.ALL\n");
			exit(1);
		}
	}
}

-------

Hope this helps; MINIX on a laptop is really cute in airports :-)


Stan Wileman					..!ihnp4!unocss!cs002 (UUCP)
U. of Nebraska at Omaha, Math/CS Dept.    cs002%zeus@crcvms.unl.edu (BITNET)
