Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!mordor!styx!ptsfa!amdahl!drivax!cavender From: cavender@drivax.UUCP Newsgroups: comp.os.minix Subject: Up on Compaq portable (with fixes & tools) Message-ID: <1416@drivax.UUCP> Date: Tue, 28-Apr-87 15:41:00 EDT Article-I.D.: drivax.1416 Posted: Tue Apr 28 15:41:00 1987 Date-Received: Fri, 1-May-87 00:38:03 EDT Reply-To: cavender@drivax.UUCP (Steve Cavender) Organization: Digital Research, Monterey Lines: 210 Keywords: printer disk DOS tools utilities I've had good success with bringing MINIX 1.1 up on my Compaq portable. It's running a V20 (4.77MHz). My hard disk is a CompuAdd 20Mb (3.5") drive, which uses one of the WD 100x controllers, so Gary Oliver's 'wini.c' diff got that up and running. I've partitioned it as (1) 15Mb DOS bootable and (2) 5Mb for MINIX /usr. I have a change in the printer driver that makes printer determination more reliable (at least on BIOS compatible clones). In 'printer.c', the routine 'print_init()' checks to see whether the display is monochrome or color. If mono, then the printer port base is set to the adapter on the monochrome card, otherwise it is set to the alternate adapter address. However, for those of us with compatible clones, this is often not a valid assumption. At 'print_init()' time, the BIOS variables are still valid, however, and location 0000:0408 is defined to contain the base address of the primary printer, so make the following change to 'printer.c': /*===========================================================================* * print_init * *===========================================================================*/ PRIVATE print_init() { int i; port_base = get_word(0,0x408); /* Get port base address from BIOS */ pr_busy = FALSE; port_out(port_base + 2, INIT_PRINTER); for (i = 0; i < DELAY_COUNT; i++) ; /* delay loop */ port_out(port_base + 2, SELECT); } and then add the following lines to 'klib88.s': ... (at the front) .globl _get_word ... (and down after 'get_byte') |*======================================================================* |* get_word * |*======================================================================* | This routine is used to fetch word from anywhere in memory. | The call is: | i = get_word(seg, off) | where | 'seg' is the value to put in es | 'off' is the offset from the es value _get_word: push bp | save bp mov bp,sp | we need to access parameters push es | save es mov es,4(bp) | load es with segment value mov bx,6(bp) | load bx with offset from segment seg es | go get the word mov ax,(bx) | ax = word pop es | restore es pop bp | restore bp ret | return to caller ============================================================================== Last, but not least, some DOS utilities. If you don't have COPYIIPC or some other disk image copier for making backups before you begin modifying sources, AND your system only has one floppy drive, you need help (so do I, that sentence was too long). Here is a matching set of utilities for making those backups. FREAD and FWRITE are included here as as source. They were written for MSC 4.0. FREAD copies the entire floppy image (360Kb) to a file on the hard disk; FWRITE puts the image back out to a floppy. They are very simple-minded, but they're all I needed to get my backup copies made, and they run surprisingly fast. They are probably extremely innovative routines, but as it only took a few minutes to write them, I saw no need to copyright them. Use them but don't abuse them. If you don't have any tools available to compile these, let me know, and I can either mail or post the binaries (of FREAD and FWRITE, not the compiler). I haven't included them in this posting, because in uuencoded, 'arc'ed form they run about 19Kb, and I wasn't sure that such volume was called for. /* fread.c "Share and Enjoy" */ #include #include #include union REGS reg; char buffer[4608]; track_io( io, disk, track, head ) int io, disk, track, head; { reg.h.ah = (io == 0) ? 2 : 3; reg.h.al = 9; reg.h.ch = track; reg.h.cl = 1; reg.h.dh = head; reg.h.dl = disk; reg.x.bx = (int)buffer; int86( 0x13, ®, ® ); return( (reg.x.cflag & 1) ? reg.h.ah : 0 ); } main( argc, argv ) int argc; char *argv[]; { int disk, track, head; FILE *fimage; if ( argc != 3 ) { printf( "Usage is: fread d: filename" ); exit( 1 ); } disk = toupper( *argv[1] ) - 'A'; if ( (fimage = fopen( argv[2], "wb" )) == NULL ) { printf( "Unable to open %s", argv[2] ); exit( 1 ); } for ( track = 0; track < 40; track++ ) { for ( head = 0; head < 2; head++ ) { if ( track_io( 0, disk, track, head ) ) { printf( "Error on floppy read" ); exit( 1 ); } fwrite( buffer, 1, 4608, fimage ); } } fclose( fimage ); } /* fwrite.c "Share and Enjoy" */ #include #include #include union REGS reg; char buffer[4608]; track_io( io, disk, track, head ) int io, disk, track, head; { reg.h.ah = (io == 0) ? 2 : 3; reg.h.al = 9; reg.h.ch = track; reg.h.cl = 1; reg.h.dh = head; reg.h.dl = disk; reg.x.bx = (int)buffer; int86( 0x13, ®, ® ); return( (reg.x.cflag & 1) ? reg.h.ah : 0 ); } main( argc, argv ) int argc; char *argv[]; { int disk, track, head; FILE *fimage; if ( argc != 3 ) { printf( "Usage is: fwrite filename d:" ); exit( 1 ); } if ( (fimage = fopen( argv[1], "rb" )) == NULL ) { printf( "Unable to open %s", argv[1] ); exit( 1 ); } disk = toupper( *argv[2] ) - 'A'; for ( track = 0; track < 40; track++ ) { for ( head = 0; head < 2; head++ ) { fread( buffer, 1, 4608, fimage ); if ( track_io( 1, disk, track, head ) ) { printf( "Error on floppy write" ); exit( 1 ); } } } fclose( fimage ); } -- Steve Cavender Digital Research, Inc.|(My opinions. You can't have them.) USENET: cavender@drivax.UUCP |"The size of the FAT for a 128 giga- Telex: 9102406616 TAG SEMI SEA UQ |byte disk is unpleasant to contem- EasyLink: 62211010 |plate." -- Andrew S. Tanenbaum