diff options
Diffstat (limited to 'src/devices/bus/ti99/peb/cc_fdc.cpp')
-rw-r--r-- | src/devices/bus/ti99/peb/cc_fdc.cpp | 113 |
1 files changed, 58 insertions, 55 deletions
diff --git a/src/devices/bus/ti99/peb/cc_fdc.cpp b/src/devices/bus/ti99/peb/cc_fdc.cpp index 9ef1f1531d9..d215560e8b0 100644 --- a/src/devices/bus/ti99/peb/cc_fdc.cpp +++ b/src/devices/bus/ti99/peb/cc_fdc.cpp @@ -32,18 +32,18 @@ // ---------------------------------- // Flags for debugging -#define LOG_WARN (1U<<1) // Warnings -#define LOG_CONFIG (1U<<2) // Configuration -#define LOG_EPROM (1U<<3) // Access to EPROM -#define LOG_CONTR (1U<<4) // Access to controller -#define LOG_RAM (1U<<5) // Access to SRAM -#define LOG_READY (1U<<6) // READY line -#define LOG_SIGNALS (1U<<7) // IRQ and HLD lines -#define LOG_DRQ (1U<<8) // DRQ line (too noisy in SIGNALS) -#define LOG_DRIVE (1U<<9) // Drive operations -#define LOG_CRU (1U<<10) // CRU operations - -#define VERBOSE ( LOG_GENERAL | LOG_WARN | LOG_CONFIG ) +#define LOG_WARN (1U << 1) // Warnings +#define LOG_CONFIG (1U << 2) // Configuration +#define LOG_EPROM (1U << 3) // Access to EPROM +#define LOG_CONTR (1U << 4) // Access to controller +#define LOG_RAM (1U << 5) // Access to SRAM +#define LOG_READY (1U << 6) // READY line +#define LOG_SIGNALS (1U << 7) // IRQ and HLD lines +#define LOG_DRQ (1U << 8) // DRQ line (too noisy in SIGNALS) +#define LOG_DRIVE (1U << 9) // Drive operations +#define LOG_CRU (1U << 10) // CRU operations + +#define VERBOSE (LOG_GENERAL | LOG_WARN | LOG_CONFIG) #include "logmacro.h" #define CCDCC_TAG "ti99_ccdcc" @@ -59,16 +59,16 @@ #define BUFFER "ram" -DEFINE_DEVICE_TYPE_NS(TI99_CCDCC, bus::ti99::peb, corcomp_dcc_device, CCDCC_TAG, "CorComp Disk Controller Card") -DEFINE_DEVICE_TYPE_NS(TI99_CCFDC, bus::ti99::peb, corcomp_fdca_device, CCFDC_TAG, "CorComp Floppy Disk Controller Card Rev A") +DEFINE_DEVICE_TYPE(TI99_CCDCC, bus::ti99::peb::corcomp_dcc_device, CCDCC_TAG, "CorComp Disk Controller Card") +DEFINE_DEVICE_TYPE(TI99_CCFDC, bus::ti99::peb::corcomp_fdca_device, CCFDC_TAG, "CorComp Floppy Disk Controller Card Rev A") -DEFINE_DEVICE_TYPE_NS(CCDCC_PALU2, bus::ti99::peb, ccdcc_palu2_device, CCDCC_PALU2_TAG, "CorComp DCC PAL u2") -DEFINE_DEVICE_TYPE_NS(CCDCC_PALU1, bus::ti99::peb, ccdcc_palu1_device, CCDCC_PALU1_TAG, "CorComp DCC PAL u1") +DEFINE_DEVICE_TYPE(CCDCC_PALU2, bus::ti99::peb::ccdcc_palu2_device, CCDCC_PALU2_TAG, "CorComp DCC PAL u2") +DEFINE_DEVICE_TYPE(CCDCC_PALU1, bus::ti99::peb::ccdcc_palu1_device, CCDCC_PALU1_TAG, "CorComp DCC PAL u1") -DEFINE_DEVICE_TYPE_NS(CCFDC_PALU12, bus::ti99::peb, ccfdc_palu12_device, CCFDC_PALU12_TAG, "CorComp FDC PAL u12") -DEFINE_DEVICE_TYPE_NS(CCFDC_PALU6, bus::ti99::peb, ccfdc_palu6_device, CCFDC_PALU6_TAG, "CorComp FDC PAL u6") +DEFINE_DEVICE_TYPE(CCFDC_PALU12, bus::ti99::peb::ccfdc_palu12_device, CCFDC_PALU12_TAG, "CorComp FDC PAL u12") +DEFINE_DEVICE_TYPE(CCFDC_PALU6, bus::ti99::peb::ccfdc_palu6_device, CCFDC_PALU6_TAG, "CorComp FDC PAL u6") -namespace bus { namespace ti99 { namespace peb { +namespace bus::ti99::peb { // ---------------------------------- @@ -102,7 +102,7 @@ void corcomp_fdc_device::setaddress_dbin(offs_t offset, int state) /* Provides the current address to the PALs. */ -uint16_t corcomp_fdc_device::get_address() +offs_t corcomp_fdc_device::get_address() { return m_address; } @@ -133,7 +133,7 @@ bool corcomp_fdc_device::write_access() */ void corcomp_fdc_device::debug_read(offs_t offset, uint8_t* value) { - uint16_t saveaddress = m_address; + offs_t saveaddress = m_address; m_address = offset; *value = 0x00; @@ -147,7 +147,7 @@ void corcomp_fdc_device::debug_read(offs_t offset, uint8_t* value) if (m_ctrlpal->selectdsr()) { // EPROM selected - uint16_t base = m_banksel? 0x2000 : 0; + offs_t base = m_banksel? 0x2000 : 0; uint8_t* rom = &m_dsrrom[base | (m_address & 0x1fff)]; *value = *rom; } @@ -156,7 +156,7 @@ void corcomp_fdc_device::debug_read(offs_t offset, uint8_t* value) void corcomp_fdc_device::debug_write(offs_t offset, uint8_t data) { - uint16_t saveaddress = m_address; + offs_t saveaddress = m_address; m_address = offset; if (m_ctrlpal->selectram()) { @@ -177,19 +177,19 @@ void corcomp_fdc_device::operate_ready_line() /* Callbacks from the WDC chip */ -WRITE_LINE_MEMBER( corcomp_fdc_device::fdc_irq_w ) +void corcomp_fdc_device::fdc_irq_w(int state) { LOGMASKED(LOG_SIGNALS, "INTRQ callback = %d\n", state); operate_ready_line(); } -WRITE_LINE_MEMBER( corcomp_fdc_device::fdc_drq_w ) +void corcomp_fdc_device::fdc_drq_w(int state) { LOGMASKED(LOG_DRQ, "DRQ callback = %d\n", state); operate_ready_line(); } -WRITE_LINE_MEMBER( corcomp_fdc_device::fdc_hld_w ) +void corcomp_fdc_device::fdc_hld_w(int state) { LOGMASKED(LOG_SIGNALS, "HLD callback = %d\n", state); } @@ -219,7 +219,7 @@ void corcomp_fdc_device::readz(offs_t offset, uint8_t *value) if (m_ctrlpal->selectdsr()) { // EPROM selected - uint16_t base = m_banksel? 0x2000 : 0; + offs_t base = m_banksel? 0x2000 : 0; uint8_t* rom = &m_dsrrom[base | (m_address & 0x1fff)]; *value = *rom; @@ -281,7 +281,7 @@ void corcomp_fdc_device::cruwrite(offs_t offset, uint8_t data) } } -WRITE_LINE_MEMBER( corcomp_fdc_device::clock_in ) +void corcomp_fdc_device::clock_in(int state) { m_tms9901->phi_line(state); } @@ -329,7 +329,7 @@ uint8_t corcomp_fdc_device::tms9901_input(offs_t offset) } } -WRITE_LINE_MEMBER( corcomp_fdc_device::select_dsk ) +void corcomp_fdc_device::select_dsk(int state) { if (state == CLEAR_LINE) { @@ -371,7 +371,7 @@ WRITE_LINE_MEMBER( corcomp_fdc_device::select_dsk ) } } -WRITE_LINE_MEMBER( corcomp_fdc_device::side_select ) +void corcomp_fdc_device::side_select(int state) { // Select side of disk (bit 7) if (m_selected_drive != 0) @@ -384,7 +384,7 @@ WRITE_LINE_MEMBER( corcomp_fdc_device::side_select ) /* All floppy motors are operated by the same line. */ -WRITE_LINE_MEMBER( corcomp_fdc_device::motor_w ) +void corcomp_fdc_device::motor_w(int state) { LOGMASKED(LOG_DRIVE, "Motor %s\n", state? "on" : "off"); m_wdc->set_force_ready(state==ASSERT_LINE); @@ -398,14 +398,14 @@ WRITE_LINE_MEMBER( corcomp_fdc_device::motor_w ) /* Push the P11 state to the variable. */ -WRITE_LINE_MEMBER( corcomp_fdc_device::select_bank ) +void corcomp_fdc_device::select_bank(int state) { LOGMASKED(LOG_CRU, "Set bank %d\n", state); m_banksel = (state==ASSERT_LINE); operate_ready_line(); } -WRITE_LINE_MEMBER( corcomp_fdc_device::select_card ) +void corcomp_fdc_device::select_card(int state) { LOGMASKED(LOG_CRU, "Select card = %d\n", state); m_cardsel = (state==ASSERT_LINE); @@ -448,32 +448,34 @@ void corcomp_fdc_device::connect_drives() INPUT_PORTS_START( cc_fdc ) PORT_START( "HEADSTEP" ) - PORT_DIPNAME( 0x03, 0x00, "DSK1 head step time" ) + PORT_DIPNAME( 0x03, 0x02, "DSK1 head step time" ) PORT_DIPSETTING( 0x00, "15 ms") PORT_DIPSETTING( 0x01, "10 ms") PORT_DIPSETTING( 0x02, "6 ms") PORT_DIPSETTING( 0x03, "3 ms") - PORT_DIPNAME( 0x0c, 0x00, "DSK2 head step time" ) + PORT_DIPNAME( 0x0c, 0x08, "DSK2 head step time" ) PORT_DIPSETTING( 0x00, "15 ms") PORT_DIPSETTING( 0x04, "10 ms") PORT_DIPSETTING( 0x08, "6 ms") PORT_DIPSETTING( 0x0c, "3 ms") - PORT_DIPNAME( 0x30, 0x00, "DSK3 head step time" ) + PORT_DIPNAME( 0x30, 0x20, "DSK3 head step time" ) PORT_DIPSETTING( 0x00, "15 ms") PORT_DIPSETTING( 0x10, "10 ms") PORT_DIPSETTING( 0x20, "6 ms") PORT_DIPSETTING( 0x30, "3 ms") - PORT_DIPNAME( 0xc0, 0x00, "DSK4 head step time" ) + PORT_DIPNAME( 0xc0, 0x80, "DSK4 head step time" ) PORT_DIPSETTING( 0x00, "15 ms") PORT_DIPSETTING( 0x40, "10 ms") PORT_DIPSETTING( 0x80, "6 ms") PORT_DIPSETTING( 0xc0, "3 ms") INPUT_PORTS_END -FLOPPY_FORMATS_MEMBER(corcomp_fdc_device::floppy_formats) - FLOPPY_TI99_SDF_FORMAT, - FLOPPY_TI99_TDF_FORMAT -FLOPPY_FORMATS_END +void corcomp_fdc_device::floppy_formats(format_registration &fr) +{ + fr.add_mfm_containers(); + fr.add(FLOPPY_TI99_SDF_FORMAT); + fr.add(FLOPPY_TI99_TDF_FORMAT); +} static void ccfdc_floppies(device_slot_interface &device) { @@ -518,7 +520,7 @@ void corcomp_fdc_device::common_config(machine_config& config) // Motor monoflop TTL74123(config, m_motormf, 0); - m_motormf->set_connection_type(TTL74123_NOT_GROUNDED_NO_DIODE); + m_motormf->set_connection_type(TTL74123_GROUNDED); m_motormf->set_resistor_value(RES_K(100)); m_motormf->set_capacitor_value(CAP_U(47)); m_motormf->set_a_pin_value(0); @@ -609,7 +611,7 @@ void ccfdc_dec_pal_device::device_config_complete() /* Indicates 9901 addressing. */ -READ_LINE_MEMBER( ccfdc_dec_pal_device::address9901 ) +int ccfdc_dec_pal_device::address9901() { return ((m_board->get_address() & 0xff80)==0x1100)? ASSERT_LINE : CLEAR_LINE; } @@ -617,7 +619,7 @@ READ_LINE_MEMBER( ccfdc_dec_pal_device::address9901 ) /* Indicates SRAM addressing. */ -READ_LINE_MEMBER( ccfdc_dec_pal_device::addressram ) +int ccfdc_dec_pal_device::addressram() { return ((m_board->card_selected()) && (m_board->get_address() & 0xff80)==0x4000)? ASSERT_LINE : CLEAR_LINE; @@ -626,7 +628,7 @@ READ_LINE_MEMBER( ccfdc_dec_pal_device::addressram ) /* Indicates WDC addressing. */ -READ_LINE_MEMBER( ccfdc_dec_pal_device::addresswdc ) +int ccfdc_dec_pal_device::addresswdc() { return ((m_board->card_selected()) && (m_board->get_address() & 0xff80)==0x5f80)? ASSERT_LINE : CLEAR_LINE; @@ -635,7 +637,7 @@ READ_LINE_MEMBER( ccfdc_dec_pal_device::addresswdc ) /* Indicates DSR addressing. */ -READ_LINE_MEMBER( ccfdc_dec_pal_device::address4 ) +int ccfdc_dec_pal_device::address4() { return ((m_board->card_selected()) && (m_board->get_address() & 0xe000)==0x4000)? ASSERT_LINE : CLEAR_LINE; @@ -644,7 +646,7 @@ READ_LINE_MEMBER( ccfdc_dec_pal_device::address4 ) /* Indicates SRAM selection. */ -READ_LINE_MEMBER( ccfdc_sel_pal_device::selectram ) +int ccfdc_sel_pal_device::selectram() { return (m_decpal->addressram() && (m_board->upper_bank())) ? ASSERT_LINE : CLEAR_LINE; @@ -653,7 +655,7 @@ READ_LINE_MEMBER( ccfdc_sel_pal_device::selectram ) /* Indicates WDC selection. */ -READ_LINE_MEMBER( ccfdc_sel_pal_device::selectwdc ) +int ccfdc_sel_pal_device::selectwdc() { return (m_decpal->addresswdc() && ((m_board->get_address()&1)==0))? ASSERT_LINE : CLEAR_LINE; } @@ -661,7 +663,7 @@ READ_LINE_MEMBER( ccfdc_sel_pal_device::selectwdc ) /* Indicates EPROM selection. */ -READ_LINE_MEMBER( ccfdc_sel_pal_device::selectdsr ) +int ccfdc_sel_pal_device::selectdsr() { return (m_decpal->address4() && !m_decpal->addresswdc() @@ -688,7 +690,7 @@ ccdcc_palu1_device::ccdcc_palu1_device(const machine_config &mconfig, const char /* Wait state logic */ -READ_LINE_MEMBER( ccdcc_palu1_device::ready_out ) +int ccdcc_palu1_device::ready_out() { bool wdc = m_decpal->addresswdc(); // Addressing the WDC bool lastdig = (m_board->get_address()&7)==6; // Address ends with 6 or e (5ff6, 5ffe) @@ -771,7 +773,7 @@ ccfdc_palu12_device::ccfdc_palu12_device(const machine_config &mconfig, const ch Indicates 9901 addressing. In this PAL version, the A9 address line is also used. */ -READ_LINE_MEMBER( ccfdc_palu12_device::address9901 ) +int ccfdc_palu12_device::address9901() { return ((m_board->get_address() & 0xffc0)==0x1100)? ASSERT_LINE : CLEAR_LINE; } @@ -786,7 +788,7 @@ ccfdc_palu6_device::ccfdc_palu6_device(const machine_config &mconfig, const char That is, when writing (/WE=0), A12 must be 1 (addresses 5ff8..e), otherwise (/WE=1), A12 must be 0 (addresses 5ff0..6) */ -READ_LINE_MEMBER( ccfdc_palu6_device::selectwdc ) +int ccfdc_palu6_device::selectwdc() { return (m_decpal->addresswdc() && ((m_board->get_address()&1)==0) @@ -797,7 +799,7 @@ READ_LINE_MEMBER( ccfdc_palu6_device::selectwdc ) Indicates EPROM selection. The Rev A selector PAL leads back some of its outputs for this calculation. */ -READ_LINE_MEMBER( ccfdc_palu6_device::selectdsr ) +int ccfdc_palu6_device::selectdsr() { return (m_decpal->address4() && !selectwdc() && !selectram())? ASSERT_LINE : CLEAR_LINE; } @@ -807,7 +809,7 @@ READ_LINE_MEMBER( ccfdc_palu6_device::selectdsr ) board which evaluates whether the trap is active. */ -READ_LINE_MEMBER( ccfdc_palu6_device::ready_out ) +int ccfdc_palu6_device::ready_out() { bool wdc = m_decpal->addresswdc(); // Addressing the WDC bool even = (m_board->get_address()&1)==0; // A15 = 0 @@ -826,4 +828,5 @@ void ccfdc_palu6_device::device_config_complete() m_board = static_cast<corcomp_fdca_device*>(owner()); m_decpal = static_cast<ccfdc_dec_pal_device*>(owner()->subdevice(CCFDC_PALU12_TAG)); } -} } } // end namespace bus::ti99::peb + +} // end namespace bus::ti99::peb |