Changeset 259 in xtideuniversalbios for trunk/Serial_Server/library/Image.cpp


Ignore:
Timestamp:
Feb 23, 2012, 7:14:06 AM (12 years ago)
Author:
gregli@…
google:author:
gregli@hotmail.com
Message:

For function int13/0h, restored the code to only reset the floppy drives if a floppy drive was passed in for reset. Other minor optimizations. Better create new floppy support in Serial Server.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Serial_Server/library/Image.cpp

    r258 r259  
    1212#include <stdio.h>
    1313
    14 struct floppyInfo {
    15     unsigned long size;
    16     unsigned char type;
    17     unsigned char cylinders;
    18     unsigned char heads;
    19     unsigned char sectors;
    20 } floppyInfos[] =
    21 {
    22 { 2949120 / 512, 6, 80, 2, 36 },   // 2.88MB 3.5"
    23 { 1474560 / 512, 4, 80, 2, 18 },        // 1.44MB 3.5"
    24 { 1228800 / 512, 2, 80, 2, 15 },     // 1.2MB 5.25"
    25 { 737280 / 512, 3, 80, 1, 18 },    // 720KB 3.5"
    26 { 368640 / 512, 1, 40, 2, 9 }, // 360KB 5.25"
    27 { 327680 / 512, 0, 40, 2, 8 }, // 320KB 5.25"
    28 { 184320 / 512, 0, 40, 1, 9 }, // 180KB 5.25" single sided
    29 { 163840 / 512, 0, 40, 1, 8 }, // 160KB 5.25" single sided
    30 { 0, 0, 0, 0, 0 }
     14struct floppyInfo floppyInfos[] =
     15{
     16    { 1, 2949120 / 512, 6, 80, 2, 36 },         // 2.88MB 3.5"
     17    { 0, 2867200 / 512, 6, 80, 2, 36 },         // 2.88MB 3.5" (alternate spelling with 2.8)
     18    { 0, 2969600 / 512, 6, 80, 2, 36 },         // 2.88MB 3.5" (alternate spelling with 2.9)
     19    { 1, 1474560 / 512, 4, 80, 2, 18 },         // 1.44MB 3.5"
     20    { 0, 1433600 / 512, 4, 80, 2, 18 },         // 1.44MB 3.5" (alternate spelling with 1.4)
     21    { 1, 1228800 / 512, 2, 80, 2, 15 },         // 1.2MB 5.25"
     22    { 1, 737280 / 512, 3, 80, 1, 18 },          // 720KB 3.5"
     23    { 1, 368640 / 512, 1, 40, 2, 9 },           // 360KB 5.25"
     24    { 1, 327680 / 512, 0, 40, 2, 8 },           // 320KB 5.25"
     25    { 1, 184320 / 512, 0, 40, 1, 9 },           // 180KB 5.25" single sided
     26    { 1, 163840 / 512, 0, 40, 1, 8 },           // 160KB 5.25" single sided
     27    { 0, 0, 0, 0, 0, 0 }
    3128};
     29
     30struct floppyInfo *FindFloppyInfoBySize( double size )
     31{
     32    struct floppyInfo *fi;
     33
     34    for( fi = floppyInfos; fi->size != 0 && !(size+5 > fi->size && size-5 < fi->size); fi++ ) ;
     35
     36    if( fi->size == 0 )
     37        fi = NULL;
     38
     39    return( fi );
     40}
    3241
    3342Image::Image( char *name, int p_readOnly, int p_drive )
     
    6978
    7079    floppy = 0;
    71     for( f = floppyInfos; f->size && f->size != totallba; f++ ) ;
     80    for( f = floppyInfos; f->size && !(f->size == totallba && f->real); f++ ) ;
    7281    if( f->size )
    7382    {
     
    7887        p_head = f->heads;
    7988        p_sect = f->sectors;
     89        totallba = p_cyl * p_head * p_sect;
    8090    }
    8191
Note: See TracChangeset for help on using the changeset viewer.