diff options
author | 2019-11-10 22:24:14 -0500 | |
---|---|---|
committer | 2019-11-10 22:25:57 -0500 | |
commit | c67f75fdd79c071a7c9d8d3cecf3001ecd04c933 (patch) | |
tree | f91e7a011661eadcbe4fcf98eea790ced3856379 | |
parent | 3e0e72a9376589e86757cbacc4ef4a789c147c6a (diff) |
thomson.cpp: Improve floppy device encapsulation (nw)
- Eliminate all global-level static variables and functions in thomflop.cpp
- Simplify read/write handlers for floppy interfaces
mc6843: Simplify read/write handlers (nw)
-rw-r--r-- | src/devices/bus/bml3/bml3mp1805.cpp | 2 | ||||
-rw-r--r-- | src/devices/machine/mc6843.cpp | 4 | ||||
-rw-r--r-- | src/devices/machine/mc6843.h | 4 | ||||
-rw-r--r-- | src/mame/drivers/thomson.cpp | 2 | ||||
-rw-r--r-- | src/mame/includes/thomson.h | 36 | ||||
-rw-r--r-- | src/mame/machine/thomflop.cpp | 788 | ||||
-rw-r--r-- | src/mame/machine/thomflop.h | 75 | ||||
-rw-r--r-- | src/mame/machine/thomson.cpp | 24 |
8 files changed, 475 insertions, 460 deletions
diff --git a/src/devices/bus/bml3/bml3mp1805.cpp b/src/devices/bus/bml3/bml3mp1805.cpp index b445efc7c4d..d5ce2f39598 100644 --- a/src/devices/bus/bml3/bml3mp1805.cpp +++ b/src/devices/bus/bml3/bml3mp1805.cpp @@ -141,7 +141,7 @@ void bml3bus_mp1805_device::device_start() // install into memory address_space &space_prg = space(); - space_prg.install_readwrite_handler(0xff18, 0xff1f, read8_delegate(*m_mc6843, FUNC(mc6843_device::read)), write8_delegate(*m_mc6843, FUNC(mc6843_device::write))); + space_prg.install_readwrite_handler(0xff18, 0xff1f, read8sm_delegate(*m_mc6843, FUNC(mc6843_device::read)), write8sm_delegate(*m_mc6843, FUNC(mc6843_device::write))); space_prg.install_readwrite_handler(0xff20, 0xff20, read8_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_r)), write8_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_w))); // overwriting the main ROM (rather than using e.g. install_rom) should mean that bank switches for RAM expansion still work... uint8_t *mainrom = device().machine().root_device().memregion("maincpu")->base(); diff --git a/src/devices/machine/mc6843.cpp b/src/devices/machine/mc6843.cpp index e41aeeaf9d3..597cc7ee865 100644 --- a/src/devices/machine/mc6843.cpp +++ b/src/devices/machine/mc6843.cpp @@ -451,7 +451,7 @@ void mc6843_device::device_timer(emu_timer &timer, device_timer_id id, int param -READ8_MEMBER( mc6843_device::read ) +uint8_t mc6843_device::read(offs_t offset) { uint8_t data = 0; @@ -590,7 +590,7 @@ READ8_MEMBER( mc6843_device::read ) return data; } -WRITE8_MEMBER( mc6843_device::write ) +void mc6843_device::write(offs_t offset, uint8_t data) { switch ( offset ) { case 0: /* Data Output Register (DOR) */ diff --git a/src/devices/machine/mc6843.h b/src/devices/machine/mc6843.h index c75ba561548..895e80d9458 100644 --- a/src/devices/machine/mc6843.h +++ b/src/devices/machine/mc6843.h @@ -32,8 +32,8 @@ public: auto irq() { return m_write_irq.bind(); } - DECLARE_READ8_MEMBER(read); - DECLARE_WRITE8_MEMBER(write); + uint8_t read(offs_t offset); + void write(offs_t offset, uint8_t data); void set_drive(int drive); void set_side(int side); diff --git a/src/mame/drivers/thomson.cpp b/src/mame/drivers/thomson.cpp index e2e5987c8bd..6b86d6adc5d 100644 --- a/src/mame/drivers/thomson.cpp +++ b/src/mame/drivers/thomson.cpp @@ -676,6 +676,8 @@ void thomson_state::to7_base(machine_config &config) m_cassette->set_interface("to_cass"); /* floppy */ + CQ90_028(config, m_to7qdd, 0); + THMFC1(config, m_thmfc, 16_MHz_XTAL); m_thmfc->floppy_active_cb().set(FUNC(thomson_state::thom_floppy_active)); diff --git a/src/mame/includes/thomson.h b/src/mame/includes/thomson.h index c86c066e963..8106764232a 100644 --- a/src/mame/includes/thomson.h +++ b/src/mame/includes/thomson.h @@ -147,6 +147,7 @@ public: m_cartlobank(*this, MO6_CART_LO), m_carthibank(*this, MO6_CART_HI), m_cart_rom(*this, "cartridge"), + m_to7qdd(*this, "to7qdd"), m_thmfc(*this, "thmfc"), m_floppy_led(*this, "floppy"), m_floppy_image(*this, "floppy%u", 0U) @@ -345,22 +346,20 @@ private: DECLARE_WRITE_LINE_MEMBER(thom_vblank); DECLARE_VIDEO_START( thom ); - DECLARE_READ8_MEMBER( to7_5p14_r ); - DECLARE_WRITE8_MEMBER( to7_5p14_w ); - DECLARE_READ8_MEMBER( to7_5p14sd_r ); - DECLARE_WRITE8_MEMBER( to7_5p14sd_w ); - DECLARE_READ8_MEMBER( to7_qdd_r ); - DECLARE_WRITE8_MEMBER( to7_qdd_w ); + uint8_t to7_5p14_r(offs_t offset); + void to7_5p14_w(offs_t offset, uint8_t data); + uint8_t to7_5p14sd_r(offs_t offset); + void to7_5p14sd_w(offs_t offset, uint8_t data); TIMER_CALLBACK_MEMBER( ans4 ); TIMER_CALLBACK_MEMBER( ans3 ); TIMER_CALLBACK_MEMBER( ans2 ); TIMER_CALLBACK_MEMBER( ans ); - DECLARE_READ8_MEMBER( to7_network_r ); - DECLARE_WRITE8_MEMBER( to7_network_w ); - DECLARE_READ8_MEMBER( to7_floppy_r ); - DECLARE_WRITE8_MEMBER( to7_floppy_w ); - DECLARE_READ8_MEMBER( to9_floppy_r ); - DECLARE_WRITE8_MEMBER( to9_floppy_w ); + uint8_t to7_network_r(offs_t offset); + void to7_network_w(offs_t offset, uint8_t data); + uint8_t to7_floppy_r(offs_t offset); + void to7_floppy_w(offs_t offset, uint8_t data); + uint8_t to9_floppy_r(offs_t offset); + void to9_floppy_w(offs_t offset, uint8_t data); WRITE_LINE_MEMBER( fdc_index_0_w ); WRITE_LINE_MEMBER( fdc_index_1_w ); WRITE_LINE_MEMBER( fdc_index_2_w ); @@ -430,6 +429,7 @@ private: optional_memory_bank m_carthibank; required_region_ptr<uint8_t> m_cart_rom; + required_device<cq90_028_device> m_to7qdd; required_device<thmfc1_device> m_thmfc; output_finder<> m_floppy_led; required_device_array<legacy_floppy_image_device, 4> m_floppy_image; @@ -546,6 +546,11 @@ private: emu_timer *m_thom_init_timer; void (thomson_state::*m_thom_init_cb)( int init ); + uint8_t m_to7_controller_type; + uint8_t m_to7_floppy_bank; + uint8_t m_to7_5p14_select; + uint8_t m_to7_5p14sd_select; + int to7_get_cassette(); int mo5_get_cassette(); void mo5_set_cassette( int data ); @@ -615,13 +620,6 @@ private: void to7_5p14_index_pulse_callback( int state ); void to7_5p14sd_reset(); void to7_5p14sd_init(); - 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(); - void to7_qdd_write_byte( uint8_t data ); - void to7_qdd_reset(); - void to7_qdd_init(); void to7_network_init(); void to7_network_reset(); void to7_floppy_init(); diff --git a/src/mame/machine/thomflop.cpp b/src/mame/machine/thomflop.cpp index 11fd5704f9c..9a890708705 100644 --- a/src/mame/machine/thomflop.cpp +++ b/src/mame/machine/thomflop.cpp @@ -79,97 +79,97 @@ #define THOM_SIZE_SYNCHRO 12 -/* build an identifier, with header & space */ -static int thom_floppy_make_addr( chrn_id id, uint8_t* dst, int sector_size ) +// build an identifier, with header & space +int thomson_legacy_floppy_interface::floppy_make_addr(chrn_id id, uint8_t *dst, int sector_size) { if ( sector_size == 128 ) { - /* single density */ - memset( dst, 0x00, 6 ); /* synchro bytes */ - dst[ 7 ] = 0xfe; /* address field mark */ + // single density + memset( dst, 0x00, 6 ); // synchro bytes + dst[ 7 ] = 0xfe; // address field mark dst[ 8 ] = id.C; dst[ 9 ] = id.H; dst[ 10 ] = id.N; dst[ 11 ] = id.R; - dst[ 12 ] = 0; /* TODO: CRC */ - dst[ 13 ] = 0; /* TODO: CRC */ - memset( dst + 14, 0xff, 12 ); /* end mark */ + dst[ 12 ] = 0; // TODO: CRC + dst[ 13 ] = 0; // TODO: CRC + memset( dst + 14, 0xff, 12 ); // end mark return 36; } else { - /* double density */ - memset( dst, 0xa1, 3 ); /* synchro bytes */ - dst[ 3 ] = 0xfe; /* address field mark */ + // double density + memset( dst, 0xa1, 3 ); // synchro bytes + dst[ 3 ] = 0xfe; // address field mark dst[ 4 ] = id.C; dst[ 5 ] = id.H; dst[ 6 ] = id.N; dst[ 7 ] = id.R; - dst[ 8 ] = 0; /* TODO: CRC */ - dst[ 9 ] = 0; /* TODO: CRC */ - memset( dst + 10, 0xf7, 22 ); /* end mark */ + dst[ 8 ] = 0; // TODO: CRC + dst[ 9 ] = 0; // TODO: CRC + memset( dst + 10, 0xf7, 22 ); // end mark return 32; } } -/* build a sector, with header & space */ -static int thom_floppy_make_sector( legacy_floppy_image_device* img, chrn_id id, uint8_t* dst, int sector_size ) +// build a sector, with header & space +int thomson_legacy_floppy_interface::floppy_make_sector(legacy_floppy_image_device *img, chrn_id id, uint8_t *dst, int sector_size) { if ( sector_size == 128 ) { - /* single density */ - memset( dst, 0x00, 6 ); /* synchro bytes */ - dst[ 6 ] = 0xfb; /* data field mark */ + // single density + memset( dst, 0x00, 6 ); // synchro bytes + dst[ 6 ] = 0xfb; // data field mark img->floppy_drive_read_sector_data ( id.H, id.data_id, dst + 7, sector_size ); - dst[ sector_size + 7 ] = 0; /* TODO: CRC */ - dst[ sector_size + 8 ] = 0; /* TODO: CRC */ - memset( dst + sector_size + 9, 0xff, 22 ); /* end mark */ + dst[ sector_size + 7 ] = 0; // TODO: CRC + dst[ sector_size + 8 ] = 0; // TODO: CRC + memset( dst + sector_size + 9, 0xff, 22 ); // end mark return sector_size + 31; } else { - /* double density */ - memset( dst, 0xa1, 3 ); /* synchro bytes */ - dst[ 3 ] = 0xfb; /* data field mark */ + // double density + memset( dst, 0xa1, 3 ); // synchro bytes + dst[ 3 ] = 0xfb; // data field mark img->floppy_drive_read_sector_data ( id.H, id.data_id, dst + 4, sector_size ); - dst[ sector_size + 4 ] = 0; /* TODO: CRC */ - dst[ sector_size + 5 ] = 0; /* TODO: CRC */ - memset( dst + sector_size + 6, 0xF7, 74 ); /* end mark */ + dst[ sector_size + 4 ] = 0; // TODO: CRC + dst[ sector_size + 5 ] = 0; // TODO: CRC + memset( dst + sector_size + 6, 0xF7, 74 ); // end mark return sector_size + 80; } } -/* build a whole track */ -static int thom_floppy_make_track( legacy_floppy_image_device* img, uint8_t* dst, int sector_size, int side ) +// build a whole track +int thomson_legacy_floppy_interface::floppy_make_track(legacy_floppy_image_device *img, uint8_t *dst, int sector_size, int side) { uint8_t space = ( sector_size == 128 ) ? 0xff : 0; - uint8_t* org = dst; + uint8_t *org = dst; chrn_id id; int nb; - /* go to start of track */ + // go to start of track while ( ! img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) { if ( ! img->floppy_drive_get_next_id( side, &id ) ) return 0; } - /* for each sector... */ + // for each sector... for ( nb = 0; nb < 16; nb++ ) { if ( ! img->floppy_drive_get_next_id( side, &id ) ) break; memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; - dst += thom_floppy_make_addr( id, dst, sector_size ); + dst += floppy_make_addr( id, dst, sector_size ); memset( dst, space, THOM_SIZE_SYNCHRO ); dst += THOM_SIZE_SYNCHRO; - dst += thom_floppy_make_sector( img, id, dst, sector_size ); + dst += floppy_make_sector( img, id, dst, sector_size ); if ( img->floppy_drive_get_flag_state( FLOPPY_DRIVE_INDEX ) ) break; @@ -209,8 +209,8 @@ static int thom_floppy_make_track( legacy_floppy_image_device* img, uint8_t* dst #define THOM_QDD_SIZE_DATA ( 130 + THOM_QDD_SYNCH_DATA ) -/* build an identifier, with header */ -static int thom_qdd_make_addr( int sector, uint8_t* dst ) +// build an identifier, with header +int thomson_legacy_floppy_interface::qdd_make_addr(int sector, uint8_t *dst) { dst[ 0 ] = 0xa5; dst[ 1 ] = sector >> 8; @@ -221,8 +221,8 @@ static int thom_qdd_make_addr( int sector, uint8_t* dst ) -/* build a sector, with header */ -static int thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, uint8_t* dst ) +// build a sector, with header +int thomson_legacy_floppy_interface::qdd_make_sector(legacy_floppy_image_device *img, int sector, uint8_t *dst) { int i; dst[ 0 ] = 0x5a; @@ -235,8 +235,8 @@ static int thom_qdd_make_sector( legacy_floppy_image_device* img, int sector, ui -/* build a whole disk */ -static int thom_qdd_make_disk ( legacy_floppy_image_device* img, uint8_t* dst ) +// build a whole disk +int thomson_legacy_floppy_interface::qdd_make_disk(legacy_floppy_image_device *img, uint8_t *dst) { uint8_t* org = dst; int i; @@ -246,9 +246,9 @@ static int thom_qdd_make_disk ( legacy_floppy_image_device* img, uint8_t* dst ) for ( i = 1; i <= 400; i++ ) { memset( dst, 0x16, THOM_QDD_SYNCH_ADDR ); dst += THOM_QDD_SYNCH_ADDR; - dst += thom_qdd_make_addr( i, dst ); + dst += qdd_make_addr( i, dst ); memset( dst, 0x16, THOM_QDD_SYNCH_DATA ); dst += THOM_QDD_SYNCH_DATA; - dst += thom_qdd_make_sector( img, i, dst ); + dst += qdd_make_sector( img, i, dst ); } memset( dst, 0x16, THOM_QDD_SYNCH_DISK ); dst += THOM_QDD_SYNCH_DISK; @@ -267,16 +267,12 @@ static int thom_qdd_make_disk ( legacy_floppy_image_device* img, uint8_t* dst ) -static uint8_t to7_5p14_select; - - - -READ8_MEMBER( thomson_state::to7_5p14_r ) +uint8_t thomson_state::to7_5p14_r(offs_t offset) { if ( offset < 4 ) return m_wd2793_fdc->read(offset); else if ( offset == 8 ) - return to7_5p14_select; + return m_to7_5p14_select; else logerror ( "%s: to7_5p14_r: invalid read offset %i\n", machine().describe_context(), offset ); return 0; @@ -284,13 +280,13 @@ READ8_MEMBER( thomson_state::to7_5p14_r ) -WRITE8_MEMBER( thomson_state::to7_5p14_w ) +void thomson_state::to7_5p14_w(offs_t offset, uint8_t data) { if ( offset < 4 ) - m_wd2793_fdc->write(offset, data ); + m_wd2793_fdc->write(offset, data); else if ( offset == 8 ) { - /* drive select */ + // drive select floppy_image_device *floppy = nullptr; if (BIT(data, 1)) floppy = m_wd2793_fdc->subdevice<floppy_connector>("0")->get_device(); @@ -325,7 +321,7 @@ void thomson_state::to7_5p14_reset() void thomson_state::to7_5p14_init() { logerror("%s: to7_5p14_init: CD 90-640 controller\n", machine().describe_context()); - save_item(NAME(to7_5p14_select)); + save_item(NAME(m_to7_5p14_select)); } @@ -340,16 +336,12 @@ void thomson_state::to7_5p14_init() -static uint8_t to7_5p14sd_select; - - - -READ8_MEMBER( thomson_state::to7_5p14sd_r ) +uint8_t thomson_state::to7_5p14sd_r(offs_t offset) { if ( offset < 8 ) - return m_mc6843->read( space, offset ); + return m_mc6843->read(offset); else if ( offset >= 8 && offset <= 9 ) - return to7_5p14sd_select; + return m_to7_5p14sd_select; else logerror ( "%f $%04x to7_5p14sd_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); return 0; @@ -357,13 +349,13 @@ READ8_MEMBER( thomson_state::to7_5p14sd_r ) -WRITE8_MEMBER( thomson_state::to7_5p14sd_w ) +void thomson_state::to7_5p14sd_w(offs_t offset, uint8_t data) { if ( offset < 8 ) - m_mc6843->write( space, offset, data ); + m_mc6843->write(offset, data); else if ( offset >= 8 && offset <= 9 ) { - /* drive select */ + // drive select int drive = -1, side = 0; if ( data & 1 ) @@ -387,7 +379,7 @@ WRITE8_MEMBER( thomson_state::to7_5p14sd_w ) side = 1; } - to7_5p14sd_select = data; + m_to7_5p14sd_select = data; if ( drive != -1 ) { @@ -426,7 +418,7 @@ void thomson_state::to7_5p14sd_reset() void thomson_state::to7_5p14sd_init() { LOG(( "to7_5p14sd_init: CD 90-015 controller\n" )); - save_item(NAME(to7_5p14sd_select)); + save_item(NAME(m_to7_5p14sd_select)); } @@ -442,142 +434,124 @@ void thomson_state::to7_5p14sd_init() -/* MC6852 status */ -#define QDD_S_RDA 0x01 /* receiver data available */ -#define QDD_S_TDRA 0x02 /* transitter data register available */ -#define QDD_S_NDCD 0x04 /* data carrier detect, negated (unused) */ -#define QDD_S_NCTS 0x08 /* clear-to-send, negated write-protect */ -#define QDD_S_TUF 0x10 /* transmitter underflow (unused) */ -#define QDD_S_OVR 0x20 /* receiver overrun (unused) */ -#define QDD_S_PE 0x40 /* receiver parity error (unused) */ -#define QDD_S_IRQ 0x80 /* interrupt request */ -#define QDD_S_ERR (QDD_S_TUF | QDD_S_OVR | QDD_S_PE | QDD_S_NDCD | QDD_S_NCTS) - - -/* MC6852 control */ -#define QDD_C1_RIE 0x20 /* interrupt on reveive */ -#define QDD_C1_TIE 0x10 /* interrupt on transmit */ -#define QDD_C1_CLRSYNC 0x08 /* clear receiver sync char (unused) */ -#define QDD_C1_STRIPSYNC 0x04 /* strips sync from received (unused) */ -#define QDD_C1_TRESET 0x02 /* transmitter reset */ -#define QDD_C1_RRESET 0x01 /* receiver reset */ -#define QDD_C2_EIE 0x80 /* interrupt on error */ -#define QDD_C2_TSYNC 0x40 /* underflow = ff if 0 / sync if 1 (unused) */ -#define QDD_C2_BLEN 0x04 /* transfer byte length (unused) */ -#define QDD_C3_CLRTUF 0x08 /* clear underflow */ -#define QDD_C3_CLRCTS 0x04 /* clear CTS */ -#define QDD_C3_SYNCLEN 0x02 /* sync byte length (unused) */ -#define QDD_C3_SYNCMODE 0x01 /* external / internal sync mode (unused) */ - - -/* a track is actually the whole disk = 400 128-byte sectors + headers */ -#define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 +// MC6852 status +enum : uint8_t +{ + QDD_S_RDA = 0x01, // receiver data available + QDD_S_TDRA = 0x02, // transitter data register available + QDD_S_NDCD = 0x04, // data carrier detect, negated (unused) + QDD_S_NCTS = 0x08, // clear-to-send, negated write-protect + QDD_S_TUF = 0x10, // transmitter underflow (unused) + QDD_S_OVR = 0x20, // receiver overrun (unused) + QDD_S_PE = 0x40, // receiver parity error (unused) + QDD_S_IRQ = 0x80, // interrupt request + QDD_S_ERR = (QDD_S_TUF | QDD_S_OVR | QDD_S_PE | QDD_S_NDCD | QDD_S_NCTS) +}; -struct to7qdd_t +// MC6852 control +enum : uint8_t { - /* MC6852 registers */ - uint8_t status; - uint8_t ctrl1; - uint8_t ctrl2; - uint8_t ctrl3; - - /* extra registers */ - uint8_t drive; - - /* internal state */ - uint8_t data[QDD_MAXBUF]; /* enough for a whole track */ - uint32_t data_idx; /* byte position in track */ - uint32_t start_idx; /* start of write position */ - uint32_t data_size; /* track length */ - uint8_t data_crc; /* checksum when writing */ - uint8_t index_pulse; /* one pulse per track */ - + QDD_C1_RIE = 0x20, // interrupt on reveive + QDD_C1_TIE = 0x10, // interrupt on transmit + QDD_C1_CLRSYNC = 0x08, // clear receiver sync char (unused) + QDD_C1_STRIPSYNC = 0x04, // strips sync from received (unused) + QDD_C1_TRESET = 0x02, // transmitter reset + QDD_C1_RRESET = 0x01, // receiver reset + QDD_C2_EIE = 0x80, // interrupt on error + QDD_C2_TSYNC = 0x40, // underflow = ff if 0 / sync if 1 (unused) + QDD_C2_BLEN = 0x04, // transfer byte length (unused) + QDD_C3_CLRTUF = 0x08, // clear underflow + QDD_C3_CLRCTS = 0x04, // clear CTS + QDD_C3_SYNCLEN = 0x02, // sync byte length (unused) + QDD_C3_SYNCMODE = 0x01 // external / internal sync mode (unused) }; -static to7qdd_t * to7qdd; +// a track is actually the whole disk = 400 128-byte sectors + headers +#define QDD_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 + + +DEFINE_DEVICE_TYPE(CQ90_028, cq90_028_device, "cq90_028", "Thomson CQ 90-028 Quick Disk Controller") +cq90_028_device::cq90_028_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) + : device_t(mconfig, CQ90_028, tag, owner, clock) + , thomson_legacy_floppy_interface(mconfig, *this) + , m_qdd_image(*this, "^floppy0") +{ +} -void thomson_state::to7_qdd_index_pulse_cb( int state ) + +void cq90_028_device::index_pulse_cb(int state) { - to7qdd->index_pulse = state; + m_index_pulse = state; if ( state ) { - /* rewind to disk start */ - to7qdd->data_idx = 0; - to7qdd->start_idx = 0; - to7qdd->data_size = 0; + // rewind to disk start + m_data_idx = 0; + m_start_idx = 0; + m_data_size = 0; } VLOG(( "%f to7_qdd_pulse_cb: state=%i\n", machine().time().as_double(), state )); } - -legacy_floppy_image_device * thomson_state::to7_qdd_image() -{ - return m_floppy_image[0].target(); -} - - - -/* update MC6852 status register */ -void thomson_state::to7_qdd_stat_update() +// update MC6852 status register +void cq90_028_device::stat_update() { - /* byte-ready */ - to7qdd->status |= QDD_S_RDA | QDD_S_TDRA; - if ( ! to7qdd->drive ) - to7qdd->status |= QDD_S_PE; - - /* write-protect */ - if (to7_qdd_image()->floppy_wpt_r() == CLEAR_LINE) - to7qdd->status |= QDD_S_NCTS; - - /* sticky reset conditions */ - if ( to7qdd->ctrl1 & QDD_C1_RRESET ) - to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); - if ( to7qdd->ctrl1 & QDD_C1_TRESET ) - to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); - - /* irq update */ - - if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && !(to7qdd->status & QDD_S_RDA ) ) || - ( (to7qdd->ctrl1 & QDD_C1_TIE) && !(to7qdd->status & QDD_S_TDRA) ) || - ( (to7qdd->ctrl2 & QDD_C2_EIE) && !(to7qdd->status & QDD_S_ERR ) ) ) - to7qdd->status &= ~QDD_S_IRQ; - - if ( ( (to7qdd->ctrl1 & QDD_C1_RIE) && (to7qdd->status & QDD_S_RDA ) ) || - ( (to7qdd->ctrl1 & QDD_C1_TIE) && (to7qdd->status & QDD_S_TDRA) ) || - ( (to7qdd->ctrl2 & QDD_C2_EIE) && (to7qdd->status & QDD_S_ERR ) ) ) - to7qdd->status |= QDD_S_IRQ; + // byte-ready + m_status |= QDD_S_RDA | QDD_S_TDRA; + if ( !m_drive ) + m_status |= QDD_S_PE; + + // write-protect + if (m_qdd_image->floppy_wpt_r() == CLEAR_LINE) + m_status |= QDD_S_NCTS; + + // sticky reset conditions + if ( m_ctrl1 & QDD_C1_RRESET ) + m_status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); + if ( m_ctrl1 & QDD_C1_TRESET ) + m_status &= ~(QDD_S_TDRA | QDD_S_TUF); + + // irq update + if ( ( (m_ctrl1 & QDD_C1_RIE) && !(m_status & QDD_S_RDA ) ) || + ( (m_ctrl1 & QDD_C1_TIE) && !(m_status & QDD_S_TDRA) ) || + ( (m_ctrl2 & QDD_C2_EIE) && !(m_status & QDD_S_ERR ) ) ) + m_status &= ~QDD_S_IRQ; + + if ( ( (m_ctrl1 & QDD_C1_RIE) && (m_status & QDD_S_RDA ) ) || + ( (m_ctrl1 & QDD_C1_TIE) && (m_status & QDD_S_TDRA) ) || + ( (m_ctrl2 & QDD_C2_EIE) && (m_status & QDD_S_ERR ) ) ) + m_status |= QDD_S_IRQ; } -uint8_t thomson_state::to7_qdd_read_byte() +uint8_t cq90_028_device::qdd_read_byte() { uint8_t data; - /* rebuild disk if needed */ - if ( !to7qdd->data_size ) + // rebuild disk if needed + if ( !m_data_size ) { - to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); - assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); + m_data_size = qdd_make_disk( m_qdd_image.target(), &m_data[0] ); + assert( m_data_idx < QDD_MAXBUF ); } - if ( to7qdd->data_idx >= to7qdd->data_size ) + if ( m_data_idx >= m_data_size ) data = 0; else - data = to7qdd->data[ to7qdd->data_idx ]; + data = m_data[ m_data_idx ]; - VLOG(( "%f $%04x to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", - machine().time().as_double(), m_maincpu->pc(), - to7qdd->data_idx, to7qdd->data_size, data )); + VLOG(( "%f %s to7_qdd_read_byte: RDATA off=%i/%i data=$%02X\n", + machine().time().as_double(), machine().describe_context(), + m_data_idx, m_data_size, data )); - to7qdd->data_idx++; - to7qdd->start_idx = to7qdd->data_idx; + m_data_idx++; + m_start_idx = m_data_idx; return data; } @@ -589,144 +563,144 @@ uint8_t thomson_state::to7_qdd_read_byte() * CPU write id field and data field => format * CPU write data field after it has read an id field => sector write */ -void thomson_state::to7_qdd_write_byte( uint8_t data ) +void cq90_028_device::qdd_write_byte(uint8_t data) { - int i; - - /* rebuild disk if needed */ - if ( !to7qdd->data_size ) + // rebuild disk if needed + if ( !m_data_size ) { - to7qdd->data_size = thom_qdd_make_disk( to7_qdd_image(), to7qdd->data ); - assert( to7qdd->data_idx < sizeof( to7qdd->data ) ); + m_data_size = qdd_make_disk( m_qdd_image.target(), &m_data[0] ); + assert( m_data_idx < QDD_MAXBUF ); } - if ( ( to7qdd->start_idx != to7qdd->data_idx || /* field in construction */ - data==0xA5 || data==0x5A ) && /* first byte of tentative field */ - to7qdd->data_idx <to7qdd->data_size ) + if ( ( m_start_idx != m_data_idx || // field in construction + data==0xA5 || data==0x5A ) && // first byte of tentative field + m_data_idx < m_data_size ) { - /* this is the first byte of the field */ - if ( to7qdd->start_idx == to7qdd->data_idx ) - to7qdd->data_crc = 0; - - /* accumulate bytes */ - to7qdd->data[ to7qdd->data_idx ] = data; - to7qdd->data_idx++; - - VLOG (( "%f $%04x to7_qdd_write_byte: got $%02X offs=%i-%i\n", - machine().time().as_double(), m_maincpu->pc(), data, - to7qdd->start_idx, to7qdd->data_idx )); - - /* end of tentative id field */ - if ( to7qdd->data_idx == to7qdd->start_idx + 4 && - to7qdd->data[ to7qdd->start_idx ] == 0xA5 && - to7qdd->data[ to7qdd->start_idx + 3 ] == to7qdd->data_crc ) + // this is the first byte of the field + if ( m_start_idx == m_data_idx ) + m_data_crc = 0; + + // accumulate bytes + m_data[ m_data_idx ] = data; + m_data_idx++; + + VLOG (( "%f %s to7_qdd_write_byte: got $%02X offs=%i-%i\n", + machine().time().as_double(), machine().describe_context(), data, + m_start_idx, m_data_idx )); + + // end of tentative id field + if ( m_data_idx == m_start_idx + 4 && + m_data[ m_start_idx ] == 0xA5 && + m_data[ m_start_idx + 3 ] == m_data_crc ) { - /* got an id field => format */ - int sector = (int) to7qdd->data[ to7qdd->start_idx + 1 ] * 256 + (int) to7qdd->data[ to7qdd->start_idx + 2 ]; + // got an id field => format + int sector = (int) m_data[ m_start_idx + 1 ] * 256 + (int) m_data[ m_start_idx + 2 ]; uint8_t filler = 0xff; - LOG(( "%f $%04x to7_qdd_write_byte: got id field for sector=%i\n", - machine().time().as_double(), m_maincpu->pc(), sector )); + LOG(( "%f %s to7_qdd_write_byte: got id field for sector=%i\n", + machine().time().as_double(), machine().describe_context(), sector )); - to7_qdd_image()->floppy_drive_format_sector( + m_qdd_image->floppy_drive_format_sector( 0, sector, 0, 0, sector, 128, filler ); - thom_floppy_active( 1 ); - to7qdd->start_idx = to7qdd->data_idx; + //thom_floppy_active( 1 ); + m_start_idx = m_data_idx; } - /* end of tentative data field */ - else if ( to7qdd->data_idx == to7qdd->start_idx + 130 && - to7qdd->data[ to7qdd->start_idx ] == 0x5A && - to7qdd->data[ to7qdd->start_idx + 129 ] == to7qdd->data_crc ) + // end of tentative data field + else if ( m_data_idx == m_start_idx + 130 && + m_data[ m_start_idx ] == 0x5A && + m_data[ m_start_idx + 129 ] == m_data_crc ) { - /* look backwards for previous id field */ - for ( i = to7qdd->start_idx - 3; i >= 0; i-- ) + int i; + + // look backwards for previous id field + for ( i = m_start_idx - 3; i >= 0; i-- ) { - if ( to7qdd->data[ i ] == 0xA5 && - ( ( to7qdd->data[ i ] + to7qdd->data[ i + 1 ] + - to7qdd->data[ i + 2 ] ) & 0xff - ) == to7qdd->data[ i + 3 ] ) + if ( m_data[ i ] == 0xA5 && + ( ( m_data[ i ] + m_data[ i + 1 ] + + m_data[ i + 2 ] ) & 0xff + ) == m_data[ i + 3 ] ) break; } if ( i >= 0 ) { - /* got an id & a data field => write */ - int sector = (int) to7qdd->data[ i + 1 ] * 256 + (int) to7qdd->data[ i + 2 ]; + // got an id & a data field => write + int sector = (int) m_data[ i + 1 ] * 256 + (int) m_data[ i + 2 ]; - LOG(( "%f $%04x to7_qdd_write_byte: goto data field for sector=%i\n", - machine().time().as_double(), m_maincpu->pc(), sector )); + LOG(( "%f %s to7_qdd_write_byte: goto data field for sector=%i\n", + machine().time().as_double(), machine().describe_context(), sector )); - to7_qdd_image()->floppy_drive_write_sector_data( 0, sector, to7qdd->data + to7qdd->start_idx + 1, 128, 0 ); - thom_floppy_active( 1 ); + m_qdd_image->floppy_drive_write_sector_data( 0, sector, &m_data[ m_start_idx + 1 ], 128, 0 ); + //thom_floppy_active( 1 ); } - to7qdd->start_idx = to7qdd->data_idx; + m_start_idx = m_data_idx; } - else to7qdd->data_crc += data; + else m_data_crc += data; } } -READ8_MEMBER( thomson_state::to7_qdd_r ) +uint8_t cq90_028_device::qdd_r(offs_t offset) { switch ( offset ) { - case 0: /* MC6852 status */ - to7_qdd_stat_update(); - VLOG(( "%f $%04x to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", - machine().time().as_double(), m_maincpu->pc(), to7qdd->status, - to7qdd->status & QDD_S_IRQ ? 1 : 0, - to7qdd->status & QDD_S_PE ? 1 : 0, - to7qdd->status & QDD_S_OVR ? 1 : 0, - to7qdd->status & QDD_S_TUF ? 1 : 0, - to7qdd->status & QDD_S_TDRA ? 1 : 0, - to7qdd->status & QDD_S_RDA ? 1 : 0, - to7qdd->status & QDD_S_NCTS ? 1 : 0 )); - return to7qdd->status; - - case 1: /* MC6852 data input => read byte from disk */ - to7qdd->status &= ~(QDD_S_RDA | QDD_S_PE | QDD_S_OVR); - to7_qdd_stat_update(); - return to7_qdd_read_byte(); - - case 8: /* floppy status */ + case 0: // MC6852 status + stat_update(); + VLOG(( "%f %s to7_qdd_r: STAT=$%02X irq=%i pe=%i ovr=%i und=%i tr=%i rd=%i ncts=%i\n", + machine().time().as_double(), machine().describe_context(), m_status, + m_status & QDD_S_IRQ ? 1 : 0, + m_status & QDD_S_PE ? 1 : 0, + m_status & QDD_S_OVR ? 1 : 0, + m_status & QDD_S_TUF ? 1 : 0, + m_status & QDD_S_TDRA ? 1 : 0, + m_status & QDD_S_RDA ? 1 : 0, + m_status & QDD_S_NCTS ? 1 : 0 )); + return m_status; + + case 1: // MC6852 data input => read byte from disk + m_status &= ~(QDD_S_RDA | QDD_S_PE | QDD_S_OVR); + stat_update(); + return qdd_read_byte(); + + case 8: // floppy status { uint8_t data = 0; - device_image_interface* img = dynamic_cast<device_image_interface *>(to7_qdd_image()); + device_image_interface* img = m_qdd_image.target(); if ( ! img->exists() ) - data |= 0x40; /* disk present */ - if ( to7qdd->index_pulse ) - data |= 0x80; /* disk start */ - VLOG(( "%f $%04x to7_qdd_r: STATUS8 $%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + data |= 0x40; // disk present + if ( m_index_pulse ) + data |= 0x80; // disk start + VLOG(( "%f %s to7_qdd_r: STATUS8 $%02X\n", machine().time().as_double(), machine().describe_context(), data )); return data; } default: - logerror ( "%f $%04x to7_qdd_r: invalid read offset %i\n", machine().time().as_double(), m_maincpu->pc(), offset ); + logerror ( "%f %s to7_qdd_r: invalid read offset %i\n", machine().time().as_double(), machine().describe_context(), offset ); return 0; } } -WRITE8_MEMBER( thomson_state::to7_qdd_w ) +void cq90_028_device::qdd_w(offs_t offset, uint8_t data) { switch ( offset ) { - case 0: /* MC6852 control 1 */ - /* reset */ + case 0: // MC6852 control 1 + // reset if ( data & QDD_C1_RRESET ) - to7qdd->status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); + m_status &= ~(QDD_S_PE | QDD_S_RDA | QDD_S_OVR); if ( data & QDD_C1_TRESET ) - to7qdd->status &= ~(QDD_S_TDRA | QDD_S_TUF); + m_status &= ~(QDD_S_TDRA | QDD_S_TUF); - to7qdd->ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & to7qdd->ctrl1 ); - to7_qdd_stat_update(); - VLOG(( "%f $%04x to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", - machine().time().as_double(), m_maincpu->pc(), data, + m_ctrl1 = ( data & ~(QDD_C1_RRESET | QDD_C1_TRESET) ) |( data & (QDD_C1_RRESET | QDD_C1_TRESET) & m_ctrl1 ); + stat_update(); + VLOG(( "%f %s to7_qdd_w: CTRL1=$%02X reset=%c%c %s%sirq=%c%c\n", + machine().time().as_double(), machine().describe_context(), data, data & QDD_C1_RRESET ? 'r' : '-', data & QDD_C1_TRESET ? 't' : '-', data & QDD_C1_STRIPSYNC ? "strip-sync " : "", data & QDD_C1_CLRSYNC ? "clear-sync " : "", @@ -735,117 +709,109 @@ WRITE8_MEMBER( thomson_state::to7_qdd_w ) break; case 1: - switch ( to7qdd->ctrl1 >> 6 ) + switch ( m_ctrl1 >> 6 ) { - case 0: /* MC6852 control 2 */ + case 0: // MC6852 control 2 { #if 0 - /* most of these are unused now */ + // most of these are unused now static const int bit[8] = { 6, 6, 7, 8, 7, 7, 8, 8 }; static const int par[8] = { 2, 1, 0, 0, 2, 1, 2, 1 }; static const char *const parname[3] = { "none", "odd", "even" }; int bits, parity; bits = bit[ (data >> 3) & 7 ]; parity = par[ (data >> 3) & 7 ]; - to7_qdd_stat_update(machine()); - VLOG(( "%f $%04x to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", - machine().time().as_double(), m_maincpu->pc(), data, + stat_update(); + VLOG(( "%f %s to7_qdd_w: CTRL2=$%02X bits=%i par=%s blen=%i under=%s%s\n", + machine().time().as_double(), machine().describe_context(), data, bits, parname[ parity ], data & QDD_C2_BLEN ? 1 : 2, data & QDD_C2_TSYNC ? "sync" : "ff", data & QDD_C2_EIE ? "irq-err" : "" )); #endif - to7qdd->ctrl2 = data; + m_ctrl2 = data; break; } - case 1: /* MC6852 control 3 */ - to7qdd->ctrl3 = data; - /* reset just once each write, not sticky */ + case 1: // MC6852 control 3 + m_ctrl3 = data; + // reset just once each write, not sticky if ( data & QDD_C3_CLRTUF ) - to7qdd->status &= ~QDD_S_TUF; + m_status &= ~QDD_S_TUF; if ( data & QDD_C3_CLRCTS ) - to7qdd->status &= ~QDD_S_NCTS; - to7_qdd_stat_update(); - VLOG(( "%f $%04x to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", - machine().time().as_double(), m_maincpu->pc(), data, + m_status &= ~QDD_S_NCTS; + stat_update(); + VLOG(( "%f %s to7_qdd_w: CTRL3=$%02X %s%ssync-len=%i sync-mode=%s\n", + machine().time().as_double(), machine().describe_context(), data, data & QDD_C3_CLRTUF ? "clr-tuf " : "", data & QDD_C3_CLRCTS ? "clr-cts " : "", data & QDD_C3_SYNCLEN ? 1 : 2, data & QDD_C3_SYNCMODE ? "ext" : "int" )); break; - case 2: /* MC6852 sync code => write byte to disk */ - to7_qdd_write_byte( data ); + case 2: // MC6852 sync code => write byte to disk + qdd_write_byte( data ); break; - case 3: /* MC6852 data out => does not seem to be used */ - VLOG(( "%f $%04x to7_qdd_w: ignored WDATA=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + case 3: // MC6852 data out => does not seem to be used + VLOG(( "%f %s to7_qdd_w: ignored WDATA=$%02X\n", machine().time().as_double(), machine().describe_context(), data )); break; } break; - case 8: /* set drive */ - to7qdd->drive = data; - VLOG(( "%f $%04x to7_qdd_w: DRIVE=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + case 8: // set drive + m_drive = data; + VLOG(( "%f %s to7_qdd_w: DRIVE=$%02X\n", machine().time().as_double(), machine().describe_context(), data )); break; - case 12: /* motor pulse ? */ - thom_floppy_active( 0 ); - VLOG(( "%f $%04x to7_qdd_w: MOTOR=$%02X\n", machine().time().as_double(), m_maincpu->pc(), data )); + case 12: // motor pulse ? + //thom_floppy_active( 0 ); + VLOG(( "%f %s to7_qdd_w: MOTOR=$%02X\n", machine().time().as_double(), machine().describe_context(), data )); break; default: - logerror ( "%f $%04x to7_qdd_w: invalid write offset %i (data=$%02X)\n", machine().time().as_double(), m_maincpu->pc(), offset, data ); + logerror ( "%f %s to7_qdd_w: invalid write offset %i (data=$%02X)\n", machine().time().as_double(), machine().describe_context(), offset, data ); } } -void thomson_state::to7_qdd_reset() +void cq90_028_device::qdd_reset() { LOG(( "to7_qdd_reset: CQ 90-028 controller\n" )); - for (auto &img : m_floppy_image) - { - if (img.found()) - { - img->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); + m_qdd_image->floppy_drive_set_ready_state( FLOPPY_DRIVE_READY, 0 ); - img->floppy_mon_w(CLEAR_LINE); + m_qdd_image->floppy_mon_w(CLEAR_LINE); - /* pulse each time the whole-disk spiraling track ends */ - /* at 90us per byte read, the disk can be read in 6s */ - img->floppy_drive_set_rpm( 60. / 6. ); - } - } + // pulse each time the whole-disk spiraling track ends + // at 90us per byte read, the disk can be read in 6s + m_qdd_image->floppy_drive_set_rpm( 60. / 6. ); - to7qdd->ctrl1 |= QDD_C1_TRESET | QDD_C1_RRESET; /* reset */ - to7qdd->ctrl2 &= 0x7c; /* clear EIE, PC2-PC1 */ - to7qdd->ctrl3 &= 0xfe; /* internal sync */ - to7qdd->drive = 0; - to7_qdd_stat_update(); + m_ctrl1 |= QDD_C1_TRESET | QDD_C1_RRESET; // reset + m_ctrl2 &= 0x7c; // clear EIE, PC2-PC1 + m_ctrl3 &= 0xfe; // internal sync + m_drive = 0; + stat_update(); } -void thomson_state::to7_qdd_init() +void cq90_028_device::device_start() { - LOG(( "to7_qdd_init: CQ 90-028 controller\n" )); - - to7qdd = auto_alloc(machine(), to7qdd_t); - - save_item(NAME(to7qdd->status)); - save_item(NAME(to7qdd->ctrl1)); - save_item(NAME(to7qdd->ctrl2)); - save_item(NAME(to7qdd->ctrl3)); - save_item(NAME(to7qdd->drive)); - save_item(NAME(to7qdd->data_idx)); - save_item(NAME(to7qdd->start_idx)); - save_item(NAME(to7qdd->data_size)); - save_item(NAME(to7qdd->data_crc)); - save_item(NAME(to7qdd->index_pulse)); - save_item(NAME(to7qdd->data)); + m_data = make_unique_clear<uint8_t[]>(QDD_MAXBUF); + + save_item(NAME(m_status)); + save_item(NAME(m_ctrl1)); + save_item(NAME(m_ctrl2)); + save_item(NAME(m_ctrl3)); + save_item(NAME(m_drive)); + save_item(NAME(m_data_idx)); + save_item(NAME(m_start_idx)); + save_item(NAME(m_data_size)); + save_item(NAME(m_data_crc)); + save_item(NAME(m_index_pulse)); + save_pointer(NAME(m_data), QDD_MAXBUF); } @@ -856,6 +822,16 @@ void thomson_state::to7_qdd_init() */ +// STAT0 flags +enum : uint8_t +{ + STAT0_SYNCHRO = 0x01, // bit clock synchronized + STAT0_BYTE_READY_OP = 0x02, // byte ready (high-level operation) + STAT0_CRC_ERROR = 0x04, + STAT0_FINISHED = 0x08, + STAT0_FINISHING = 0x10, // (unemulated) + STAT0_BYTE_READY_POL = 0x80 // polling mode +}; /*#define THOM_MAXBUF (THOM_SIZE_ID+THOM_SIZE_DATA_HI+2*THOM_SIZE_SYNCHRO)*17*/ #define THOM_MAXBUF ( THOM_QDD_SIZE_ID + THOM_QDD_SIZE_DATA ) * 512 @@ -867,6 +843,7 @@ ALLOW_SAVE_TYPE(thmfc1_device::thmfc1_op); thmfc1_device::thmfc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, THMFC1, tag, owner, clock) + , thomson_legacy_floppy_interface(mconfig, *this) , m_floppy_image(*this, "^floppy%u", 0U) , m_floppy_active_cb(*this) , m_op(OP_RESET) @@ -923,7 +900,7 @@ void thmfc1_device::index_pulse_cb( int index, int state ) if ( floppy_is_qdd(image) ) { - /* pulse each time the whole-disk spiraling track ends */ + // pulse each time the whole-disk spiraling track ends image->floppy_drive_set_rpm( 16.92f /* 423/25 */ ); m_ipl = state; if ( state ) @@ -952,7 +929,7 @@ int thmfc1_device::floppy_find_sector( chrn_id* dst ) chrn_id id; int r = 0; - /* scan track, try 4 revolutions */ + // scan track, try 4 revolutions while ( r < 4 ) { if ( img->floppy_drive_get_next_id( m_side, &id ) ) @@ -981,7 +958,7 @@ int thmfc1_device::floppy_find_sector( chrn_id* dst ) -/* complete command (by read, write, or timeout) */ +// complete command (by read, write, or timeout) void thmfc1_device::floppy_cmd_complete() { LOG (( "%f thmfc_floppy_cmd_complete_cb: cmd=%i off=%i/%i/%i\n", @@ -1010,7 +987,7 @@ TIMER_CALLBACK_MEMBER( thmfc1_device::floppy_cmd_complete_cb ) -/* intelligent read: show just one field, skip header */ +// intelligent read: show just one field, skip header uint8_t thmfc1_device::floppy_read_byte() { uint8_t data = m_data[ m_data_idx ]; @@ -1033,21 +1010,21 @@ uint8_t thmfc1_device::floppy_read_byte() -/* dumb read: show whole track with field headers and gaps */ +// dumb read: show whole track with field headers and gaps uint8_t thmfc1_device::floppy_raw_read_byte() { uint8_t data; - /* rebuild track if needed */ + // rebuild track if needed if ( ! m_data_raw_size ) { if ( floppy_is_qdd(get_floppy_image())) - /* QDD: track = whole disk */ - m_data_raw_size = thom_qdd_make_disk ( get_floppy_image(), &m_data[0] ); + // QDD: track = whole disk + m_data_raw_size = qdd_make_disk ( get_floppy_image(), &m_data[0] ); else { m_data_raw_idx = 0; - m_data_raw_size = thom_floppy_make_track( get_floppy_image(), &m_data[0], + m_data_raw_size = floppy_make_track( get_floppy_image(), &m_data[0], m_sector_size, m_side ); } assert( m_data_raw_size < THOM_MAXBUF ); @@ -1069,7 +1046,7 @@ uint8_t thmfc1_device::floppy_raw_read_byte() -/* QDD writing / formating */ +// QDD writing / formating void thmfc1_device::floppy_qdd_write_byte( uint8_t data ) { int i; @@ -1080,17 +1057,17 @@ void thmfc1_device::floppy_qdd_write_byte( uint8_t data ) { if ( ! m_data_raw_size ) { - m_data_raw_size = thom_qdd_make_disk ( get_floppy_image(), &m_data[0] ); + m_data_raw_size = qdd_make_disk ( get_floppy_image(), &m_data[0] ); assert( m_data_raw_size < THOM_MAXBUF ); } - /* accumulate bytes to form a field */ + // accumulate bytes to form a field m_data[ m_data_raw_idx ] = data; m_data_raw_idx++; if ( ! m_data_idx ) { - /* start */ + // start m_data_crc = 0; m_data_idx = m_data_raw_idx; } @@ -1103,7 +1080,7 @@ void thmfc1_device::floppy_qdd_write_byte( uint8_t data ) m_data[ m_data_idx - 1 ] == 0xA5 && m_data[ m_data_idx + 2 ] == m_data_crc ) { - /* got an id field => format */ + // got an id field => format int sector = (int) m_data[ m_data_idx ] * 256 + (int) m_data[ m_data_idx + 1 ]; uint8_t filler = 0xff; @@ -1118,7 +1095,7 @@ void thmfc1_device::floppy_qdd_write_byte( uint8_t data ) m_data[ m_data_idx - 1 ] == 0x5A && m_data[ m_data_idx + 128 ] == m_data_crc ) { - /* look backwards for previous id field */ + // look backwards for previous id field for ( i = m_data_idx - 4; i >= 0; i-- ) { if ( m_data[ i ] == 0xA5 && @@ -1130,7 +1107,7 @@ void thmfc1_device::floppy_qdd_write_byte( uint8_t data ) if ( i >= 0 ) { - /* got an id & a data field => write */ + // got an id & a data field => write legacy_floppy_image_device * img = get_floppy_image(); int sector = (int) m_data[ i + 1 ] * 256 + (int) m_data[ i + 2 ]; @@ -1158,7 +1135,7 @@ void thmfc1_device::floppy_qdd_write_byte( uint8_t data ) -/* intelligent writing */ +// intelligent writing void thmfc1_device::floppy_write_byte( uint8_t data ) { VLOG (( "%f %s thmfc_floppy_write_byte: off=%i/%i data=$%02X\n", @@ -1173,14 +1150,14 @@ void thmfc1_device::floppy_write_byte( uint8_t data ) m_data_idx++; } -/* intelligent formatting */ +// intelligent formatting void thmfc1_device::floppy_format_byte( uint8_t data ) { VLOG (( "%f %s thmfc_floppy_format_byte: $%02X\n", machine().time().as_double(), machine().describe_context(), data )); m_data_raw_size = 0; - /* accumulate bytes to form an id field */ + // accumulate bytes to form an id field if ( m_data_idx || data==0xA1 ) { static const uint8_t header[] = { 0xa1, 0xa1, 0xa1, 0xfe }; @@ -1190,13 +1167,13 @@ void thmfc1_device::floppy_format_byte( uint8_t data ) { if ( !memcmp ( &m_data[0], header, sizeof( header ) ) ) { - /* got id field => format */ + // got id field => format legacy_floppy_image_device * img = get_floppy_image(); uint8_t track = m_data[4]; uint8_t side = m_data[5]; uint8_t sector = m_data[6]; - uint8_t length = m_data[7]; /* actually, log length */ - uint8_t filler = 0xe5; /* standard Thomson filler */ + uint8_t length = m_data[7]; // actually, log length + uint8_t filler = 0xe5; // standard Thomson filler chrn_id id; if ( floppy_find_sector( &id ) ) @@ -1218,12 +1195,12 @@ uint8_t thmfc1_device::floppy_r(offs_t offset) { switch ( offset ) { - case 0: /* STAT0 */ + case 0: // STAT0 m_stat0 ^= STAT0_SYNCHRO | STAT0_BYTE_READY_POL; VLOG(( "%f %s thmfc_floppy_r: STAT0=$%02X\n", machine().time().as_double(), machine().describe_context(), m_stat0 )); return m_stat0; - case 1: /* STAT1 */ + case 1: // STAT1 { uint8_t data = 0; legacy_floppy_image_device * img = get_floppy_image(); @@ -1231,17 +1208,17 @@ uint8_t thmfc1_device::floppy_r(offs_t offset) if ( floppy_is_qdd(img) ) { if ( ! img->exists() ) - data |= 0x40; /* disk present */ + data |= 0x40; // disk present if ( ! m_ipl ) - data |= 0x02; /* disk start */ - data |= 0x08; /* connected */ + data |= 0x02; // disk start + data |= 0x08; // connected } else { if ( m_ipl ) data |= 0x40; if ( img->exists() ) - data |= 0x20; /* disk change (?) */ + data |= 0x20; // disk change (?) data |= !img->floppy_tk00_r() << 3; @@ -1256,7 +1233,7 @@ uint8_t thmfc1_device::floppy_r(offs_t offset) return data; } - case 3: /* RDATA */ + case 3: // RDATA if ( m_op == OP_READ_SECT || m_op == OP_READ_ADDR ) return floppy_read_byte(); @@ -1268,7 +1245,7 @@ uint8_t thmfc1_device::floppy_r(offs_t offset) case 8: { - /* undocumented => emulate TO7 QDD controller ? */ + // undocumented => emulate TO7 QDD controller ? uint8_t data = m_ipl << 7; VLOG(( "%f %s thmfc_floppy_r: STAT8=$%02X\n", machine().time().as_double(), machine().describe_context(), data )); return data; @@ -1285,7 +1262,7 @@ uint8_t thmfc1_device::floppy_r(offs_t offset) void thmfc1_device::floppy_w(offs_t offset, uint8_t data) { switch ( offset ) { - case 0: /* CMD0 */ + case 0: // CMD0 { int wsync = (data >> 4) & 1; int qdd = floppy_is_qdd(get_floppy_image()); @@ -1297,7 +1274,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) wsync, (data >> 3) & 1, m_formatting, data & 3 )); - /* abort previous command, if any */ + // abort previous command, if any m_op = OP_RESET; m_floppy_cmd->adjust(attotime::never); @@ -1314,7 +1291,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) { m_sector_id = id.data_id; m_data_idx = 0; - m_data_size = m_sector_size + 3; /* A1 A1 FB <data> */ + m_data_size = m_sector_size + 3; // A1 A1 FB <data> m_data_finish = m_sector_size + 3; m_stat0 |= STAT0_BYTE_READY_OP; m_op = OP_WRITE_SECT; @@ -1328,7 +1305,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) else if ( floppy_find_sector( &id ) ) { m_data_size = - thom_floppy_make_addr( id, &m_data[0], m_sector_size ); + floppy_make_addr( id, &m_data[0], m_sector_size ); assert( m_data_size < THOM_MAXBUF ); m_data_finish = 10; m_data_idx = 1; @@ -1343,7 +1320,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) logerror( "thmfc_floppy_w: smart operation 3 not supported for QDD\n" ); else if ( floppy_find_sector( &id ) ) { - m_data_size = thom_floppy_make_sector + m_data_size = floppy_make_sector ( get_floppy_image(), id, &m_data[0], m_sector_size ); assert( m_data_size < THOM_MAXBUF ); m_data_finish = m_sector_size + 4; @@ -1355,10 +1332,10 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) break; } - /* synchronize to word, if needed (QDD only) */ + // synchronize to word, if needed (QDD only) if ( wsync && qdd ) { if ( ! m_data_raw_size ) - m_data_raw_size = thom_qdd_make_disk ( get_floppy_image(), &m_data[0] ); + m_data_raw_size = qdd_make_disk ( get_floppy_image(), &m_data[0] ); while ( m_data_raw_idx < m_data_raw_size && m_data[ m_data_raw_idx ] != m_wsync ) { @@ -1370,7 +1347,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) break; - case 1: /* CMD1 */ + case 1: // CMD1 m_data_raw_size = 0; m_sector_size = 128 << ( (data >> 5) & 3); m_side = (data >> 4) & 1; @@ -1387,7 +1364,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) break; - case 2: /* CMD2 */ + case 2: // CMD2 { legacy_floppy_image_device * img; int seek = 0, motor; @@ -1397,7 +1374,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) if ( floppy_is_qdd(img)) { motor = !(data & 0x40); - /* no side select & no seek for QDD */ + // no side select & no seek for QDD } else { @@ -1430,7 +1407,7 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) break; - case 3: /* WDATA */ + case 3: // WDATA m_wsync = data; if ( floppy_is_qdd(get_floppy_image())) floppy_qdd_write_byte( data ); @@ -1440,35 +1417,35 @@ void thmfc1_device::floppy_w(offs_t offset, uint8_t data) floppy_format_byte( data ); else { - /* TODO: implement other forms of raw track writing */ + // TODO: implement other forms of raw track writing LOG (( "%f %s thmfc_floppy_w: ignored raw WDATA $%02X\n", machine().time().as_double(), machine().describe_context(), data )); } break; - case 4: /* WCLK (unemulated) */ - /* clock configuration: FF for data, 0A for synchro */ + case 4: // WCLK (unemulated) + // clock configuration: FF for data, 0A for synchro LOG (( "%f %s thmfc_floppy_w: WCLK=$%02X (%s)\n", machine().time().as_double(), machine().describe_context(), data, (data == 0xff) ? "data" : (data == 0x0A) ? "synchro" : "?" )); break; - case 5: /* WSECT */ + case 5: // WSECT m_sector = data; LOG (( "%f %s thmfc_floppy_w: WSECT=%i\n", machine().time().as_double(), machine().describe_context(), data )); break; - case 6: /* WTRCK */ + case 6: // WTRCK m_track = data; LOG (( "%f %s thmfc_floppy_w: WTRCK=%i (real=%i)\n", machine().time().as_double(), machine().describe_context(), data, get_floppy_image()->floppy_drive_get_current_track())); break; - case 7: /* WCELL */ - /* precompensation (unemulated) */ + case 7: // WCELL + // precompensation (unemulated) LOG (( "%f %s thmfc_floppy_w: WCELL=$%02X\n", machine().time().as_double(), machine().describe_context(), data )); break; @@ -1658,14 +1635,14 @@ void thomson_state::to7_network_reset() -READ8_MEMBER( thomson_state::to7_network_r ) +uint8_t thomson_state::to7_network_r(offs_t offset) { if ( offset < 4 ) - return m_mc6854->read( offset ); + return m_mc6854->read(offset); if ( offset == 8 ) { - /* network ID of the computer */ + // network ID of the computer uint8_t id = m_io_fconfig->read() >> 3; VLOG(( "%f $%04x to7_network_r: read id $%02X\n", machine().time().as_double(), m_maincpu->pc(), id )); return id; @@ -1677,10 +1654,10 @@ READ8_MEMBER( thomson_state::to7_network_r ) -WRITE8_MEMBER( thomson_state::to7_network_w ) +void thomson_state::to7_network_w(offs_t offset, uint8_t data) { if ( offset < 4 ) - m_mc6854->write( offset, data ); + m_mc6854->write(offset, data); else { logerror( "%f $%04x to7_network_w: invalid write offset %i (data=$%02X)\n", @@ -1704,10 +1681,6 @@ WRITE8_MEMBER( thomson_state::to7_network_w ) -uint8_t to7_controller_type; -uint8_t to7_floppy_bank; - - void thomson_state::to7_floppy_init() { m_flopbank->configure_entry( 0, memregion("floppy_none")->base() ); @@ -1716,11 +1689,10 @@ void thomson_state::to7_floppy_init() m_flopbank->configure_entries( 3, 4, memregion("floppy_cd90_351")->base(), 0x800 ); m_flopbank->configure_entry( 7, memregion("floppy_cq90_028")->base() ); m_flopbank->configure_entry( 8, memregion("floppy_nano")->base() ); - save_item(NAME(to7_controller_type)); - save_item(NAME(to7_floppy_bank)); + save_item(NAME(m_to7_controller_type)); + save_item(NAME(m_to7_floppy_bank)); to7_5p14sd_init(); to7_5p14_init(); - to7_qdd_init(); to7_network_init(); } @@ -1728,63 +1700,63 @@ void thomson_state::to7_floppy_init() void thomson_state::to7_floppy_reset() { - to7_controller_type = (m_io_fconfig->read() ) & 7; + m_to7_controller_type = (m_io_fconfig->read() ) & 7; - switch ( to7_controller_type ) + switch ( m_to7_controller_type ) { case 1: - to7_floppy_bank = 1; + m_to7_floppy_bank = 1; to7_5p14sd_reset(); break; case 2: - to7_floppy_bank = 2; + m_to7_floppy_bank = 2; to7_5p14_reset(); break; case 3: - to7_floppy_bank = 3; + m_to7_floppy_bank = 3; m_thmfc->floppy_reset(); break; case 4: - to7_floppy_bank = 7; - to7_qdd_reset(); + m_to7_floppy_bank = 7; + m_to7qdd->qdd_reset(); break; case 5: - to7_floppy_bank = 8; + m_to7_floppy_bank = 8; to7_network_reset(); break; default: - to7_floppy_bank = 0; + m_to7_floppy_bank = 0; break; } - m_flopbank->set_entry( to7_floppy_bank ); + m_flopbank->set_entry( m_to7_floppy_bank ); } -READ8_MEMBER( thomson_state::to7_floppy_r ) +uint8_t thomson_state::to7_floppy_r(offs_t offset) { - switch ( to7_controller_type ) + switch (m_to7_controller_type) { case 1: - return to7_5p14sd_r( space, offset, mem_mask ); + return to7_5p14sd_r(offset); case 2: - return to7_5p14_r( space, offset, mem_mask ); + return to7_5p14_r(offset); case 3: - return m_thmfc->floppy_r( offset ); + return m_thmfc->floppy_r(offset); case 4: - return to7_qdd_r( space, offset, mem_mask ); + return m_to7qdd->qdd_r(offset); case 5: - return to7_network_r( space, offset, mem_mask ); + return to7_network_r(offset); } return 0; @@ -1792,35 +1764,35 @@ READ8_MEMBER( thomson_state::to7_floppy_r ) -WRITE8_MEMBER( thomson_state::to7_floppy_w ) +void thomson_state::to7_floppy_w(offs_t offset, uint8_t data) { - switch ( to7_controller_type ) + switch (m_to7_controller_type) { case 1: - to7_5p14sd_w( space, offset, data, mem_mask ); + to7_5p14sd_w(offset, data); return; case 2: - to7_5p14_w( space, offset, data, mem_mask ); + to7_5p14_w(offset, data); break; case 3: - if ( offset == 8 ) + if (offset == 8) { - to7_floppy_bank = 3 + (data & 3); - m_flopbank->set_entry( to7_floppy_bank ); + m_to7_floppy_bank = 3 + (data & 3); + m_flopbank->set_entry(m_to7_floppy_bank); VLOG (( "to7_floppy_w: set CD 90-351 ROM bank to %i\n", data & 3 )); } else - m_thmfc->floppy_w( offset, data ); + m_thmfc->floppy_w(offset, data); break; case 4: - to7_qdd_w( space, offset, data, mem_mask ); + m_to7qdd->qdd_w(offset, data); break; case 5: - to7_network_w( space, offset, data, mem_mask ); + to7_network_w(offset, data); break; } } @@ -1860,25 +1832,25 @@ void thomson_state::to9_floppy_reset() -READ8_MEMBER( thomson_state::to9_floppy_r ) +uint8_t thomson_state::to9_floppy_r(offs_t offset) { if ( THOM_FLOPPY_EXT ) - return to7_floppy_r( space, offset ); + return to7_floppy_r( offset ); else - return to7_5p14_r( space, offset, mem_mask ); + return to7_5p14_r( offset ); } -WRITE8_MEMBER( thomson_state::to9_floppy_w ) +void thomson_state::to9_floppy_w(offs_t offset, uint8_t data) { if ( THOM_FLOPPY_EXT ) - to7_floppy_w( space, offset, data ); + to7_floppy_w( offset, data ); else - to7_5p14_w( space, offset, data, mem_mask ); + to7_5p14_w( offset, data ); } void thomson_state::thomson_index_callback(int index, int state) { - switch ( to7_controller_type ) + switch ( m_to7_controller_type ) { case 1: to7_5p14_index_pulse_callback(state); @@ -1892,7 +1864,7 @@ void thomson_state::thomson_index_callback(int index, int state) break; case 4: - to7_qdd_index_pulse_cb(state); + m_to7qdd->index_pulse_cb(state); break; default: diff --git a/src/mame/machine/thomflop.h b/src/mame/machine/thomflop.h index 9e637a583cf..e1ac27a036d 100644 --- a/src/mame/machine/thomflop.h +++ b/src/mame/machine/thomflop.h @@ -16,37 +16,40 @@ #include "machine/mc6843.h" #include "machine/mc6854.h" -extern uint8_t to7_controller_type; /* set during init */ -extern uint8_t to7_floppy_bank; - /* number of external floppy controller ROM banks */ #define TO7_NB_FLOP_BANK 9 /* external floppy / network controller active */ -#define THOM_FLOPPY_EXT (to7_controller_type >= 1) +#define THOM_FLOPPY_EXT (m_to7_controller_type >= 1) /* internal floppy controller active (no or network extension) */ -#define THOM_FLOPPY_INT (to7_controller_type == 0 || to7_controller_type > 4) +#define THOM_FLOPPY_INT (m_to7_controller_type == 0 || m_to7_controller_type > 4) /* external controllers */ /* TO9 internal (WD2793) & external controllers */ /* TO8 internal (THMFC1) controller */ -class thmfc1_device : public device_t +class thomson_legacy_floppy_interface : public device_interface { -public: - // STAT0 flags - enum : uint8_t +protected: + thomson_legacy_floppy_interface(const machine_config &mconfig, device_t &device) + : device_interface(device, "thom_flop") { - STAT0_SYNCHRO = 0x01, // bit clock synchronized - STAT0_BYTE_READY_OP = 0x02, // byte ready (high-level operation) - STAT0_CRC_ERROR = 0x04, - STAT0_FINISHED = 0x08, - STAT0_FINISHING = 0x10, // (unemulated) - STAT0_BYTE_READY_POL = 0x80 // polling mode - }; + } + + static int floppy_make_addr(chrn_id id, uint8_t *dst, int sector_size); + static int floppy_make_sector(legacy_floppy_image_device *img, chrn_id id, uint8_t *dst, int sector_size); + static int floppy_make_track(legacy_floppy_image_device *img, uint8_t *dst, int sector_size, int side); + + static int qdd_make_addr(int sector, uint8_t *dst); + static int qdd_make_sector(legacy_floppy_image_device *img, int sector, uint8_t *dst); + static int qdd_make_disk(legacy_floppy_image_device *img, uint8_t *dst); +}; +class thmfc1_device : public device_t, public thomson_legacy_floppy_interface +{ +public: thmfc1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); auto floppy_active_cb() { return m_floppy_active_cb.bind(); } @@ -111,6 +114,46 @@ private: emu_timer *m_floppy_cmd; }; +class cq90_028_device : public device_t, public thomson_legacy_floppy_interface +{ +public: + cq90_028_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + uint8_t qdd_r(offs_t offset); + void qdd_w(offs_t offset, uint8_t data); + + void index_pulse_cb(int state); + void qdd_reset(); + +protected: + virtual void device_start() override; + +private: + void stat_update(); + uint8_t qdd_read_byte(); + void qdd_write_byte(uint8_t data); + + required_device<legacy_floppy_image_device> m_qdd_image; + + // MC6852 registers + uint8_t m_status; + uint8_t m_ctrl1; + uint8_t m_ctrl2; + uint8_t m_ctrl3; + + // extra registers + uint8_t m_drive; + + // internal state + std::unique_ptr<uint8_t[]> m_data; // enough for a whole track + uint32_t m_data_idx; // byte position in track + uint32_t m_start_idx; // start of write position + uint32_t m_data_size; // track length + uint8_t m_data_crc; // checksum when writing + uint8_t m_index_pulse; // one pulse per track +}; + DECLARE_DEVICE_TYPE(THMFC1, thmfc1_device) +DECLARE_DEVICE_TYPE(CQ90_028, cq90_028_device) #endif /* THOMFLOP_H_ */ diff --git a/src/mame/machine/thomson.cpp b/src/mame/machine/thomson.cpp index 37c29966c96..6ff719b606b 100644 --- a/src/mame/machine/thomson.cpp +++ b/src/mame/machine/thomson.cpp @@ -2891,7 +2891,7 @@ void thomson_state::to8_kbd_init() void thomson_state::to8_update_floppy_bank() { - int bank = (m_to8_reg_sys1 & 0x80) ? to7_floppy_bank : (m_to8_bios_bank + TO7_NB_FLOP_BANK); + int bank = (m_to8_reg_sys1 & 0x80) ? m_to7_floppy_bank : (m_to8_bios_bank + TO7_NB_FLOP_BANK); if ( bank != m_old_floppy_bank ) { @@ -3178,7 +3178,7 @@ READ8_MEMBER( thomson_state::to8_floppy_r ) if ( (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) /* external controller */ - return to7_floppy_r( space, offset ); + return to7_floppy_r( offset ); else if ( ! (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) /* internal controller */ return m_thmfc->floppy_r( offset ); @@ -3193,7 +3193,7 @@ WRITE8_MEMBER( thomson_state::to8_floppy_w ) { if ( (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_EXT ) /* external controller */ - to7_floppy_w( space, offset, data ); + to7_floppy_w( offset, data ); else if ( ! (m_to8_reg_sys1 & 0x80) && THOM_FLOPPY_INT ) /* internal controller */ m_thmfc->floppy_w( offset, data ); @@ -3321,7 +3321,7 @@ READ8_MEMBER( thomson_state::to8_vreg_r ) return 0; if ( THOM_FLOPPY_EXT ) - return to7_floppy_r( space, 0xc ); + return to7_floppy_r( 0xc ); else return 0; } @@ -3386,7 +3386,7 @@ WRITE8_MEMBER( thomson_state::to8_vreg_w ) if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) && ( m_to8_reg_sys1 & 0x80 ) ) { if ( THOM_FLOPPY_EXT ) - to7_floppy_w( space, 0xc, data ); + to7_floppy_w( 0xc, data ); } else { @@ -4269,7 +4269,7 @@ READ8_MEMBER( thomson_state::mo6_vreg_r ) if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) ) { if ( !machine().side_effects_disabled() ) - return to7_floppy_r( space, 0xc ); + return to7_floppy_r( 0xc ); } switch ( offset ) @@ -4305,7 +4305,7 @@ WRITE8_MEMBER( thomson_state::mo6_vreg_w ) case 2: /* display / external floppy register */ if ( ( m_to8_reg_sys1 & 0x80 ) && ( m_to8_reg_ram & 0x80 ) ) - to7_floppy_w( space, 0xc, data ); + to7_floppy_w( 0xc, data ); else to9_set_video_mode( data, 2 ); break; @@ -4313,7 +4313,7 @@ WRITE8_MEMBER( thomson_state::mo6_vreg_w ) case 3: /* system register 2 */ /* 0xa7dc from external floppy drive aliases the video gate-array */ if ( ( offset == 3 ) && ( m_to8_reg_ram & 0x80 ) ) - to7_floppy_w( space, 0xc, data ); + to7_floppy_w( 0xc, data ); else { m_to8_reg_sys2 = data; @@ -4452,8 +4452,8 @@ READ8_MEMBER( thomson_state::mo5nr_net_r ) if ( machine().side_effects_disabled() ) return 0; - if ( to7_controller_type ) - return to7_floppy_r ( space, offset ); + if ( m_to7_controller_type ) + return to7_floppy_r ( offset ); logerror( "$%04x %f mo5nr_net_r: read from reg %i\n", m_maincpu->pc(), machine().time().as_double(), offset ); @@ -4464,8 +4464,8 @@ READ8_MEMBER( thomson_state::mo5nr_net_r ) WRITE8_MEMBER( thomson_state::mo5nr_net_w ) { - if ( to7_controller_type ) - to7_floppy_w ( space, offset, data ); + if ( m_to7_controller_type ) + to7_floppy_w ( offset, data ); else logerror( "$%04x %f mo5nr_net_w: write $%02X to reg %i\n", m_maincpu->pc(), machine().time().as_double(), data, offset ); |