- added support for 360k floppy images

* new floppy type 360k can be used in .bochsrc and the config interface
  * media type and geometry can be set for the floppy type
  * BIOS changes to make 360k floppy drives work
  * bximage can create 360k images now
This commit is contained in:
Volker Ruppert 2002-08-01 07:37:56 +00:00
parent 1f577b31fa
commit a6d07ad166
8 changed files with 65 additions and 30 deletions

Binary file not shown.

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rombios.c,v 1.60 2002-07-23 18:45:26 vruppert Exp $
// $Id: rombios.c,v 1.61 2002-08-01 07:34:58 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1067,10 +1067,10 @@ Bit16u cdrom_boot();
#endif // BX_ELTORITO_BOOT
static char bios_cvs_version_string[] = "$Revision: 1.60 $";
static char bios_date_string[] = "$Date: 2002-07-23 18:45:26 $";
static char bios_cvs_version_string[] = "$Revision: 1.61 $";
static char bios_date_string[] = "$Date: 2002-08-01 07:34:58 $";
static char CVSID[] = "$Id: rombios.c,v 1.60 2002-07-23 18:45:26 vruppert Exp $";
static char CVSID[] = "$Id: rombios.c,v 1.61 2002-08-01 07:34:58 vruppert Exp $";
/* Offset to skip the CVS $Id: prefix */
#define bios_version_string (CVSID + 4)
@ -3853,10 +3853,16 @@ floppy_media_sense(drive)
drive_type >>= 4;
else
drive_type &= 0x0f;
if ( drive_type == 2 ) {
if ( drive_type == 1 ) {
// 360K 5.25" drive
config_data = 0x00; // 0000 0000
media_state = 0x25; // 0010 0101
retval = 1;
}
else if ( drive_type == 2 ) {
// 1.2 MB 5.25" drive
config_data = 0x00; // 0000 0000
media_state = 0x25; // 0001 0101
media_state = 0x25; // 0010 0101
retval = 1;
}
else if ( drive_type == 3 ) {

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.73 2002-07-29 09:52:03 cbothamy Exp $
// $Id: bochs.h,v 1.74 2002-08-01 07:34:58 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -479,7 +479,8 @@ extern bx_debug_t bx_dbg;
#define BX_FLOPPY_1_44 12 // 1.44M 3.5"
#define BX_FLOPPY_2_88 13 // 2.88M 3.5"
#define BX_FLOPPY_720K 14 // 720K 3.5"
#define BX_FLOPPY_LAST 14 // last one
#define BX_FLOPPY_360K 15 // 360K 5.25"
#define BX_FLOPPY_LAST 15 // last one
#define BX_READ 10

View File

@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.cc,v 1.42 2002-06-26 14:42:35 cbothamy Exp $
// $Id: siminterface.cc,v 1.43 2002-08-01 07:34:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
/*
* gui/siminterface.cc
* $Id: siminterface.cc,v 1.42 2002-06-26 14:42:35 cbothamy Exp $
* $Id: siminterface.cc,v 1.43 2002-08-01 07:34:59 vruppert Exp $
*
* Defines the actual link between bx_simulator_interface_c methods
* and the simulator. This file includes bochs.h because it needs
@ -324,8 +324,8 @@ bx_real_sim_c::get_cdrom_options (int drive, bx_cdrom_options *out)
return 0;
}
char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K", NULL };
int n_floppy_type_names = 5;
char *floppy_type_names[] = { "none", "1.2M", "1.44M", "2.88M", "720K", "360K", NULL };
int n_floppy_type_names = 6;
char *floppy_status_names[] = { "ejected", "inserted", NULL };
int n_floppy_status_names = 2;
char *floppy_bootdisk_names[] = { "floppy", "hard","cdrom", NULL };
@ -338,7 +338,7 @@ int n_keyboard_type_names = 3;
char *
bx_real_sim_c::get_floppy_type_name (int type)
{
BX_ASSERT (type >= BX_FLOPPY_NONE && type <= BX_FLOPPY_720K);
BX_ASSERT (type >= BX_FLOPPY_NONE && type <= BX_FLOPPY_LAST);
type -= BX_FLOPPY_NONE;
return floppy_type_names[type];
}

View File

@ -1,10 +1,10 @@
/////////////////////////////////////////////////////////////////////////
// $Id: siminterface.h,v 1.40 2002-07-24 17:52:34 cbothamy Exp $
// $Id: siminterface.h,v 1.41 2002-08-01 07:34:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
/*
* gui/siminterface.h
* $Id: siminterface.h,v 1.40 2002-07-24 17:52:34 cbothamy Exp $
* $Id: siminterface.h,v 1.41 2002-08-01 07:34:59 vruppert Exp $
*
* Interface to the simulator, currently only used by control.cc.
* The base class bx_simulator_interface_c, contains only virtual functions
@ -530,7 +530,8 @@ public:
#define BX_FLOPPY_1_44 12 // 1.44M 3.5"
#define BX_FLOPPY_2_88 13 // 2.88M 3.5"
#define BX_FLOPPY_720K 14 // 720K 3.5"
#define BX_FLOPPY_LAST 14 // last legal value of floppy type
#define BX_FLOPPY_360K 15 // 360K 5.25"
#define BX_FLOPPY_LAST 15 // last legal value of floppy type
#define BX_FLOPPY_GUESS 20 // decide based on image size
extern char *floppy_type_names[];

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: floppy.cc,v 1.44 2002-07-26 16:39:18 vruppert Exp $
// $Id: floppy.cc,v 1.45 2002-08-01 07:34:59 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -89,7 +89,7 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
{
Bit8u i;
BX_DEBUG(("Init $Id: floppy.cc,v 1.44 2002-07-26 16:39:18 vruppert Exp $"));
BX_DEBUG(("Init $Id: floppy.cc,v 1.45 2002-08-01 07:34:59 vruppert Exp $"));
BX_FD_THIS devices = d;
BX_REGISTER_DMA8_CHANNEL(2, bx_floppy.dma_read, bx_floppy.dma_write, "Floppy Drive");
@ -124,6 +124,9 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
case BX_FLOPPY_NONE:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x00;
break;
case BX_FLOPPY_360K:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x10;
break;
case BX_FLOPPY_1_2:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0x0f) | 0x20;
break;
@ -170,6 +173,9 @@ bx_floppy_ctrl_c::init(bx_devices_c *d, bx_cmos_c *cmos)
case BX_FLOPPY_NONE:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0xf0) | 0x00;
break;
case BX_FLOPPY_360K:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0xf0) | 0x01;
break;
case BX_FLOPPY_1_2:
cmos->s.reg[0x10] = (cmos->s.reg[0x10] & 0xf0) | 0x02;
break;
@ -1510,6 +1516,12 @@ bx_floppy_ctrl_c::evaluate_media(unsigned type, char *path, floppy_t *media)
if ( S_ISREG(stat_buf.st_mode) ) {
// regular file
switch (type) {
case BX_FLOPPY_360K: // 360K 5.25"
media->type = BX_FLOPPY_360K;
media->sectors_per_track = 9;
media->tracks = 40;
media->heads = 2;
break;
case BX_FLOPPY_720K: // 720K 3.5"
media->type = BX_FLOPPY_720K;
media->sectors_per_track = 9;
@ -1568,6 +1580,12 @@ bx_floppy_ctrl_c::evaluate_media(unsigned type, char *path, floppy_t *media)
// character or block device
// assume media is formatted to typical geometry for drive
switch (type) {
case BX_FLOPPY_360K: // 360K 5.25"
media->type = BX_FLOPPY_360K;
media->sectors_per_track = 9;
media->tracks = 40;
media->heads = 2;
break;
case BX_FLOPPY_720K: // 720K 3.5"
media->type = BX_FLOPPY_720K;
media->sectors_per_track = 9;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.107 2002-07-24 17:52:34 cbothamy Exp $
// $Id: main.cc,v 1.108 2002-08-01 07:34:58 vruppert Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -1632,6 +1632,10 @@ parse_line_formatted(char *context, int num_params, char *params[])
bx_options.floppya.Opath->set (&params[i][5]);
bx_options.floppya.Otype->set (BX_FLOPPY_720K);
}
else if (!strncmp(params[i], "360k=", 5)) {
bx_options.floppya.Opath->set (&params[i][5]);
bx_options.floppya.Otype->set (BX_FLOPPY_360K);
}
else if (!strncmp(params[i], "status=ejected", 14)) {
bx_options.floppya.Oinitial_status->set (BX_EJECTED);
}
@ -1663,6 +1667,10 @@ parse_line_formatted(char *context, int num_params, char *params[])
bx_options.floppyb.Opath->set (&params[i][5]);
bx_options.floppyb.Otype->set (BX_FLOPPY_720K);
}
else if (!strncmp(params[i], "360k=", 5)) {
bx_options.floppyb.Opath->set (&params[i][5]);
bx_options.floppyb.Otype->set (BX_FLOPPY_360K);
}
else if (!strncmp(params[i], "status=ejected", 14)) {
bx_options.floppyb.Oinitial_status->set (BX_EJECTED);
}
@ -2335,7 +2343,7 @@ parse_line_formatted(char *context, int num_params, char *params[])
}
static char *fdtypes[] = {
"none", "1_2", "1_44", "2_88", "720k"
"none", "1_2", "1_44", "2_88", "720k", "360k"
};
int

View File

@ -1,6 +1,6 @@
/*
* misc/bximage.c
* $Id: bximage.c,v 1.7 2002-05-21 07:23:09 cbothamy Exp $
* $Id: bximage.c,v 1.8 2002-08-01 07:35:00 vruppert Exp $
*
* Create empty hard disk or floppy disk images for bochs.
*
@ -14,7 +14,7 @@
#include "config.h"
char *EOF_ERR = "ERROR: End of input";
char *rcsid = "$Id: bximage.c,v 1.7 2002-05-21 07:23:09 cbothamy Exp $";
char *rcsid = "$Id: bximage.c,v 1.8 2002-08-01 07:35:00 vruppert Exp $";
char *divider = "========================================================================";
/* menu data for choosing floppy/hard disk */
@ -23,9 +23,9 @@ char *fdhd_choices[] = { "fd", "hd" };
int fdhd_n_choices = 2;
/* menu data for choosing floppy size */
char *fdsize_menu = "\nChoose the size of floppy disk image to create, in megabytes.\nPlease type 0.72, 1.2, 1.44, or 2.88. [1.44] ";
char *fdsize_choices[] = { "0.72","1.2","1.44","2.88" };
int fdsize_n_choices = 4;
char *fdsize_menu = "\nChoose the size of floppy disk image to create, in megabytes.\nPlease type 0.36, 0.72, 1.2, 1.44, or 2.88. [1.44] ";
char *fdsize_choices[] = { "0.36","0.72","1.2","1.44","2.88" };
int fdsize_n_choices = 5;
/* stolen from main.cc */
void bx_center_print (FILE *file, char *line, int maxwidth)
@ -267,13 +267,14 @@ int main()
} else {
int fdsize, cyl=0, heads=0, spt=0;
char *name = NULL;
if (ask_menu (fdsize_menu, fdsize_n_choices, fdsize_choices, 2, &fdsize) < 0)
if (ask_menu (fdsize_menu, fdsize_n_choices, fdsize_choices, 3, &fdsize) < 0)
fatal (EOF_ERR);
switch (fdsize) {
case 0: name="720k"; cyl=80; heads=2; spt=9; break; /* 0.72 meg */
case 1: name="1_2"; cyl=80; heads=2; spt=15; break; /* 1.2 meg */
case 2: name="1_44"; cyl=80; heads=2; spt=18; break; /* 1.44 meg */
case 3: name="2_88"; cyl=80; heads=2; spt=36; break; /* 2.88 meg */
case 0: name="360k"; cyl=40; heads=2; spt=9; break; /* 0.36 meg */
case 1: name="720k"; cyl=80; heads=2; spt=9; break; /* 0.72 meg */
case 2: name="1_2"; cyl=80; heads=2; spt=15; break; /* 1.2 meg */
case 3: name="1_44"; cyl=80; heads=2; spt=18; break; /* 1.44 meg */
case 4: name="2_88"; cyl=80; heads=2; spt=36; break; /* 2.88 meg */
default:
fatal ("ERROR: fdsize out of range");
}