Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 21 additions & 16 deletions src/mame/sinclair/beta_m.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,26 @@
#include "formats/trd_dsk.h"


namespace {

void floppy_formats(format_registration &fr)
{
fr.add_mfm_containers();
fr.add_pc_formats();
fr.add(FLOPPY_TRD_FORMAT);
}

void beta_disk_floppies(device_slot_interface &device)
{
device.option_add("525hd", FLOPPY_525_HD);
device.option_add("525qd", FLOPPY_525_QD);
device.option_add("35hd", FLOPPY_35_HD);
device.option_add("35dd", FLOPPY_35_DD);
}

} // anonymous namespace


/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
Expand Down Expand Up @@ -205,21 +225,6 @@ void beta_disk_device::motors_control()
}
}

void beta_disk_device::floppy_formats(format_registration &fr)
{
fr.add_mfm_containers();
fr.add_pc_formats();
fr.add(FLOPPY_TRD_FORMAT);
}

static void beta_disk_floppies(device_slot_interface &device)
{
device.option_add("525hd", FLOPPY_525_HD);
device.option_add("525qd", FLOPPY_525_QD);
device.option_add("35hd", FLOPPY_35_HD);
device.option_add("35dd", FLOPPY_35_DD);
}


ROM_START( beta_disk )
ROM_REGION( 0x60000, "beta", 0 )
Expand Down Expand Up @@ -312,7 +317,7 @@ void beta_disk_device::device_add_mconfig(machine_config &config)
KR1818VG93(config, m_wd179x, 8_MHz_XTAL / 8);
m_wd179x->hld_wr_callback().set(FUNC(beta_disk_device::fdc_hld_w));
for (auto &floppy : m_floppy)
FLOPPY_CONNECTOR(config, floppy, beta_disk_floppies, "525qd", beta_disk_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, floppy, beta_disk_floppies, "525qd", floppy_formats).enable_sound(true);
}

//-------------------------------------------------
Expand Down
2 changes: 0 additions & 2 deletions src/mame/sinclair/beta_m.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ class beta_disk_device : public device_t
void motors_control();
u8 m_control;
bool m_motor_active;

static void floppy_formats(format_registration &fr);
};

DECLARE_DEVICE_TYPE(BETA_DISK, beta_disk_device)
Expand Down
28 changes: 16 additions & 12 deletions src/mame/sinclair/tsconf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ FAQ-RUS: https://forum.tslabs.info/viewtopic.php?f=35&t=157

TODO:
- Ram cache
- VDos

****************************************************************************/

Expand Down Expand Up @@ -84,14 +83,10 @@ void tsconf_state::tsconf_io(address_map &map)
{
map.unmap_value_high();
map(0x0000, 0x0000).mirror(0x7ffd).w(FUNC(tsconf_state::tsconf_port_7ffd_w));
map(0x001f, 0x001f).mirror(0xff00).r(FUNC(tsconf_state::tsconf_port_xx1f_r)).w(m_beta, FUNC(beta_disk_device::command_w));
map(0x003f, 0x003f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::track_r), FUNC(beta_disk_device::track_w));
map(0x001f, 0x001f).mirror(0xff00).r(FUNC(tsconf_state::tsconf_port_xx1f_r));
map(0x0057, 0x0057).mirror(0xff00).rw(FUNC(tsconf_state::tsconf_port_57_zctr_r), FUNC(tsconf_state::tsconf_port_57_zctr_w)); // spi config
map(0x0077, 0x0077).mirror(0xff00).rw(FUNC(tsconf_state::tsconf_port_77_zctr_r), FUNC(tsconf_state::tsconf_port_77_zctr_w)); // spi data
map(0x005f, 0x005f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::sector_r), FUNC(beta_disk_device::sector_w));
map(0x007f, 0x007f).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::data_r), FUNC(beta_disk_device::data_w));
map(0x00fe, 0x00fe).select(0xff00).rw(FUNC(tsconf_state::spectrum_ula_r), FUNC(tsconf_state::tsconf_ula_w));
map(0x00ff, 0x00ff).mirror(0xff00).rw(m_beta, FUNC(beta_disk_device::state_r), FUNC(beta_disk_device::param_w));
map(0x00af, 0x00af).select(0xff00).rw(FUNC(tsconf_state::tsconf_port_xxaf_r), FUNC(tsconf_state::tsconf_port_xxaf_w));
map(0xfadf, 0xfadf).lr8(NAME([this]() -> u8 { return 0x80 | (m_io_mouse[2]->read() & 0x07); }));
map(0xfbdf, 0xfbdf).lr8(NAME([this]() -> u8 { return m_io_mouse[0]->read(); }));
Expand All @@ -102,6 +97,10 @@ void tsconf_state::tsconf_io(address_map &map)
map(0x80fd, 0x80fd).mirror(0x3f00).lw8(NAME([this](u8 data) { return m_ay[m_ay_selected]->data_w(data); }));
map(0xc0fd, 0xc0fd).mirror(0x3f00).lr8(NAME([this]() { return m_ay[m_ay_selected]->data_r(); }))
.w(FUNC(tsconf_state::tsconf_ay_address_w));

// IO: Shadow
map(0x0000, 0xffff).view(m_io_shadow_view);
m_io_shadow_view[0](0x0000, 0xffff).m(m_beta, FUNC(tsconf_beta_device::tsconf_beta_io));
}

void tsconf_state::tsconf_switch(address_map &map)
Expand Down Expand Up @@ -187,6 +186,7 @@ void tsconf_state::machine_start()
m_bank_ram[0]->configure_entries(0, m_ram->size() / 0x4000, m_ram->pointer(), 0x4000);

save_item(NAME(m_int_mask));
save_item(NAME(m_update_on_m1));
save_pointer(NAME(m_regs), 0x100);
save_item(NAME(m_zctl_di));
save_item(NAME(m_zctl_cs));
Expand All @@ -197,6 +197,8 @@ void tsconf_state::machine_start()

void tsconf_state::machine_reset()
{
m_update_on_m1 = false;

m_frame_irq_timer->adjust(attotime::never);
m_scanline_irq_timer->adjust(attotime::never);
m_int_mask = 0;
Expand Down Expand Up @@ -228,8 +230,7 @@ void tsconf_state::machine_reset()
m_regs[INT_MASK] = 0x01; // xxxxx001
m_regs[CACHE_CONFIG] &= 0xf0; // xxxx0000

if (m_beta->started())
m_beta->enable();
m_beta->fddvirt_w(m_regs[FDD_VIRT] & 0x0f);

m_zctl_cs = 1;
m_zctl_di = 0xff;
Expand Down Expand Up @@ -277,9 +278,9 @@ void tsconf_state::tsconf(machine_config &config)
config.device_remove("palette");

Z80(config.replace(), m_maincpu, 14_MHz_XTAL / 4);
m_maincpu->set_addrmap(AS_PROGRAM, &tsconf_state::tsconf_mem);
m_maincpu->set_addrmap(AS_IO, &tsconf_state::tsconf_io);
m_maincpu->set_addrmap(AS_OPCODES, &tsconf_state::tsconf_switch);
m_maincpu->set_memory_map(&tsconf_state::tsconf_mem);
m_maincpu->set_io_map(&tsconf_state::tsconf_io);
m_maincpu->set_m1_map(&tsconf_state::tsconf_switch);
m_maincpu->set_irq_acknowledge_callback(FUNC(tsconf_state::irq_vector));

m_maincpu->set_vblank_int("screen", FUNC(tsconf_state::tsconf_vblank_interrupt));
Expand All @@ -301,7 +302,10 @@ void tsconf_state::tsconf(machine_config &config)
m_dma->out_sfile_callback().set(FUNC(tsconf_state::sfile_write16));
m_dma->on_ready_callback().set(FUNC(tsconf_state::dma_ready));

BETA_DISK(config, m_beta, 0);
TSCONF_BETA(config, m_beta, 0);
m_beta->out_dos_callback().set(FUNC(tsconf_state::update_io));
m_beta->out_vdos_m1_callback().set([this](int state) { m_update_on_m1 = true; });

SPI_SDCARD(config, m_sdcard, 0);
m_sdcard->set_prefer_sdhc();
m_sdcard->spi_miso_callback().set(FUNC(tsconf_state::tsconf_spi_miso_w));
Expand Down
10 changes: 7 additions & 3 deletions src/mame/sinclair/tsconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
#include "spec128.h"

#include "glukrs.h"
#include "tsconf_beta.h"
#include "tsconfdma.h"

#include "beta_m.h"
#include "machine/pckeybrd.h"
#include "machine/spi_sdcard.h"
#include "sound/ay8910.h"
Expand All @@ -28,10 +28,11 @@ class tsconf_state : public spectrum_128_state
public:
tsconf_state(const machine_config &mconfig, device_type type, const char *tag)
: spectrum_128_state(mconfig, type, tag)
, m_io_shadow_view(*this, "io_shadow_view")
, m_bank0_rom(*this, "bank0_rom")
, m_keyboard(*this, "pc_keyboard")
, m_io_mouse(*this, "mouse_input%u", 1U)
, m_beta(*this, BETA_DISK_TAG)
, m_beta(*this, "beta")
, m_dma(*this, "dma")
, m_sdcard(*this, "sdcard")
, m_glukrs(*this, "glukrs")
Expand Down Expand Up @@ -155,6 +156,7 @@ class tsconf_state : public spectrum_128_state
INTERRUPT_GEN_MEMBER(tsconf_vblank_interrupt);
IRQ_CALLBACK_MEMBER(irq_vector);
u8 m_int_mask;
bool m_update_on_m1;

DECLARE_VIDEO_START(tsconf);
TILE_GET_INFO_MEMBER(get_tile_info_txt);
Expand Down Expand Up @@ -188,6 +190,7 @@ class tsconf_state : public spectrum_128_state
void tsconf_ay_address_w(u8 data);

void tsconf_update_bank0();
void update_io(int dos);
u8 beta_neutral_r(offs_t offset);
u8 beta_enable_r(offs_t offset);
u8 beta_disable_r(offs_t offset);
Expand All @@ -213,12 +216,13 @@ class tsconf_state : public spectrum_128_state
u8 m_regs[0x100];

memory_access<16, 0, 0, ENDIANNESS_LITTLE>::specific m_program;
memory_view m_io_shadow_view;
memory_view m_bank0_rom;

required_device<at_keyboard_device> m_keyboard;
required_ioport_array<3> m_io_mouse;

required_device<beta_disk_device> m_beta;
required_device<tsconf_beta_device> m_beta;
required_device<tsconfdma_device> m_dma;
required_device<spi_sdcard_device> m_sdcard;
u8 m_zctl_di = 0;
Expand Down
Loading