mirror of
https://github.com/holub/mame
synced 2025-04-23 08:49:55 +03:00
Sync with MESS (no whatsnew)
This commit is contained in:
parent
ba4321da0b
commit
86d811c58a
@ -1289,7 +1289,9 @@ static UINT32 ide_controller_read(device_t *device, int bank, offs_t offset, int
|
||||
if (ide->drive[ide->cur_drive].slot->is_ready()) {
|
||||
ide->status |= IDE_STATUS_DRIVE_READY;
|
||||
} else {
|
||||
ide->status &= ~IDE_STATUS_DRIVE_READY;
|
||||
ide->status |= IDE_STATUS_DRIVE_READY;
|
||||
ide->status |= IDE_STATUS_ERROR;
|
||||
ide->error = IDE_ERROR_DEFAULT;
|
||||
}
|
||||
|
||||
switch (BANK(bank, offset))
|
||||
|
@ -36,6 +36,37 @@ enum
|
||||
FM_ERASEAMD4, // part 4 of AMD erase sequence
|
||||
FM_BYTEPROGRAM,
|
||||
FM_BANKSELECT,
|
||||
FM_WRITEPAGEATMEL
|
||||
};
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
MFG_ALLIANCE = 0x52,
|
||||
MFG_AMD = 0x01,
|
||||
MFG_AMIC = 0x37,
|
||||
MFG_ATMEL = 0x1f,
|
||||
MFG_BRIGHT = 0xad,
|
||||
MFG_CATALYST = 0x31,
|
||||
MFG_EON = 0x1c,
|
||||
MFG_FUJITSU = 0x04,
|
||||
MFG_GIGADEVICE = 0xc8,
|
||||
MFG_HYUNDAI = 0xad,
|
||||
MFG_INTEL = 0x89,
|
||||
MFG_ISSI = 0xd5,
|
||||
MFG_MACRONIX = 0xc2,
|
||||
MFG_PANASONIC = 0x32,
|
||||
MFG_PMC = 0x9d,
|
||||
MFG_SANYO = 0x62,
|
||||
MFG_SHARP = 0xb0,
|
||||
MFG_SPANSION = 0x01,
|
||||
MFG_SST = 0xbf,
|
||||
MFG_ST = 0x20,
|
||||
MFG_SYNCMOS = 0x40,
|
||||
MFG_TI = 0x97,
|
||||
MFG_TI_OLD = 0x01,
|
||||
MFG_WINBOND_NEX = 0xef,
|
||||
MFG_WINBOND = 0xda
|
||||
};
|
||||
|
||||
|
||||
@ -130,28 +161,29 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type
|
||||
case FLASH_SHARP_LH28F016S:
|
||||
m_bits = 8;
|
||||
m_size = 0x200000;
|
||||
m_maker_id = 0x89;
|
||||
m_maker_id = MFG_INTEL;
|
||||
m_device_id = 0xaa;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_16Mb );
|
||||
break;
|
||||
case FLASH_ATMEL_29C010:
|
||||
m_bits = 8;
|
||||
m_size = 0x20000;
|
||||
m_maker_id = 0x1f;
|
||||
m_page_size = 0x80;
|
||||
m_maker_id = MFG_ATMEL;
|
||||
m_device_id = 0xd5;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_1Mb );
|
||||
break;
|
||||
case FLASH_AMD_29F040:
|
||||
m_bits = 8;
|
||||
m_size = 0x80000;
|
||||
m_maker_id = 0x01;
|
||||
m_maker_id = MFG_AMD;
|
||||
m_device_id = 0xa4;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_4Mb );
|
||||
break;
|
||||
case FLASH_AMD_29F080:
|
||||
m_bits = 8;
|
||||
m_size = 0x100000;
|
||||
m_maker_id = 0x01;
|
||||
m_maker_id = MFG_AMD;
|
||||
m_device_id = 0xd5;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_8Mb );
|
||||
break;
|
||||
@ -159,56 +191,56 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type
|
||||
case FLASH_INTEL_E28F400:
|
||||
m_bits = 16;
|
||||
m_size = 0x80000;
|
||||
m_maker_id = 0xb0;
|
||||
m_maker_id = MFG_SHARP;
|
||||
m_device_id = 0xed;
|
||||
map = ADDRESS_MAP_NAME( memory_map16_4Mb );
|
||||
break;
|
||||
case FLASH_FUJITSU_29F016A:
|
||||
m_bits = 8;
|
||||
m_size = 0x200000;
|
||||
m_maker_id = 0x04;
|
||||
m_maker_id = MFG_FUJITSU;
|
||||
m_device_id = 0xad;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_16Mb );
|
||||
break;
|
||||
case FLASH_FUJITSU_29DL16X:
|
||||
m_bits = 8;
|
||||
m_size = 0x200000;
|
||||
m_maker_id = 0x04;
|
||||
m_maker_id = MFG_FUJITSU;
|
||||
m_device_id = 0x35;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_16Mb );
|
||||
break;
|
||||
case FLASH_INTEL_E28F008SA:
|
||||
m_bits = 8;
|
||||
m_size = 0x100000;
|
||||
m_maker_id = 0x89;
|
||||
m_maker_id = MFG_INTEL;
|
||||
m_device_id = 0xa2;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_8Mb );
|
||||
break;
|
||||
case FLASH_INTEL_TE28F160:
|
||||
m_bits = 16;
|
||||
m_size = 0x200000;
|
||||
m_maker_id = 0xb0;
|
||||
m_maker_id = MFG_SHARP;
|
||||
m_device_id = 0xd0;
|
||||
map = ADDRESS_MAP_NAME( memory_map16_16Mb );
|
||||
break;
|
||||
case FLASH_SHARP_UNK128MBIT:
|
||||
m_bits = 16;
|
||||
m_size = 0x800000;
|
||||
m_maker_id = 0xb0;
|
||||
m_maker_id = MFG_SHARP;
|
||||
m_device_id = 0xb0;
|
||||
map = ADDRESS_MAP_NAME( memory_map16_64Mb );
|
||||
break;
|
||||
case FLASH_MACRONIX_29L001MC:
|
||||
m_bits = 8;
|
||||
m_size = 0x20000;
|
||||
m_maker_id = 0xc2;
|
||||
m_maker_id = MFG_MACRONIX;
|
||||
m_device_id = 0x51;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_1Mb );
|
||||
break;
|
||||
case FLASH_PANASONIC_MN63F805MNP:
|
||||
m_bits = 8;
|
||||
m_size = 0x10000;
|
||||
m_maker_id = 0x32;
|
||||
m_maker_id = MFG_PANASONIC;
|
||||
m_device_id = 0x1b;
|
||||
m_sector_is_4k = true;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_512Kb );
|
||||
@ -216,7 +248,7 @@ intelfsh_device::intelfsh_device(const machine_config &mconfig, device_type type
|
||||
case FLASH_SANYO_LE26FV10N1TS:
|
||||
m_bits = 8;
|
||||
m_size = 0x20000;
|
||||
m_maker_id = 0x62;
|
||||
m_maker_id = MFG_SANYO;
|
||||
m_device_id = 0x13;
|
||||
m_sector_is_4k = true;
|
||||
map = ADDRESS_MAP_NAME( memory_map8_1Mb );
|
||||
@ -492,7 +524,7 @@ UINT32 intelfsh_device::read_full(UINT32 address)
|
||||
break;
|
||||
}
|
||||
|
||||
// logerror( "intelflash_read( %d, %08x ) %08x\n", chip, address, data );
|
||||
//logerror( "intelflash_read( %08x ) %08x\n", address, data );
|
||||
|
||||
return data;
|
||||
}
|
||||
@ -505,7 +537,7 @@ UINT32 intelfsh_device::read_full(UINT32 address)
|
||||
|
||||
void intelfsh_device::write_full(UINT32 address, UINT32 data)
|
||||
{
|
||||
// logerror( "intelflash_write( %d, %08x, %08x )\n", chip, address, data );
|
||||
//logerror( "intelflash_write( %u : %08x, %08x )\n", m_flash_mode, address, data );
|
||||
|
||||
address += m_bank << 16;
|
||||
|
||||
@ -610,7 +642,15 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
|
||||
}
|
||||
else if( ( address & 0xffff ) == 0x5555 && ( data & 0xff ) == 0xa0 )
|
||||
{
|
||||
m_flash_mode = FM_BYTEPROGRAM;
|
||||
if (m_type == FLASH_ATMEL_29C010)
|
||||
{
|
||||
m_flash_mode = FM_WRITEPAGEATMEL;
|
||||
m_byte_count = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_flash_mode = FM_BYTEPROGRAM;
|
||||
}
|
||||
}
|
||||
else if( ( address & 0xfff ) == 0xaaa && ( data & 0xff ) == 0xa0 )
|
||||
{
|
||||
@ -770,6 +810,31 @@ void intelfsh_device::write_full(UINT32 address, UINT32 data)
|
||||
m_status = 0x80;
|
||||
m_flash_mode = FM_READSTATUS;
|
||||
break;
|
||||
case FM_WRITEPAGEATMEL:
|
||||
switch( m_bits )
|
||||
{
|
||||
case 8:
|
||||
{
|
||||
m_addrspace[0]->write_byte(address, data);
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
{
|
||||
m_addrspace[0]->write_word(address * 2, data);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
logerror( "FM_WRITEPAGEATMEL not supported when m_bits == %d\n", m_bits );
|
||||
break;
|
||||
}
|
||||
|
||||
m_byte_count++;
|
||||
|
||||
if (m_byte_count == m_page_size)
|
||||
{
|
||||
m_flash_mode = FM_NORMAL;
|
||||
}
|
||||
break;
|
||||
case FM_CLEARPART1:
|
||||
if( ( data & 0xff ) == 0xd0 )
|
||||
{
|
||||
|
@ -122,6 +122,7 @@ protected:
|
||||
UINT8 m_device_id;
|
||||
UINT8 m_maker_id;
|
||||
bool m_sector_is_4k;
|
||||
UINT8 m_page_size;
|
||||
|
||||
// internal state
|
||||
UINT8 m_status;
|
||||
@ -130,6 +131,7 @@ protected:
|
||||
bool m_flash_master_lock;
|
||||
emu_timer * m_timer;
|
||||
INT32 m_bank;
|
||||
UINT8 m_byte_count;
|
||||
};
|
||||
|
||||
|
||||
|
@ -664,6 +664,15 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
|
||||
{
|
||||
int g_tracks, g_heads;
|
||||
int visualgrid[16][35]; // visualizer grid, cleared/initialized below
|
||||
// lenient addr check: if unset, only accept an addr mark if the checksum was good
|
||||
// if set, accept an addr mark if the track and sector values are both sane
|
||||
#undef LENIENT_ADDR_CHECK
|
||||
// if set, use the old, not as robust logic for choosing which copy of a decoded sector to write
|
||||
// to the resulting image if the sector has a bad checksum and/or postamble
|
||||
#undef USE_OLD_BEST_SECTOR_PRIORITY
|
||||
// select a sector order for resulting file: 0 = logical, 1 = dos3.3, 2 = prodos
|
||||
#define SECTOR_ORDER 1
|
||||
// nothing found
|
||||
#define NOTFOUND 0
|
||||
// address mark was found
|
||||
#define ADDRFOUND 1
|
||||
@ -726,9 +735,15 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
|
||||
UINT8 chk = gcr4_decode(h[6],h[7]);
|
||||
UINT32 post = (h[8]<<16)|(h[9]<<8)|h[10];
|
||||
printf("Address Mark:\tVolume %d, Track %d, Sector %2d, Checksum %02X: %s, Postamble %03X: %s\n", vl, tr, se, chk, (chk ^ vl ^ tr ^ se)==0?"OK":"BAD", post, (post&0xFFFF00)==0xDEAA00?"OK":"BAD");
|
||||
// sanity check
|
||||
if (tr == track/2 && se < nsect) {
|
||||
visualgrid[se][track/2] |= ADDRFOUND;
|
||||
visualgrid[se][track/2] |= (chk ^ vl ^ tr ^ se)==0?ADDRGOOD:0;
|
||||
visualgrid[se][track/2] |= ADDRFOUND;
|
||||
visualgrid[se][track/2] |= ((chk ^ vl ^ tr ^ se)==0)?ADDRGOOD:0;
|
||||
#ifdef LENIENT_ADDR_CHECK
|
||||
if ((visualgrid[se][track/2] & ADDRFOUND) == ADDRFOUND) {
|
||||
#else
|
||||
if ((visualgrid[se][track/2] & ADDRGOOD) == ADDRGOOD) {
|
||||
#endif
|
||||
int opos = pos;
|
||||
int owrap = wrap;
|
||||
hb = 0;
|
||||
@ -747,11 +762,22 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
|
||||
}
|
||||
if((hb == 4)&&(dosver == 0)) {
|
||||
visualgrid[se][track/2] |= DATAFOUND;
|
||||
int prodos_translate[16] = {
|
||||
int sector_translate[16] = {
|
||||
#if SECTOR_ORDER == 0
|
||||
// logical order (0-15)
|
||||
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
|
||||
0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
|
||||
#elif SECTOR_ORDER == 1
|
||||
// DOS order (*.do)
|
||||
0x00, 0x07, 0x0E, 0x06, 0x0D, 0x05, 0x0C, 0x04,
|
||||
0x0B, 0x03, 0x0A, 0x02, 0x09, 0x01, 0x08, 0x0F
|
||||
#elif SECTOR_ORDER == 2
|
||||
// prodos order (*.po)
|
||||
0x00, 0x08, 0x01, 0x09, 0x02, 0x0A, 0x03, 0x0B,
|
||||
0x04, 0x0C, 0x05, 0x0D, 0x06, 0x0E, 0x07, 0x0F
|
||||
#endif
|
||||
};
|
||||
UINT8 *dest = sectdata+(256)*prodos_translate[se];
|
||||
UINT8 *dest = sectdata+(256)*sector_translate[se];
|
||||
UINT8 data[0x157];
|
||||
UINT32 dpost = 0;
|
||||
UINT8 c = 0;
|
||||
@ -818,6 +844,7 @@ bool a2_16sect_format::save(io_generic *io, floppy_image *image)
|
||||
pos = opos;
|
||||
wrap = owrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
hb = 0;
|
||||
}
|
||||
|
@ -47,6 +47,7 @@
|
||||
#define NUMBER_OF_MULTIREADS 3
|
||||
// threshholds for brickwall windowing
|
||||
//define MIN_CLOCKS 65
|
||||
// number_please apple2 wants 40 min
|
||||
#define MIN_CLOCKS 40
|
||||
//define MAX_CLOCKS 260
|
||||
#define MAX_CLOCKS 270
|
||||
@ -88,7 +89,7 @@ int dfi_format::identify(io_generic *io, UINT32 form_factor)
|
||||
{
|
||||
char sign[4];
|
||||
io_generic_read(io, sign, 0, 4);
|
||||
if (memcmp(sign, "DFER", 4))
|
||||
if (memcmp(sign, "DFER", 4)==0)
|
||||
fatalerror("Old type Discferret image detected; the mess Discferret decoder will not handle this properly, bailing out!\n");
|
||||
return memcmp(sign, "DFE2", 4) ? 0 : 100;
|
||||
}
|
||||
@ -132,24 +133,27 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
|
||||
|
||||
int index_time = 0; // what point the last index happened
|
||||
int index_count = 0; // number of index pulses per track
|
||||
int index_polarity = 0; // current polarity of index
|
||||
//int index_polarity = 1; // current polarity of index, starts high
|
||||
int total_time = 0; // total sampled time per track
|
||||
for(int i=0; i<tsize; i++) {
|
||||
UINT8 v = data[i];
|
||||
if (v == 0xFF) { fprintf(stderr,"DFI stream contained a 0xFF at t%d, position%d, THIS SHOULD NEVER HAPPEN!\n", track, i); exit(1); }
|
||||
if (v == 0xFF) { fprintf(stderr,"DFI stream contained a 0xFF at t%d, position%d, THIS SHOULD NEVER HAPPEN! Bailing out!\n", track, i); exit(1); }
|
||||
if((v & 0x7f) == 0x7f)
|
||||
total_time += 0x7f;
|
||||
else {
|
||||
if((v & 0x80)==0) total_time += v & 0x7f;
|
||||
if(v & 0x80) {
|
||||
index_time = total_time;
|
||||
if (onerev_time == 0) onerev_time = total_time;
|
||||
//index_polarity ^= 1;
|
||||
//index_count =+ index_polarity;
|
||||
index_count++;
|
||||
}
|
||||
}
|
||||
else if(v & 0x80) {
|
||||
total_time += v & 0x7f;
|
||||
index_time = total_time;
|
||||
//index_polarity ^= 1;
|
||||
//fprintf(stderr,"index state changed to %d at time=%d\n", index_polarity, total_time);
|
||||
//fprintf(stderr,"index rising edge seen at time=%d\n", total_time);
|
||||
if (onerev_time == 0) onerev_time = total_time;
|
||||
index_count += 1;//index_polarity;
|
||||
} else // (v & 0x80) == 0
|
||||
total_time += v & 0x7f;
|
||||
}
|
||||
|
||||
// its possible on single read images for there to be no index pulse during the image at all!
|
||||
if (onerev_time == 0) onerev_time = total_time;
|
||||
|
||||
if(!track && !head)
|
||||
fprintf(stderr, "%02d:%d tt=%10d it=%10d\n", track, head, total_time, index_time);
|
||||
@ -194,21 +198,21 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
|
||||
time_buckets[i] = 0;
|
||||
#endif
|
||||
index_count = 0;
|
||||
index_polarity = 0;
|
||||
//index_polarity = 0;
|
||||
UINT32 mg = floppy_image::MG_A;
|
||||
UINT32 *buf = image->get_buffer(track, head);
|
||||
int tpos = 0;
|
||||
buf[tpos++] = mg;
|
||||
for(int i=0; i<tsize; i++) {
|
||||
UINT8 v = data[i];
|
||||
if((v & 0x7f) == 0x7f) {// 0x7F or 0xFF: no transition, but a carry
|
||||
cur_time += 0x7f; // should this be done if v&80 is also set?
|
||||
if(v & 0x80) { // 0xFF an index, note the index (TODO: actually do this!) and do not add number
|
||||
index_polarity ^= 1;
|
||||
index_count += index_polarity;
|
||||
//if (index_count == NUMBER_OF_MULTIREADS) break;
|
||||
if((v & 0x7f) == 0x7f) // 0x7F : no transition, but a carry (FF is a board-on-fire error and is checked for above)
|
||||
cur_time += 0x7f;
|
||||
else if(v & 0x80) { // 0x80 set, note the index (TODO: actually do this!) and add number to count
|
||||
cur_time += v & 0x7f;
|
||||
//index_polarity ^= 1;
|
||||
index_count += 1;//index_polarity;
|
||||
//if (index_count == NUMBER_OF_MULTIREADS) break;
|
||||
}
|
||||
}
|
||||
else if((v & 0x80) == 0) { // 0x00-0x7E: not an index or carry, add the number and store transition
|
||||
cur_time += v & 0x7f;
|
||||
int trans_time = cur_time - prev_time;
|
||||
@ -219,23 +223,24 @@ bool dfi_format::load(io_generic *io, UINT32 form_factor, floppy_image *image)
|
||||
// TODO for 4/22/2012: ACTUALLY DO THIS RESCALING STEP
|
||||
// filter out spurious crap
|
||||
//if (trans_time <= MIN_THRESH) fprintf(stderr, "DFI: Throwing out short transition of length %d\n", trans_time);
|
||||
//if ((prev_time == 0) || ((trans_time > MIN_THRESH))) {
|
||||
// the normal case: write the transition at the appropriate time
|
||||
if ((prev_time == 0) || ((trans_time > MIN_THRESH) && (trans_time <= MAX_THRESH))) {
|
||||
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
|
||||
buf[tpos++] = mg | UINT32((200000000ULL*cur_time)/index_time);
|
||||
prev_time = cur_time;
|
||||
}
|
||||
if (trans_time > MAX_THRESH) { // we probably missed a transition
|
||||
// the long case: we probably missed a transition, stuff an extra guessed one in there to see if it helps
|
||||
if (trans_time > MAX_THRESH) {
|
||||
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
|
||||
if (((track%2)==0)&&(head==0)) fprintf(stderr,"missed transition, total time for transition is %d\n",trans_time);
|
||||
buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/2)))/index_time); // generate imaginary transition at half period
|
||||
//buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/2)))/index_time); // generate imaginary transition at half period
|
||||
buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-((trans_time*2)/3)))/index_time);
|
||||
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
|
||||
buf[tpos++] = mg | UINT32((200000000ULL*(cur_time-(trans_time/3)))/index_time);
|
||||
mg = mg == floppy_image::MG_A ? floppy_image::MG_B : floppy_image::MG_A;
|
||||
buf[tpos++] = mg | UINT32(200000000ULL*cur_time/index_time); // generate transition now
|
||||
prev_time = cur_time;
|
||||
}
|
||||
} else if(v & 0x80) { // 0x80-0xFF an index, note the index (TODO: actually do this!) and do not add number
|
||||
index_polarity ^= 1;
|
||||
index_count += index_polarity;
|
||||
if (index_count == NUMBER_OF_MULTIREADS) break;
|
||||
}
|
||||
}
|
||||
#ifdef TRACK_HISTOGRAM
|
||||
|
Loading…
Reference in New Issue
Block a user