bios indent cleanuip
This commit is contained in:
parent
23f1a49308
commit
522a47135f
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: rombios.c,v 1.227 2009-02-21 21:45:34 sshwarts Exp $
|
||||
// $Id: rombios.c,v 1.228 2009-04-03 15:53:46 sshwarts Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -620,7 +620,7 @@ typedef struct {
|
||||
Bit16u ticks_low;
|
||||
Bit16u ticks_high;
|
||||
Bit8u midnight_flag;
|
||||
} bios_data_t;
|
||||
} bios_data_t;
|
||||
|
||||
#define BiosData ((bios_data_t *) 0)
|
||||
|
||||
@ -689,7 +689,6 @@ typedef struct {
|
||||
// Count of transferred sectors and bytes
|
||||
Bit16u trsfsectors;
|
||||
Bit32u trsfbytes;
|
||||
|
||||
} ata_t;
|
||||
|
||||
#if BX_ELTORITO_BOOT
|
||||
@ -732,7 +731,6 @@ typedef struct {
|
||||
// El Torito Emulation data
|
||||
cdemu_t cdemu;
|
||||
#endif // BX_ELTORITO_BOOT
|
||||
|
||||
} ebda_data_t;
|
||||
|
||||
#define EbdaData ((ebda_data_t *) 0)
|
||||
@ -789,7 +787,7 @@ typedef struct {
|
||||
Bit8u bl, bh, dl, dh, cl, ch, al, ah;
|
||||
} r8;
|
||||
} u;
|
||||
} pusha_regs_t;
|
||||
} pusha_regs_t;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
@ -825,7 +823,7 @@ typedef struct {
|
||||
Bit8u flagsh;
|
||||
} r8;
|
||||
} u;
|
||||
} flags_t;
|
||||
} flags_t;
|
||||
|
||||
#define SetCF(x) x.u.r8.flagsl |= 0x01
|
||||
#define SetZF(x) x.u.r8.flagsl |= 0x40
|
||||
@ -837,7 +835,7 @@ typedef struct {
|
||||
Bit16u ip;
|
||||
Bit16u cs;
|
||||
flags_t flags;
|
||||
} iret_addr_t;
|
||||
} iret_addr_t;
|
||||
|
||||
typedef struct {
|
||||
Bit16u type;
|
||||
@ -845,8 +843,7 @@ typedef struct {
|
||||
Bit32u vector;
|
||||
Bit32u description;
|
||||
Bit32u reserved;
|
||||
} ipl_entry_t;
|
||||
|
||||
} ipl_entry_t;
|
||||
|
||||
|
||||
static Bit8u inb();
|
||||
@ -940,7 +937,7 @@ Bit16u cdrom_boot();
|
||||
|
||||
#endif // BX_ELTORITO_BOOT
|
||||
|
||||
static char bios_cvs_version_string[] = "$Revision: 1.227 $ $Date: 2009-02-21 21:45:34 $";
|
||||
static char bios_cvs_version_string[] = "$Revision: 1.228 $ $Date: 2009-04-03 15:53:46 $";
|
||||
|
||||
#define BIOS_COPYRIGHT_STRING "(c) 2002 MandrakeSoft S.A. Written by Kevin Lawton & the Bochs team."
|
||||
|
||||
@ -2082,6 +2079,7 @@ interactive_bootkey()
|
||||
write_word(IPL_SEG, IPL_BOOTFIRST_OFFSET, scan_code);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
@ -2626,6 +2624,7 @@ void ata_detect( )
|
||||
BX_INFO("r-echs");
|
||||
break;
|
||||
}
|
||||
|
||||
switch (translation) {
|
||||
case ATA_TRANSLATION_NONE:
|
||||
break;
|
||||
@ -2658,6 +2657,7 @@ void ata_detect( )
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// clip to 1024 cylinders in lchs
|
||||
if (cylinders > 1024) cylinders=1024;
|
||||
BX_INFO(" LCHS=%d/%d/%d\n", cylinders, heads, spt);
|
||||
@ -2717,7 +2717,7 @@ void ata_detect( )
|
||||
}
|
||||
|
||||
// Read model name
|
||||
for(i=0;i<20;i++){
|
||||
for(i=0;i<20;i++) {
|
||||
write_byte(get_SS(),model+(i*2),read_byte(get_SS(),buffer+(i*2)+54+1));
|
||||
write_byte(get_SS(),model+(i*2)+1,read_byte(get_SS(),buffer+(i*2)+54));
|
||||
}
|
||||
@ -2741,7 +2741,9 @@ void ata_detect( )
|
||||
switch (type) {
|
||||
case ATA_TYPE_ATA:
|
||||
printf("ata%d %s: ",channel,slave?" slave":"master");
|
||||
i=0; while(c=read_byte(get_SS(),model+i++)) printf("%c",c);
|
||||
i=0;
|
||||
while(c=read_byte(get_SS(),model+i++))
|
||||
printf("%c",c);
|
||||
if (sizeinmb < (1UL<<16))
|
||||
printf(" ATA-%d Hard-Disk (%4u MBytes)\n", version, (Bit16u)sizeinmb);
|
||||
else
|
||||
@ -3247,6 +3249,7 @@ ASM_END
|
||||
else {
|
||||
Bit16u loops = 0;
|
||||
Bit8u sc;
|
||||
|
||||
while (1) {
|
||||
|
||||
if (loops == 0) {//first time through
|
||||
@ -3620,12 +3623,12 @@ cdrom_boot()
|
||||
return 3;
|
||||
|
||||
// Validity checks
|
||||
if(buffer[0]!=0)return 4;
|
||||
if(buffer[0]!=0) return 4;
|
||||
for(i=0;i<5;i++){
|
||||
if(buffer[1+i]!=read_byte(0xf000,&isotag[i]))return 5;
|
||||
if(buffer[1+i]!=read_byte(0xf000,&isotag[i])) return 5;
|
||||
}
|
||||
for(i=0;i<23;i++)
|
||||
if(buffer[7+i]!=read_byte(0xf000,&eltorito[i]))return 6;
|
||||
if(buffer[7+i]!=read_byte(0xf000,&eltorito[i])) return 6;
|
||||
|
||||
// ok, now we calculate the Boot catalog address
|
||||
lba=buffer[0x4A]*0x1000000+buffer[0x49]*0x10000+buffer[0x48]*0x100+buffer[0x47];
|
||||
@ -3722,7 +3725,6 @@ cdrom_boot()
|
||||
write_byte(ebda_seg, &EbdaData->ata.hdcount, read_byte(ebda_seg, &EbdaData->ata.hdcount) + 1);
|
||||
}
|
||||
|
||||
|
||||
// everything is ok, so from now on, the emulation is active
|
||||
if(read_byte(ebda_seg,&EbdaData->cdemu.media)!=0)
|
||||
write_byte(ebda_seg,&EbdaData->cdemu.active,0x01);
|
||||
@ -4349,11 +4351,11 @@ BX_DEBUG_INT15("case 6:\n");
|
||||
BX_PANIC("Mouse status returned %02x (should be ack)\n", (unsigned)mouse_data1);
|
||||
if (ret == 0) {
|
||||
ret = get_mouse_data(&mouse_data1);
|
||||
if ( ret == 0 ) {
|
||||
if (ret == 0) {
|
||||
ret = get_mouse_data(&mouse_data2);
|
||||
if ( ret == 0 ) {
|
||||
if (ret == 0) {
|
||||
ret = get_mouse_data(&mouse_data3);
|
||||
if ( ret == 0 ) {
|
||||
if (ret == 0) {
|
||||
CLEAR_CF();
|
||||
regs.u.r8.ah = 0;
|
||||
regs.u.r8.bl = mouse_data1;
|
||||
@ -4525,8 +4527,7 @@ ASM_END
|
||||
break;
|
||||
|
||||
case 0xe8:
|
||||
switch(regs.u.r8.al)
|
||||
{
|
||||
switch(regs.u.r8.al) {
|
||||
case 0x20: // coded by osmaker aka K.J.
|
||||
if(regs.u.r32.edx == 0x534D4150)
|
||||
{
|
||||
@ -4577,7 +4578,7 @@ ASM_END
|
||||
#if BX_ROMBIOS32
|
||||
set_e820_range(ES, regs.u.r16.di,
|
||||
0x00100000L,
|
||||
extended_memory_size - ACPI_DATA_SIZE ,0, 0, 1);
|
||||
extended_memory_size - ACPI_DATA_SIZE, 0, 0, 1);
|
||||
regs.u.r32.ebx = 4;
|
||||
#else
|
||||
set_e820_range(ES, regs.u.r16.di,
|
||||
@ -4589,13 +4590,13 @@ ASM_END
|
||||
case 4:
|
||||
set_e820_range(ES, regs.u.r16.di,
|
||||
extended_memory_size - ACPI_DATA_SIZE,
|
||||
extended_memory_size ,0, 0, 3); // ACPI RAM
|
||||
extended_memory_size, 0, 0, 3); // ACPI RAM
|
||||
regs.u.r32.ebx = 5;
|
||||
break;
|
||||
case 5:
|
||||
/* 256KB BIOS area at the end of 4 GB */
|
||||
set_e820_range(ES, regs.u.r16.di,
|
||||
0xfffc0000L, 0x00000000L ,0, 0, 2);
|
||||
0xfffc0000L, 0x00000000L, 0, 0, 2);
|
||||
if (extra_highbits_memory_size || extra_lowbits_memory_size)
|
||||
regs.u.r32.ebx = 6;
|
||||
else
|
||||
@ -4919,8 +4920,7 @@ get_mouse_data(data)
|
||||
Bit8u response;
|
||||
Bit16u ss;
|
||||
|
||||
while ( (inb(0x64) & 0x21) != 0x21 ) {
|
||||
}
|
||||
while ((inb(0x64) & 0x21) != 0x21) { }
|
||||
|
||||
response = inb(0x60);
|
||||
|
||||
@ -5157,7 +5157,6 @@ enqueue_key(scan_code, ascii_code)
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
int74_function(make_farcall, Z, Y, X, status)
|
||||
Bit16u make_farcall, Z, Y, X, status;
|
||||
@ -5170,16 +5169,17 @@ BX_DEBUG_INT74("entering int74_function\n");
|
||||
make_farcall = 0;
|
||||
|
||||
in_byte = inb(0x64);
|
||||
if ( (in_byte & 0x21) != 0x21 ) {
|
||||
if ((in_byte & 0x21) != 0x21) {
|
||||
return;
|
||||
}
|
||||
|
||||
in_byte = inb(0x60);
|
||||
BX_DEBUG_INT74("int74: read byte %02x\n", in_byte);
|
||||
|
||||
mouse_flags_1 = read_byte(ebda_seg, 0x0026);
|
||||
mouse_flags_2 = read_byte(ebda_seg, 0x0027);
|
||||
|
||||
if ( (mouse_flags_2 & 0x80) != 0x80 ) {
|
||||
if ((mouse_flags_2 & 0x80) != 0x80) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5278,13 +5278,13 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
nlspt = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.spt);
|
||||
|
||||
// sanity check on cyl heads, sec
|
||||
if( (cylinder >= nlc) || (head >= nlh) || (sector > nlspt )) {
|
||||
if( (cylinder >= nlc) || (head >= nlh) || (sector > nlspt) ) {
|
||||
BX_INFO("int13_harddisk: function %02x, parameters out of range %04x/%04x/%04x!\n", GET_AH(), cylinder, head, sector);
|
||||
goto int13_fail;
|
||||
}
|
||||
|
||||
// FIXME verify
|
||||
if ( GET_AH() == 0x04 ) goto int13_success;
|
||||
if (GET_AH() == 0x04) goto int13_success;
|
||||
|
||||
nph = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.heads);
|
||||
npspt = read_word(ebda_seg, &EbdaData->ata.devices[device].pchs.spt);
|
||||
@ -5296,7 +5296,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
sector = 0; // this forces the command to be lba
|
||||
}
|
||||
|
||||
if ( GET_AH() == 0x02 )
|
||||
if (GET_AH() == 0x02)
|
||||
status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS, count, cylinder, head, sector, lba_low, lba_high, segment, offset);
|
||||
else
|
||||
status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS, count, cylinder, head, sector, lba_low, lba_high, segment, offset);
|
||||
@ -5327,7 +5327,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
nlspt = read_word(ebda_seg, &EbdaData->ata.devices[device].lchs.spt);
|
||||
count = read_byte(ebda_seg, &EbdaData->ata.hdcount);
|
||||
|
||||
nlc = nlc - 2; /* 0 based , last sector not used */
|
||||
nlc = nlc - 2; /* 0 based, last sector not used */
|
||||
SET_AL(0);
|
||||
SET_CH(nlc & 0xff);
|
||||
SET_CL(((nlc >> 2) & 0xc0) | (nlspt & 0x3f));
|
||||
@ -5344,7 +5344,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
|
||||
// Read the status from controller
|
||||
status = inb(read_word(ebda_seg, &EbdaData->ata.channels[device/2].iobase1) + ATA_CB_STAT);
|
||||
if ( (status & ( ATA_CB_STAT_BSY | ATA_CB_STAT_RDY )) == ATA_CB_STAT_RDY ) {
|
||||
if ( (status & (ATA_CB_STAT_BSY | ATA_CB_STAT_RDY)) == ATA_CB_STAT_RDY ) {
|
||||
goto int13_success;
|
||||
}
|
||||
else {
|
||||
@ -5405,7 +5405,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
goto int13_success;
|
||||
|
||||
// Execute the command
|
||||
if ( GET_AH() == 0x42 )
|
||||
if (GET_AH() == 0x42)
|
||||
status=ata_cmd_data_in(device, ATA_CMD_READ_SECTORS, count, 0, 0, 0, lba_low, lba_high, segment, offset);
|
||||
else
|
||||
status=ata_cmd_data_out(device, ATA_CMD_WRITE_SECTORS, count, 0, 0, 0, lba_low, lba_high, segment, offset);
|
||||
@ -5573,7 +5573,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
case 0x06:
|
||||
goto int13_success;
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
goto int13_fail;
|
||||
}
|
||||
break;
|
||||
@ -5610,7 +5610,6 @@ int13_success:
|
||||
int13_success_noah:
|
||||
SET_DISK_RET_STATUS(0x00);
|
||||
CLEAR_CF(); // no error
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -5709,7 +5708,7 @@ int13_cdrom(EHBX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
lba=read_dword(DS, SI+(Bit16u)&Int13Ext->lba1);
|
||||
|
||||
// If verify or seek
|
||||
if (( GET_AH() == 0x44 ) || ( GET_AH() == 0x47 ))
|
||||
if ((GET_AH() == 0x44) || (GET_AH() == 0x47))
|
||||
goto int13_success;
|
||||
|
||||
memsetb(get_SS(),atacmd,0,12);
|
||||
@ -5762,6 +5761,7 @@ int13_cdrom(EHBX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
SET_AL(locks==0?0:1);
|
||||
break;
|
||||
}
|
||||
|
||||
goto int13_success;
|
||||
break;
|
||||
|
||||
@ -5927,7 +5927,7 @@ int13_cdrom_rme_end:
|
||||
case 0x06:
|
||||
goto int13_success;
|
||||
break;
|
||||
default :
|
||||
default:
|
||||
goto int13_fail;
|
||||
}
|
||||
break;
|
||||
@ -5959,7 +5959,6 @@ int13_success:
|
||||
int13_success_noah:
|
||||
SET_DISK_RET_STATUS(0x00);
|
||||
CLEAR_CF(); // no error
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -6030,7 +6029,6 @@ int13_success:
|
||||
SET_AH(0x00); // no error
|
||||
SET_DISK_RET_STATUS(0x00);
|
||||
CLEAR_CF(); // no error
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -6064,8 +6062,8 @@ int13_cdemu(DS, ES, DI, SI, BP, SP, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
SET_DISK_RET_STATUS(0x00);
|
||||
|
||||
/* basic checks : emulation should be active, dl should equal the emulated drive */
|
||||
if( (read_byte(ebda_seg,&EbdaData->cdemu.active) ==0 )
|
||||
|| (read_byte(ebda_seg,&EbdaData->cdemu.emulated_drive ) != GET_DL())) {
|
||||
if( (read_byte(ebda_seg,&EbdaData->cdemu.active) ==0) ||
|
||||
(read_byte(ebda_seg,&EbdaData->cdemu.emulated_drive ) != GET_DL())) {
|
||||
BX_INFO("int13_cdemu: function %02x, emulation not active for DL= %02x\n", GET_AH(), GET_DL());
|
||||
goto int13_fail;
|
||||
}
|
||||
@ -6168,12 +6166,12 @@ int13_cdemu(DS, ES, DI, SI, BP, SP, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
vcylinders=read_word(ebda_seg,&EbdaData->cdemu.vdevice.cylinders) - 1;
|
||||
vheads=read_word(ebda_seg,&EbdaData->cdemu.vdevice.heads) - 1;
|
||||
|
||||
SET_AL( 0x00 );
|
||||
SET_BL( 0x00 );
|
||||
SET_CH( vcylinders & 0xff );
|
||||
SET_CL((( vcylinders >> 2) & 0xc0) | ( vspt & 0x3f ));
|
||||
SET_DH( vheads );
|
||||
SET_DL( 0x02 ); // FIXME ElTorito Various. should send the real count of drives 1 or 2
|
||||
SET_AL(0x00);
|
||||
SET_BL(0x00);
|
||||
SET_CH(vcylinders & 0xff);
|
||||
SET_CL(((vcylinders >> 2) & 0xc0) | (vspt & 0x3f));
|
||||
SET_DH(vheads);
|
||||
SET_DL(0x02); // FIXME ElTorito Various. should send the real count of drives 1 or 2
|
||||
// FIXME ElTorito Harddisk. should send the HD count
|
||||
|
||||
switch(read_byte(ebda_seg,&EbdaData->cdemu.media)) {
|
||||
@ -6234,7 +6232,6 @@ int13_success:
|
||||
int13_success_noah:
|
||||
SET_DISK_RET_STATUS(0x00);
|
||||
CLEAR_CF(); // no error
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -6330,8 +6327,7 @@ int13_harddisk(EHAX, DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
drive_map = inb_cmos(0x12);
|
||||
drive_map = (((drive_map & 0xf0)==0) ? 0 : 1) |
|
||||
(((drive_map & 0x0f)==0) ? 0 : 2);
|
||||
n_drives = (drive_map==0) ? 0 :
|
||||
((drive_map==3) ? 2 : 1);
|
||||
n_drives = (drive_map==0) ? 0 : ((drive_map==3) ? 2 : 1);
|
||||
|
||||
if (!(drive_map & (1<<(GET_ELDL()&0x7f)))) { /* allow 0, 1, or 2 disks */
|
||||
SET_AH(0x01);
|
||||
@ -6438,12 +6434,12 @@ BX_DEBUG_INT13_HD("CHS: %x %x %x\n", cylinder, head, sector);
|
||||
|
||||
while (1) {
|
||||
status = inb(0x1f7);
|
||||
if ( !(status & 0x80) ) break;
|
||||
if (!(status & 0x80)) break;
|
||||
}
|
||||
|
||||
if (status & 0x01) {
|
||||
BX_PANIC("hard drive BIOS:(read/verify) read error\n");
|
||||
} else if ( !(status & 0x08) ) {
|
||||
} else if (!(status & 0x08)) {
|
||||
BX_DEBUG_INT13_HD("status was %02x\n", (unsigned) status);
|
||||
BX_PANIC("hard drive BIOS:(read/verify) expected DRQ=1\n");
|
||||
}
|
||||
@ -6491,13 +6487,13 @@ ASM_END
|
||||
num_sectors--;
|
||||
if (num_sectors == 0) {
|
||||
status = inb(0x1f7);
|
||||
if ( (status & 0xc9) != 0x40 )
|
||||
if ((status & 0xc9) != 0x40)
|
||||
BX_PANIC("no sectors left to read/verify, status is %02x\n", (unsigned) status);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
status = inb(0x1f7);
|
||||
if ( (status & 0xc9) != 0x48 )
|
||||
if ((status & 0xc9) != 0x48)
|
||||
BX_PANIC("more sectors left to read/verify, status is %02x\n", (unsigned) status);
|
||||
continue;
|
||||
}
|
||||
@ -6510,7 +6506,6 @@ ASM_END
|
||||
return;
|
||||
break;
|
||||
|
||||
|
||||
case 0x03: /* write disk sectors */
|
||||
BX_DEBUG_INT13_HD("int13_f03\n");
|
||||
drive = GET_ELDL ();
|
||||
@ -6545,7 +6540,7 @@ BX_DEBUG_INT13_HD("int13_f03\n");
|
||||
if ( (cylinder >= hd_cylinders) ||
|
||||
(sector > hd_sectors) ||
|
||||
(head >= hd_heads) ) {
|
||||
SET_AH( 1);
|
||||
SET_AH(1);
|
||||
SET_DISK_RET_STATUS(1);
|
||||
SET_CF(); /* error occurred */
|
||||
return;
|
||||
@ -6580,10 +6575,10 @@ BX_DEBUG_INT13_HD("CHS (write): %x %x %x\n", cylinder, head, sector);
|
||||
// wait for busy bit to turn off after seeking
|
||||
while (1) {
|
||||
status = inb(0x1f7);
|
||||
if ( !(status & 0x80) ) break;
|
||||
if (!(status & 0x80)) break;
|
||||
}
|
||||
|
||||
if ( !(status & 0x08) ) {
|
||||
if (!(status & 0x08)) {
|
||||
BX_DEBUG_INT13_HD("status was %02x\n", (unsigned) status);
|
||||
BX_PANIC("hard drive BIOS:(write) data-request bit not set\n");
|
||||
}
|
||||
@ -6631,13 +6626,13 @@ ASM_END
|
||||
num_sectors--;
|
||||
if (num_sectors == 0) {
|
||||
status = inb(0x1f7);
|
||||
if ( (status & 0xe9) != 0x40 )
|
||||
if ((status & 0xe9) != 0x40)
|
||||
BX_PANIC("no sectors left to write, status is %02x\n", (unsigned) status);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
status = inb(0x1f7);
|
||||
if ( (status & 0xc9) != 0x48 )
|
||||
if ((status & 0xc9) != 0x48)
|
||||
BX_PANIC("more sectors left to write, status is %02x\n", (unsigned) status);
|
||||
continue;
|
||||
}
|
||||
@ -6745,7 +6740,7 @@ BX_DEBUG_INT13_HD("int13_f10\n");
|
||||
|
||||
// should look at 40:8E also???
|
||||
status = inb(0x01f7);
|
||||
if ( (status & 0xc0) == 0x40 ) {
|
||||
if ((status & 0xc0) == 0x40) {
|
||||
SET_AH(0);
|
||||
SET_DISK_RET_STATUS(0);
|
||||
CLEAR_CF(); // drive ready
|
||||
@ -6818,7 +6813,6 @@ ASM_END
|
||||
SET_DISK_RET_STATUS(1);
|
||||
SET_CF(); /* unsuccessful */
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6887,7 +6881,7 @@ void floppy_reset_controller()
|
||||
// Wait for controller to come out of reset
|
||||
do {
|
||||
val8 = inb(0x3f4);
|
||||
} while ( (val8 & 0xc0) != 0x80 );
|
||||
} while ((val8 & 0xc0) != 0x80);
|
||||
}
|
||||
|
||||
void floppy_prepare_controller(drive)
|
||||
@ -7006,61 +7000,61 @@ floppy_media_sense(drive)
|
||||
// 111 all other formats/drives
|
||||
|
||||
drive_type = inb_cmos(0x10);
|
||||
|
||||
if (drive == 0)
|
||||
drive_type >>= 4;
|
||||
else
|
||||
drive_type &= 0x0f;
|
||||
if ( drive_type == 1 ) {
|
||||
|
||||
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 ) {
|
||||
else if (drive_type == 2) {
|
||||
// 1.2 MB 5.25" drive
|
||||
config_data = 0x00; // 0000 0000
|
||||
media_state = 0x25; // 0010 0101 // need double stepping??? (bit 5)
|
||||
retval = 1;
|
||||
}
|
||||
else if ( drive_type == 3 ) {
|
||||
else if (drive_type == 3) {
|
||||
// 720K 3.5" drive
|
||||
config_data = 0x00; // 0000 0000 ???
|
||||
media_state = 0x17; // 0001 0111
|
||||
retval = 1;
|
||||
}
|
||||
else if ( drive_type == 4 ) {
|
||||
else if (drive_type == 4) {
|
||||
// 1.44 MB 3.5" drive
|
||||
config_data = 0x00; // 0000 0000
|
||||
media_state = 0x17; // 0001 0111
|
||||
retval = 1;
|
||||
}
|
||||
else if ( drive_type == 5 ) {
|
||||
else if (drive_type == 5) {
|
||||
// 2.88 MB 3.5" drive
|
||||
config_data = 0xCC; // 1100 1100
|
||||
media_state = 0xD7; // 1101 0111
|
||||
retval = 1;
|
||||
}
|
||||
//
|
||||
// Extended floppy size uses special cmos setting
|
||||
else if ( drive_type == 6 ) {
|
||||
else if (drive_type == 6) {
|
||||
// 160k 5.25" drive
|
||||
config_data = 0x00; // 0000 0000
|
||||
media_state = 0x27; // 0010 0111
|
||||
retval = 1;
|
||||
}
|
||||
else if ( drive_type == 7 ) {
|
||||
else if (drive_type == 7) {
|
||||
// 180k 5.25" drive
|
||||
config_data = 0x00; // 0000 0000
|
||||
media_state = 0x27; // 0010 0111
|
||||
retval = 1;
|
||||
}
|
||||
else if ( drive_type == 8 ) {
|
||||
else if (drive_type == 8) {
|
||||
// 320k 5.25" drive
|
||||
config_data = 0x00; // 0000 0000
|
||||
media_state = 0x27; // 0010 0111
|
||||
retval = 1;
|
||||
}
|
||||
|
||||
else {
|
||||
// not recognized
|
||||
config_data = 0x00; // 0000 0000
|
||||
@ -7123,8 +7117,6 @@ ASM_END
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bx_bool
|
||||
floppy_drive_exists(drive)
|
||||
Bit16u drive;
|
||||
@ -7831,12 +7823,12 @@ BX_DEBUG_INT13_FL("floppy f18\n");
|
||||
default:
|
||||
BX_INFO("int13_diskette: unsupported AH=%02x\n", GET_AH());
|
||||
|
||||
// if ( (ah==0x20) || ((ah>=0x41) && (ah<=0x49)) || (ah==0x4e) ) {
|
||||
// if ((ah==0x20) || ((ah>=0x41) && (ah<=0x49)) || (ah==0x4e)) {
|
||||
SET_AH(0x01); // ???
|
||||
set_diskette_ret_status(1);
|
||||
SET_CF();
|
||||
return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
#else // #if BX_SUPPORT_FLOPPY
|
||||
@ -7846,7 +7838,7 @@ int13_diskette_function(DS, ES, DI, SI, BP, ELDX, BX, DX, CX, AX, IP, CS, FLAGS)
|
||||
{
|
||||
Bit8u val8;
|
||||
|
||||
switch ( GET_AH() ) {
|
||||
switch (GET_AH()) {
|
||||
|
||||
case 0x01: // Read Diskette Status
|
||||
CLEAR_CF();
|
||||
@ -7904,7 +7896,7 @@ determine_floppy_media(drive)
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( (ctrl_info & 0x04) != 0x04 ) {
|
||||
if ((ctrl_info & 0x04) != 0x04) {
|
||||
// Drive not determined means no drive exists, done.
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user