fix CHS => LBA calculation for multisector reads

Sun, 05 Dec 2010 16:18:50 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Sun, 05 Dec 2010 16:18:50 +0000
changeset 51
e5a92d7beecf
parent 50
c3ed7639e32d
child 52
a350dfa92895

fix CHS => LBA calculation for multisector reads

Wrapping was not taken into account...

src/wd279x.c file | annotate | diff | revisions
     1.1 --- a/src/wd279x.c	Sun Dec 05 10:22:23 2010 +0000
     1.2 +++ b/src/wd279x.c	Sun Dec 05 16:18:50 2010 +0000
     1.3 @@ -373,7 +373,7 @@
     1.4  
     1.5  					for (int i=0; i<temp; i++) {
     1.6  						// Calculate the LBA address of the required sector
     1.7 -						lba = ((((ctx->track * ctx->geom_heads) + ctx->head) * ctx->geom_spt) + ctx->sector - 1) * ctx->geom_secsz;
     1.8 +						lba = ((((ctx->track * ctx->geom_heads) + ctx->head) * ctx->geom_spt) + ((ctx->sector + i - 1) % ctx->geom_spt)) * ctx->geom_secsz;
     1.9  
    1.10  						// Read the sector from the file
    1.11  						fseek(ctx->disc_image, lba, SEEK_SET);