[wd2010,main] WD2010 disc geometry fixes

Wed, 13 Mar 2013 00:43:25 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Wed, 13 Mar 2013 00:43:25 +0000
changeset 134
b826697f411a
parent 131
21c770fcee50
child 135
159f937af10d
child 136
f7d78dfb45d0

[wd2010,main] WD2010 disc geometry fixes

I believe I have fixed the geometry problem with FreeBee. The geometry was set
to 17 sectors per track instead of 16, which obviously throws off addressing.
I changed it to use 16 sectors per track. However, s4diag tries to format
sector 17, so I changed the WD2010 emulation to accept any address when
formatting (since the format command doesn't actually do anything, it doesn't
matter). It is now possible to format the hard disk, initialize the file
system, and mount it. However, cpio still fails to copy the system to the hard
disk.

Author: Andrew Warkentin <andreww591 gmail com>

src/main.c file | annotate | diff | revisions
src/wd2010.c file | annotate | diff | revisions
     1.1 --- a/src/main.c	Fri Jan 18 18:51:50 2013 +0000
     1.2 +++ b/src/main.c	Wed Mar 13 00:43:25 2013 +0000
     1.3 @@ -48,7 +48,7 @@
     1.4  		state.hdc_disc0 = NULL;
     1.5  		return (0);
     1.6  	}else{
     1.7 -		wd2010_init(&state.hdc_ctx, state.hdc_disc0, 512, 17, 8);
     1.8 +		wd2010_init(&state.hdc_ctx, state.hdc_disc0, 512, 16, 8);
     1.9  		fprintf(stderr, "Disc image loaded.\n");
    1.10  		return (1);
    1.11  	}
     2.1 --- a/src/wd2010.c	Fri Jan 18 18:51:50 2013 +0000
     2.2 +++ b/src/wd2010.c	Wed Mar 13 00:43:25 2013 +0000
     2.3 @@ -327,6 +327,7 @@
     2.4  						ctx->track = new_track;
     2.5  					} else {
     2.6  						// Seek error. :(
     2.7 +						LOG("WD2010 ALERT: track %d out of range", new_track);
     2.8  						ctx->status = SR_ERROR;
     2.9  						ctx->error_reg = ER_ID_NOT_FOUND;
    2.10  						ctx->irq = true;
    2.11 @@ -399,7 +400,7 @@
    2.12  							// Write Sector
    2.13  
    2.14  							// Check to see if the cyl, hd and sec are valid
    2.15 -							if ((ctx->track > (ctx->geom_tracks-1)) || (ctx->head > (ctx->geom_heads-1)) || ((ctx->sector + ctx->sector_count - 1) > ctx->geom_spt-1)) {
    2.16 +							if (cmd != CMD_WRITE_FORMAT && ((ctx->track > (ctx->geom_tracks-1)) || (ctx->head > (ctx->geom_heads-1)) || ((ctx->sector + ctx->sector_count - 1) > ctx->geom_spt-1))) {
    2.17  								LOG("*** WD2010 ALERT: CHS parameter limit exceeded! CHS=%d:%d:%d, nSecs=%d, endSec=%d maxCHS=%d:%d:%d",
    2.18  										ctx->track, ctx->head, ctx->sector,
    2.19  										ctx->sector_count,