mirror of
https://github.com/holub/mame
synced 2025-05-17 11:15:06 +03:00
Misc cleanup, nw
This commit is contained in:
parent
a279ee3773
commit
1dd98cd6ff
@ -579,22 +579,22 @@ INPUT_PORTS_END
|
||||
|
||||
WRITE_LINE_MEMBER( thomson_state::fdc_index_0_w )
|
||||
{
|
||||
thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_0), state);
|
||||
thomson_index_callback(0, state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( thomson_state::fdc_index_1_w )
|
||||
{
|
||||
thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_1), state);
|
||||
thomson_index_callback(1, state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( thomson_state::fdc_index_2_w )
|
||||
{
|
||||
thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_2), state);
|
||||
thomson_index_callback(2, state);
|
||||
}
|
||||
|
||||
WRITE_LINE_MEMBER( thomson_state::fdc_index_3_w )
|
||||
{
|
||||
thomson_index_callback(machine().device<legacy_floppy_image_device>(FLOPPY_3), state);
|
||||
thomson_index_callback(3, state);
|
||||
}
|
||||
|
||||
static const floppy_interface thomson_floppy_interface =
|
||||
@ -677,16 +677,16 @@ MACHINE_CONFIG_START(thomson_state::to7)
|
||||
/* floppy */
|
||||
MCFG_DEVICE_ADD("mc6843", MC6843, 0)
|
||||
|
||||
MCFG_DEVICE_ADD(FLOPPY_0, LEGACY_FLOPPY, 0)
|
||||
MCFG_DEVICE_ADD(m_floppy_image[0], LEGACY_FLOPPY, 0)
|
||||
MCFG_LEGACY_FLOPPY_CONFIG(thomson_floppy_interface)
|
||||
MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(*this, thomson_state, fdc_index_0_w))
|
||||
MCFG_DEVICE_ADD(FLOPPY_1, LEGACY_FLOPPY, 0)
|
||||
MCFG_DEVICE_ADD(m_floppy_image[1], LEGACY_FLOPPY, 0)
|
||||
MCFG_LEGACY_FLOPPY_CONFIG(thomson_floppy_interface)
|
||||
MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(*this, thomson_state, fdc_index_1_w))
|
||||
MCFG_DEVICE_ADD(FLOPPY_2, LEGACY_FLOPPY, 0)
|
||||
MCFG_DEVICE_ADD(m_floppy_image[2], LEGACY_FLOPPY, 0)
|
||||
MCFG_LEGACY_FLOPPY_CONFIG(thomson_floppy_interface)
|
||||
MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(*this, thomson_state, fdc_index_2_w))
|
||||
MCFG_DEVICE_ADD(FLOPPY_3, LEGACY_FLOPPY, 0)
|
||||
MCFG_DEVICE_ADD(m_floppy_image[3], LEGACY_FLOPPY, 0)
|
||||
MCFG_LEGACY_FLOPPY_CONFIG(thomson_floppy_interface)
|
||||
MCFG_LEGACY_FLOPPY_IDX_CB(WRITELINE(*this, thomson_state, fdc_index_3_w))
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "machine/mos6551.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/thomflop.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
#include "sound/dac.h"
|
||||
#include "sound/mea8000.h"
|
||||
|
||||
@ -115,6 +116,7 @@ public:
|
||||
m_ram(*this, RAM_TAG),
|
||||
m_mc6846(*this, "mc6846"),
|
||||
m_mc6843(*this, "mc6843"),
|
||||
m_wd2793_fdc(*this, "wd2793"),
|
||||
m_screen(*this, "screen"),
|
||||
m_mainirq(*this, "mainirq"),
|
||||
m_mainfirq(*this, "mainfirq"),
|
||||
@ -143,7 +145,8 @@ public:
|
||||
m_biosbank(*this, TO8_BIOS_BANK),
|
||||
m_cartlobank(*this, MO6_CART_LO),
|
||||
m_carthibank(*this, MO6_CART_HI),
|
||||
m_floppy(*this, "floppy")
|
||||
m_floppy_led(*this, "floppy"),
|
||||
m_floppy_image(*this, "floppy%u", 0U)
|
||||
{
|
||||
}
|
||||
|
||||
@ -342,7 +345,7 @@ public:
|
||||
WRITE_LINE_MEMBER( fdc_index_1_w );
|
||||
WRITE_LINE_MEMBER( fdc_index_2_w );
|
||||
WRITE_LINE_MEMBER( fdc_index_3_w );
|
||||
void thomson_index_callback(legacy_floppy_image_device *device, int state);
|
||||
void thomson_index_callback(int index, int state);
|
||||
DECLARE_PALETTE_INIT(thom);
|
||||
DECLARE_PALETTE_INIT(mo5);
|
||||
|
||||
@ -389,6 +392,7 @@ protected:
|
||||
required_device<ram_device> m_ram;
|
||||
optional_device<mc6846_device> m_mc6846;
|
||||
optional_device<mc6843_device> m_mc6843;
|
||||
required_device<wd2793_device> m_wd2793_fdc;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<input_merger_device> m_mainirq;
|
||||
required_device<input_merger_device> m_mainfirq;
|
||||
@ -418,7 +422,8 @@ protected:
|
||||
optional_memory_bank m_cartlobank;
|
||||
optional_memory_bank m_carthibank;
|
||||
|
||||
output_finder<> m_floppy;
|
||||
output_finder<> m_floppy_led;
|
||||
required_device_array<legacy_floppy_image_device, 4> m_floppy_image;
|
||||
|
||||
/* bank logging and optimisations */
|
||||
int m_old_cart_bank;
|
||||
@ -604,10 +609,10 @@ protected:
|
||||
int thom_qdd_make_disk ( legacy_floppy_image_device* img, uint8_t* dst );
|
||||
void to7_5p14_reset();
|
||||
void to7_5p14_init();
|
||||
void to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state );
|
||||
void to7_5p14_index_pulse_callback( int state );
|
||||
void to7_5p14sd_reset();
|
||||
void to7_5p14sd_init();
|
||||
void to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state );
|
||||
void to7_qdd_index_pulse_cb( int state );
|
||||
legacy_floppy_image_device * to7_qdd_image();
|
||||
void to7_qdd_stat_update();
|
||||
uint8_t to7_qdd_read_byte();
|
||||
@ -616,7 +621,7 @@ protected:
|
||||
void to7_qdd_init();
|
||||
legacy_floppy_image_device * thmfc_floppy_image();
|
||||
int thmfc_floppy_is_qdd( legacy_floppy_image_device *image );
|
||||
void thmfc_floppy_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state );
|
||||
void thmfc_floppy_index_pulse_cb( int index, int state );
|
||||
int thmfc_floppy_find_sector( chrn_id* dst );
|
||||
void thmfc_floppy_cmd_complete();
|
||||
uint8_t thmfc_floppy_read_byte();
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "includes/thomson.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
|
||||
|
||||
#define VERBOSE 0 /* 0, 1 or 2 */
|
||||
@ -276,14 +275,12 @@ static uint8_t to7_5p14_select;
|
||||
|
||||
READ8_MEMBER( thomson_state::to7_5p14_r )
|
||||
{
|
||||
wd2793_device *fdc = machine().device<wd2793_device>("wd2793");
|
||||
|
||||
if ( offset < 4 )
|
||||
return fdc->read(space, offset );
|
||||
return m_wd2793_fdc->read(space, offset );
|
||||
else if ( offset == 8 )
|
||||
return to7_5p14_select;
|
||||
else
|
||||
logerror ( "%f $%04x to7_5p14_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset );
|
||||
logerror ( "%s: to7_5p14_r: invalid read offset %i\n", machine().describe_context(), offset );
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -291,18 +288,17 @@ READ8_MEMBER( thomson_state::to7_5p14_r )
|
||||
|
||||
WRITE8_MEMBER( thomson_state::to7_5p14_w )
|
||||
{
|
||||
wd2793_device *fdc = machine().device<wd2793_device>("wd2793");
|
||||
if ( offset < 4 )
|
||||
fdc->write(space, offset, data );
|
||||
m_wd2793_fdc->write(space, offset, data );
|
||||
else if ( offset == 8 )
|
||||
{
|
||||
/* drive select */
|
||||
floppy_image_device *floppy = nullptr;
|
||||
|
||||
if (BIT(data, 1)) floppy = fdc->subdevice<floppy_connector>("0")->get_device();
|
||||
if (BIT(data, 2)) floppy = fdc->subdevice<floppy_connector>("1")->get_device();
|
||||
if (BIT(data, 1)) floppy = m_wd2793_fdc->subdevice<floppy_connector>("0")->get_device();
|
||||
if (BIT(data, 2)) floppy = m_wd2793_fdc->subdevice<floppy_connector>("1")->get_device();
|
||||
|
||||
fdc->set_floppy(floppy);
|
||||
m_wd2793_fdc->set_floppy(floppy);
|
||||
|
||||
if (floppy)
|
||||
{
|
||||
@ -312,24 +308,25 @@ WRITE8_MEMBER( thomson_state::to7_5p14_w )
|
||||
}
|
||||
}
|
||||
else
|
||||
logerror ( "%f $%04x to7_5p14_w: invalid write offset %i (data=$%02X)\n",
|
||||
machine().time().as_double(), m_maincpu->pc(), offset, data );
|
||||
{
|
||||
logerror("%s: to7_5p14_w: invalid write offset %i (data=$%02X)\n",
|
||||
machine().describe_context(), offset, data );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void thomson_state::to7_5p14_reset()
|
||||
{
|
||||
wd2793_device *fdc = machine().device<wd2793_device>("wd2793");
|
||||
LOG(( "to7_5p14_reset: CD 90-640 controller\n" ));
|
||||
fdc->reset();
|
||||
logerror("%s: to7_5p14_reset: CD 90-640 controller\n", machine().describe_context());
|
||||
m_wd2793_fdc->reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void thomson_state::to7_5p14_init()
|
||||
{
|
||||
LOG(( "to7_5p14_init: CD 90-640 controller\n" ));
|
||||
logerror("%s: to7_5p14_init: CD 90-640 controller\n", machine().describe_context());
|
||||
save_item(NAME(to7_5p14_select));
|
||||
}
|
||||
|
||||
@ -408,7 +405,7 @@ WRITE8_MEMBER( thomson_state::to7_5p14sd_w )
|
||||
machine().time().as_double(), m_maincpu->pc(), offset, data );
|
||||
}
|
||||
|
||||
void thomson_state::to7_5p14_index_pulse_callback( device_t *controller,legacy_floppy_image_device *image, int state )
|
||||
void thomson_state::to7_5p14_index_pulse_callback( int state )
|
||||
{
|
||||
m_mc6843->set_index_pulse( state );
|
||||
}
|
||||
@ -505,7 +502,7 @@ static to7qdd_t * to7qdd;
|
||||
|
||||
|
||||
|
||||
void thomson_state::to7_qdd_index_pulse_cb( device_t *controller,legacy_floppy_image_device *image, int state )
|
||||
void thomson_state::to7_qdd_index_pulse_cb( int state )
|
||||
{
|
||||
to7qdd->index_pulse = state;
|
||||
|
||||
@ -889,7 +886,7 @@ struct thmfc1_t
|
||||
{
|
||||
uint8_t op;
|
||||
uint8_t sector; /* target sector, in [1,16] */
|
||||
uint32_t sector_id;
|
||||
uint32_t sector_id;
|
||||
uint8_t track; /* current track, in [0,79] */
|
||||
uint8_t side; /* current side, 0 or 1 */
|
||||
uint8_t drive; /* 0 to 3 */
|
||||
@ -926,19 +923,21 @@ legacy_floppy_image_device * thomson_state::thmfc_floppy_image()
|
||||
|
||||
int thomson_state::thmfc_floppy_is_qdd ( legacy_floppy_image_device *image )
|
||||
{
|
||||
if (image==nullptr) return 0;
|
||||
if (!image) return 0;
|
||||
if (!image->exists()) return 0;
|
||||
return image->length()==51200; // idf QDD
|
||||
return image->length() == 51200; // idf QDD
|
||||
}
|
||||
|
||||
|
||||
|
||||
void thomson_state::thmfc_floppy_index_pulse_cb ( device_t *controller,legacy_floppy_image_device *image, int state )
|
||||
void thomson_state::thmfc_floppy_index_pulse_cb( int index, int state )
|
||||
{
|
||||
legacy_floppy_image_device *image = m_floppy_image[index];
|
||||
|
||||
if ( image != thmfc_floppy_image())
|
||||
return;
|
||||
|
||||
if ( thmfc_floppy_is_qdd(image))
|
||||
if ( thmfc_floppy_is_qdd(m_floppy_image[index]))
|
||||
{
|
||||
/* pulse each time the whole-disk spiraling track ends */
|
||||
image->floppy_drive_set_rpm( 16.92f /* 423/25 */ );
|
||||
@ -1890,23 +1889,23 @@ WRITE8_MEMBER( thomson_state::to9_floppy_w )
|
||||
to7_5p14_w( space, offset, data, mem_mask );
|
||||
}
|
||||
|
||||
void thomson_state::thomson_index_callback(legacy_floppy_image_device *device, int state)
|
||||
void thomson_state::thomson_index_callback(int index, int state)
|
||||
{
|
||||
switch ( to7_controller_type )
|
||||
{
|
||||
case 1:
|
||||
to7_5p14_index_pulse_callback(nullptr, device, state);
|
||||
to7_5p14_index_pulse_callback(state);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
break;
|
||||
|
||||
case 3:
|
||||
thmfc_floppy_index_pulse_cb(nullptr, device, state);
|
||||
thmfc_floppy_index_pulse_cb(index, state);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
to7_qdd_index_pulse_cb(nullptr, device, state);
|
||||
to7_qdd_index_pulse_cb(state);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -890,7 +890,7 @@ void thomson_state::thom_floppy_active( int write )
|
||||
/* update icon */
|
||||
fnew = FLOP_STATE;
|
||||
if ( fold != fnew )
|
||||
m_floppy = fnew;
|
||||
m_floppy_led = fnew;
|
||||
}
|
||||
|
||||
|
||||
@ -1041,7 +1041,7 @@ WRITE_LINE_MEMBER(thomson_state::thom_vblank)
|
||||
m_thom_floppy_rcount--;
|
||||
fnew = FLOP_STATE;
|
||||
if ( fnew != fold )
|
||||
m_floppy = fnew;
|
||||
m_floppy_led = fnew;
|
||||
|
||||
/* prepare state for next frame */
|
||||
for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ )
|
||||
@ -1160,7 +1160,7 @@ VIDEO_START_MEMBER( thomson_state, thom )
|
||||
m_thom_floppy_wcount = 0;
|
||||
save_item(NAME(m_thom_floppy_wcount));
|
||||
save_item(NAME(m_thom_floppy_rcount));
|
||||
m_floppy.resolve();
|
||||
m_floppy_led.resolve();
|
||||
|
||||
m_thom_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user