mirror of
https://github.com/holub/mame
synced 2025-04-16 05:24:54 +03:00
thomson: Turn the extensions into slot devices, modernize the floppies
This commit is contained in:
parent
ccd815de1a
commit
c037dfd822
@ -4493,3 +4493,25 @@ if (BUSES["SAMCOUPE_MOUSE_PORT"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/samcoupe/mouse/mouse.h",
|
||||
}
|
||||
end
|
||||
|
||||
---------------------------------------------------
|
||||
--
|
||||
--@src/devices/bus/thomson/extension.h,BUSES["THOMSON"] = true
|
||||
---------------------------------------------------
|
||||
|
||||
if (BUSES["THOMSON"]~=null) then
|
||||
files {
|
||||
MAME_DIR .. "src/devices/bus/thomson/extension.cpp",
|
||||
MAME_DIR .. "src/devices/bus/thomson/extension.h",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cd90_015.cpp",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cd90_015.h",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cq90_028.cpp",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cq90_028.h",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cd90_351.cpp",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cd90_351.h",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cd90_640.cpp",
|
||||
MAME_DIR .. "src/devices/bus/thomson/cd90_640.h",
|
||||
MAME_DIR .. "src/devices/bus/thomson/nanoreseau.cpp",
|
||||
MAME_DIR .. "src/devices/bus/thomson/nanoreseau.h",
|
||||
}
|
||||
end
|
||||
|
@ -843,6 +843,7 @@ BUSES["VECTREX"] = true
|
||||
--BUSES["X68K"] = true
|
||||
--BUSES["Z88"] = true
|
||||
BUSES["ZORRO"] = true
|
||||
--BUSES["THOMSON"] = true
|
||||
|
||||
|
||||
--------------------------------------------------
|
||||
|
@ -133,12 +133,15 @@ protected:
|
||||
|
||||
address_space &space() { return m_bml3bus->space(); }
|
||||
|
||||
void raise_slot_nmi() { m_bml3bus->set_nmi_line(ASSERT_LINE); }
|
||||
void lower_slot_nmi() { m_bml3bus->set_nmi_line(CLEAR_LINE); }
|
||||
void raise_slot_irq() { m_bml3bus->set_irq_line(ASSERT_LINE); }
|
||||
void lower_slot_irq() { m_bml3bus->set_irq_line(CLEAR_LINE); }
|
||||
void raise_slot_nmi() { m_bml3bus->set_nmi_line(ASSERT_LINE); }
|
||||
void lower_slot_nmi() { m_bml3bus->set_nmi_line(CLEAR_LINE); }
|
||||
void raise_slot_irq() { m_bml3bus->set_irq_line(ASSERT_LINE); }
|
||||
void lower_slot_irq() { m_bml3bus->set_irq_line(CLEAR_LINE); }
|
||||
void raise_slot_firq() { m_bml3bus->set_firq_line(ASSERT_LINE); }
|
||||
void lower_slot_firq() { m_bml3bus->set_firq_line(CLEAR_LINE); }
|
||||
void nmi_w(int state) { m_bml3bus->set_nmi_line(state); }
|
||||
void irq_w(int state) { m_bml3bus->set_irq_line(state); }
|
||||
void firq_w(int state) { m_bml3bus->set_firq_line(state); }
|
||||
|
||||
device_bml3bus_card_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
|
@ -23,22 +23,6 @@
|
||||
|
||||
DEFINE_DEVICE_TYPE(BML3BUS_MP1805, bml3bus_mp1805_device, "bml3mp1805", "Hitachi MP-1805 Floppy Controller Card")
|
||||
|
||||
static const floppy_interface bml3_mp1805_floppy_interface =
|
||||
{
|
||||
FLOPPY_STANDARD_3_SSDD,
|
||||
LEGACY_FLOPPY_OPTIONS_NAME(default),
|
||||
nullptr
|
||||
};
|
||||
|
||||
WRITE_LINE_MEMBER( bml3bus_mp1805_device::bml3_mc6843_intrq_w )
|
||||
{
|
||||
if (state)
|
||||
{
|
||||
raise_slot_nmi();
|
||||
lower_slot_nmi();
|
||||
}
|
||||
}
|
||||
|
||||
#define MP1805_ROM_REGION "mp1805_rom"
|
||||
|
||||
ROM_START( mp1805 )
|
||||
@ -47,6 +31,11 @@ ROM_START( mp1805 )
|
||||
ROM_LOAD( "mp1805.rom", 0xf800, 0x0800, BAD_DUMP CRC(b532d8d9) SHA1(6f1160356d5bf64b5926b1fdb60db414edf65f22))
|
||||
ROM_END
|
||||
|
||||
void bml3bus_mp1805_device::floppy_drives(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("mb_6890", FLOPPY_3_SSDD);
|
||||
}
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
FUNCTION PROTOTYPES
|
||||
@ -58,12 +47,14 @@ ROM_END
|
||||
|
||||
void bml3bus_mp1805_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
MC6843(config, m_mc6843, 0);
|
||||
m_mc6843->set_floppy_drives(m_floppy[0], m_floppy[1], m_floppy[2], m_floppy[3]);
|
||||
m_mc6843->irq().set(FUNC(bml3bus_mp1805_device::bml3_mc6843_intrq_w));
|
||||
MC6843(config, m_mc6843, 500000);
|
||||
m_mc6843->force_ready();
|
||||
m_mc6843->irq().set(FUNC(bml3bus_mp1805_device::nmi_w));
|
||||
|
||||
for (auto &floppy : m_floppy)
|
||||
LEGACY_FLOPPY(config, floppy, 0, &bml3_mp1805_floppy_interface);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[0], floppy_drives, "mb_6890", floppy_image_device::default_floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_image_device::default_floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[2], floppy_drives, nullptr, floppy_image_device::default_floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[3], floppy_drives, nullptr, floppy_image_device::default_floppy_formats).enable_sound(true);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -88,33 +79,29 @@ void bml3bus_mp1805_device::bml3_mp1805_w(uint8_t data)
|
||||
// MT ? ? ? D3 D2 D1 D0
|
||||
// MT: 0=motor off, 1=motor on
|
||||
// Dn: 1=select drive <n>
|
||||
int drive_select = data & 0x0f;
|
||||
int drive;
|
||||
// TODO: MESS UI for flipping disk? Note that D88 images are double-sided, but the physical drive is single-sided
|
||||
int side = 0;
|
||||
int motor = BIT(data, 7);
|
||||
switch (drive_select) {
|
||||
case 1:
|
||||
drive = 0;
|
||||
break;
|
||||
case 2:
|
||||
drive = 1;
|
||||
break;
|
||||
case 4:
|
||||
drive = 2;
|
||||
break;
|
||||
case 8:
|
||||
drive = 3;
|
||||
break;
|
||||
default:
|
||||
// TODO: what's the correct behaviour if more than one drive select bit is set? Or no bit set?
|
||||
drive = 0;
|
||||
break;
|
||||
|
||||
logerror("control_w %02x\n", data);
|
||||
int prev, next;
|
||||
for(prev = 0; prev != 4; prev++)
|
||||
if(m_control & (1 << prev))
|
||||
break;
|
||||
m_control = data;
|
||||
for(next = 0; next != 4; next++)
|
||||
if(m_control & (1 << next))
|
||||
break;
|
||||
|
||||
auto fprev = m_floppy[prev]->get_device();
|
||||
auto fnext = m_floppy[next]->get_device();
|
||||
|
||||
if(fprev && fprev != fnext)
|
||||
m_floppy[prev]->get_device()->mon_w(1);
|
||||
|
||||
if((m_control & 0x80) && fnext) {
|
||||
logerror("motor on\n");
|
||||
fnext->mon_w(0);
|
||||
}
|
||||
m_mc6843->set_drive(drive);
|
||||
m_floppy[drive]->floppy_mon_w(motor);
|
||||
m_floppy[drive]->floppy_drive_set_ready_state(ASSERT_LINE, 0);
|
||||
m_mc6843->set_side(side);
|
||||
|
||||
m_mc6843->set_floppy(fnext);
|
||||
}
|
||||
|
||||
|
||||
@ -125,7 +112,7 @@ void bml3bus_mp1805_device::bml3_mp1805_w(uint8_t data)
|
||||
bml3bus_mp1805_device::bml3bus_mp1805_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, BML3BUS_MP1805, tag, owner, clock),
|
||||
device_bml3bus_card_interface(mconfig, *this),
|
||||
m_floppy(*this, "floppy%u", 0U),
|
||||
m_floppy(*this, "%u", 0U),
|
||||
m_mc6843(*this, "mc6843"), m_rom(nullptr)
|
||||
{
|
||||
}
|
||||
@ -141,13 +128,16 @@ void bml3bus_mp1805_device::device_start()
|
||||
|
||||
// install into memory
|
||||
address_space &space_prg = space();
|
||||
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_device(0xff18, 0xff1f, *m_mc6843, &mc6843_device::map);
|
||||
space_prg.install_readwrite_handler(0xff20, 0xff20, read8smo_delegate(*this, FUNC(bml3bus_mp1805_device::bml3_mp1805_r)), write8smo_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();
|
||||
memcpy(mainrom + 0xf800, m_rom + 0xf800, 0x800);
|
||||
|
||||
save_item(NAME(m_control));
|
||||
}
|
||||
|
||||
void bml3bus_mp1805_device::device_reset()
|
||||
{
|
||||
m_control = 0;
|
||||
}
|
||||
|
@ -41,13 +41,15 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
required_device_array<legacy_floppy_image_device, 4> m_floppy;
|
||||
required_device_array<floppy_connector, 4> m_floppy;
|
||||
required_device<mc6843_device> m_mc6843;
|
||||
|
||||
private:
|
||||
DECLARE_WRITE_LINE_MEMBER( bml3_mc6843_intrq_w );
|
||||
|
||||
uint8_t *m_rom;
|
||||
|
||||
uint8_t m_control;
|
||||
|
||||
static void floppy_drives(device_slot_interface &device);
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
120
src/devices/bus/thomson/cd90_015.cpp
Normal file
120
src/devices/bus/thomson/cd90_015.cpp
Normal file
@ -0,0 +1,120 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CD 90-015 - Floppy drive selectler built from a wd1770
|
||||
//
|
||||
// Handles up to two 5.25 dual-sided drives (DD 90-320)
|
||||
|
||||
#include "emu.h"
|
||||
#include "cd90_015.h"
|
||||
#include "formats/thom_dsk.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(CD90_015, cd90_015_device, "cd90_015", "Thomson CD90-015 floppy drive selectler")
|
||||
|
||||
cd90_015_device::cd90_015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, CD90_015, tag, owner, clock),
|
||||
thomson_extension_interface(mconfig, *this),
|
||||
m_fdc(*this, "fdc"),
|
||||
m_floppy(*this, "%u", 0U),
|
||||
m_rom(*this, "rom")
|
||||
{
|
||||
}
|
||||
|
||||
ROM_START(cd90_015)
|
||||
ROM_REGION( 0x7c0, "rom", 0 )
|
||||
ROM_LOAD ( "cd90-015.rom", 0x000, 0x7c0, CRC(821d34c1) SHA1(31a6bb81baaeec5fc8de457c97264f9dfa92c18b) )
|
||||
ROM_END
|
||||
|
||||
void cd90_015_device::rom_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0x7bf).rom().region(m_rom, 0);
|
||||
}
|
||||
|
||||
void cd90_015_device::io_map(address_map &map)
|
||||
{
|
||||
map(0, 7).m(m_fdc, FUNC(mc6843_device::map));
|
||||
map(8, 9).rw(FUNC(cd90_015_device::motor_r), FUNC(cd90_015_device::select_w));
|
||||
}
|
||||
|
||||
const tiny_rom_entry *cd90_015_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(cd90_015);
|
||||
}
|
||||
|
||||
void cd90_015_device::floppy_drives(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("dd90_015", FLOPPY_525_SD);
|
||||
}
|
||||
|
||||
void cd90_015_device::floppy_formats(format_registration &fr)
|
||||
{
|
||||
fr.add(FLOPPY_THOMSON_525_FORMAT);
|
||||
}
|
||||
|
||||
void cd90_015_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
MC6843(config, m_fdc, 16_MHz_XTAL / 32); // Comes from the main board
|
||||
m_fdc->force_ready();
|
||||
FLOPPY_CONNECTOR(config, m_floppy[0], floppy_drives, "dd90_015", floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[2], floppy_drives, nullptr, floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[3], floppy_drives, nullptr, floppy_formats).enable_sound(true);
|
||||
}
|
||||
|
||||
void cd90_015_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
m_floppy[id]->get_device()->mon_w(1);
|
||||
}
|
||||
|
||||
void cd90_015_device::device_start()
|
||||
{
|
||||
for(int i=0; i != 4; i++)
|
||||
m_motor_timer[i] = timer_alloc(i);
|
||||
save_item(NAME(m_select));
|
||||
}
|
||||
|
||||
void cd90_015_device::device_reset()
|
||||
{
|
||||
m_select = 0;
|
||||
for(int i=0; i != 4; i++) {
|
||||
floppy_image_device *f = m_floppy[i]->get_device();
|
||||
if(f)
|
||||
f->mon_w(1);
|
||||
}
|
||||
m_fdc->set_floppy(nullptr);
|
||||
}
|
||||
|
||||
void cd90_015_device::select_w(u8 data)
|
||||
{
|
||||
u8 started = (~m_select) & data;
|
||||
m_select = data & 0xf;
|
||||
|
||||
for(int i = 0; i != 5; i++)
|
||||
if(m_select & (1 << i)) {
|
||||
m_fdc->set_floppy(m_floppy[i]->get_device());
|
||||
goto found;
|
||||
}
|
||||
m_fdc->set_floppy(nullptr);
|
||||
|
||||
found:
|
||||
for(int i = 0; i != 4; i++)
|
||||
if(started & (1 << i)) {
|
||||
if(m_floppy[i]->get_device()) {
|
||||
m_floppy[i]->get_device()->mon_w(0);
|
||||
m_motor_timer[i]->adjust(attotime::from_seconds(5));
|
||||
}
|
||||
}
|
||||
|
||||
logerror("select_w %x\n", m_select);
|
||||
}
|
||||
|
||||
u8 cd90_015_device::motor_r()
|
||||
{
|
||||
u8 res = 0xf;
|
||||
for(int i=0; i != 4; i++)
|
||||
if(m_floppy[i]->get_device() && !m_floppy[i]->get_device()->mon_r())
|
||||
res &= ~(1 << i);
|
||||
if(!machine().side_effects_disabled())
|
||||
logerror("motor_r %x\n", res);
|
||||
return res;
|
||||
}
|
48
src/devices/bus/thomson/cd90_015.h
Normal file
48
src/devices/bus/thomson/cd90_015.h
Normal file
@ -0,0 +1,48 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CD 90-015 - Floppy drive controller built from a hd 46503s aka hd6843 aka mc6843
|
||||
//
|
||||
// Handles up to four 5.25 single-sided drives (DD 90-015)
|
||||
|
||||
#ifndef MAME_BUS_THOMSON_CD90_015_H
|
||||
#define MAME_BUS_THOMSON_CD90_015_H
|
||||
|
||||
#include "extension.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "machine/mc6843.h"
|
||||
|
||||
class cd90_015_device : public device_t, public thomson_extension_interface
|
||||
{
|
||||
public:
|
||||
cd90_015_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
virtual ~cd90_015_device() = default;
|
||||
|
||||
virtual void rom_map(address_map &map) override;
|
||||
virtual void io_map(address_map &map) override;
|
||||
|
||||
protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
required_device<mc6843_device> m_fdc;
|
||||
required_device_array<floppy_connector, 4> m_floppy;
|
||||
required_memory_region m_rom;
|
||||
|
||||
emu_timer *m_motor_timer[4];
|
||||
u8 m_select;
|
||||
|
||||
void select_w(u8 data);
|
||||
u8 motor_r();
|
||||
|
||||
static void floppy_formats(format_registration &fr);
|
||||
static void floppy_drives(device_slot_interface &device);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(CD90_015, cd90_015_device)
|
||||
|
||||
#endif
|
495
src/devices/bus/thomson/cd90_351.cpp
Normal file
495
src/devices/bus/thomson/cd90_351.cpp
Normal file
@ -0,0 +1,495 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
|
||||
// CD 90-351 - Custom floppy drive controller (THMFC1)
|
||||
//
|
||||
// Handles up to two 3.5 dual-sided drives (DD 90-352)
|
||||
// or up to two 2.8 dual-sided QDD drivers (QD 90-280)
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "cd90_351.h"
|
||||
#include "formats/thom_dsk.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(CD90_351, cd90_351_device, "cd90_351", "Thomson CD90-351 floppy drive controller")
|
||||
|
||||
cd90_351_device::cd90_351_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, CD90_351, tag, owner, 16000000),
|
||||
thomson_extension_interface(mconfig, *this),
|
||||
m_floppy(*this, "%u", 0U),
|
||||
m_rom(*this, "rom"),
|
||||
m_rom_bank(*this, "rom_bank")
|
||||
{
|
||||
}
|
||||
|
||||
ROM_START(cd90_351)
|
||||
// Rom has been dumped from the system, so the unaccessible ranges are
|
||||
// missing (and probably totally unimportant)
|
||||
|
||||
ROM_REGION( 0x2000, "rom", 0 )
|
||||
ROM_LOAD ( "cd-351-0.rom", 0x0000, 0x7c0, CRC(2c0159fd) SHA1(bab5395ed8bc7c06f9897897f836054e6546e8e8) )
|
||||
ROM_LOAD ( "cd-351-1.rom", 0x0800, 0x7c0, CRC(8e58d159) SHA1(dcf992c96e7556b2faee6bacd3f744e56998e6ea) )
|
||||
ROM_LOAD ( "cd-351-2.rom", 0x1000, 0x7c0, CRC(c9228b60) SHA1(179e10107d5be91e684069dee80f94847b83201f) )
|
||||
ROM_LOAD ( "cd-351-3.rom", 0x1800, 0x7c0, CRC(3ca8e5dc) SHA1(7118636fb5c597c78c2fce17b02aed5e4ba38635) )
|
||||
ROM_END
|
||||
|
||||
void cd90_351_device::rom_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0x7bf).bankr(m_rom_bank);
|
||||
}
|
||||
|
||||
void cd90_351_device::io_map(address_map &map)
|
||||
{
|
||||
map(0, 0).rw(FUNC(cd90_351_device::stat0_r), FUNC(cd90_351_device::cmd0_w));
|
||||
map(1, 1).rw(FUNC(cd90_351_device::stat1_r), FUNC(cd90_351_device::cmd1_w));
|
||||
map(2, 2).w(FUNC(cd90_351_device::cmd2_w));
|
||||
map(3, 3).rw(FUNC(cd90_351_device::rdata_r), FUNC(cd90_351_device::wdata_w));
|
||||
map(4, 4).w(FUNC(cd90_351_device::wclk_w));
|
||||
map(5, 5).w(FUNC(cd90_351_device::wsect_w));
|
||||
map(6, 6).w(FUNC(cd90_351_device::wtrck_w));
|
||||
map(7, 7).w(FUNC(cd90_351_device::wcell_w));
|
||||
map(8, 8).w(FUNC(cd90_351_device::bank_w));
|
||||
}
|
||||
|
||||
const tiny_rom_entry *cd90_351_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(cd90_351);
|
||||
}
|
||||
|
||||
void cd90_351_device::floppy_drives(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("dd90_352", FLOPPY_35_DD);
|
||||
// device.option_add("qd90_280", FLOPPY_28_QDD);
|
||||
}
|
||||
|
||||
void cd90_351_device::floppy_formats(format_registration &fr)
|
||||
{
|
||||
fr.add_pc_formats();
|
||||
fr.add(FLOPPY_THOMSON_35_FORMAT);
|
||||
}
|
||||
|
||||
void cd90_351_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
FLOPPY_CONNECTOR(config, m_floppy[0], floppy_drives, "dd90_352", floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_formats).enable_sound(true);
|
||||
}
|
||||
|
||||
void cd90_351_device::device_start()
|
||||
{
|
||||
m_rom_bank->configure_entries(0, 4, m_rom->base(), 0x800);
|
||||
m_timer_motoroff = timer_alloc(ID_MOTOROFF);
|
||||
|
||||
save_item(NAME(m_cmd0));
|
||||
save_item(NAME(m_cmd1));
|
||||
save_item(NAME(m_cmd2));
|
||||
save_item(NAME(m_stat0));
|
||||
save_item(NAME(m_data));
|
||||
save_item(NAME(m_clk));
|
||||
save_item(NAME(m_sect));
|
||||
save_item(NAME(m_trck));
|
||||
save_item(NAME(m_cell));
|
||||
save_item(NAME(m_last_sync));
|
||||
save_item(NAME(m_window_start));
|
||||
save_item(NAME(m_shift_reg));
|
||||
save_item(NAME(m_crc));
|
||||
save_item(NAME(m_bit_counter));
|
||||
save_item(NAME(m_data_reg));
|
||||
save_item(NAME(m_data_separator_phase));
|
||||
}
|
||||
|
||||
void cd90_351_device::device_reset()
|
||||
{
|
||||
m_rom_bank->set_entry(0);
|
||||
|
||||
m_cmd0 = 0;
|
||||
m_cmd1 = 0;
|
||||
m_cmd2 = 0;
|
||||
m_stat0 = S0_FREE;
|
||||
m_data = 0;
|
||||
m_clk = 0;
|
||||
m_sect = 0;
|
||||
m_trck = 0;
|
||||
m_cell = 0;
|
||||
m_last_sync = 0;
|
||||
m_window_start = 0;
|
||||
m_shift_reg = 0;
|
||||
m_crc = 0;
|
||||
m_bit_counter = 0;
|
||||
m_data_reg = 0;
|
||||
m_data_separator_phase = false;
|
||||
m_state = S_IDLE;
|
||||
m_cur_floppy = nullptr;
|
||||
}
|
||||
|
||||
void cd90_351_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
switch(id) {
|
||||
case ID_MOTOROFF:
|
||||
logerror("motor off\n");
|
||||
if(m_cur_floppy)
|
||||
m_cur_floppy->mon_w(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cd90_351_device::device_post_load()
|
||||
{
|
||||
if(m_cmd2 & C2_DRS0)
|
||||
m_cur_floppy = m_floppy[0]->get_device();
|
||||
else if(m_cmd2 & C2_DRS1)
|
||||
m_cur_floppy = m_floppy[1]->get_device();
|
||||
else
|
||||
m_cur_floppy = nullptr;
|
||||
}
|
||||
|
||||
void cd90_351_device::cmd0_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
static const char *const mode[4] = { "reset", "wsect", "rhead", "rsect" };
|
||||
m_cmd0 = data;
|
||||
logerror("cmd0_w %02x, code=%s, ensyn=%d nomck=%d wgc=%d mode=%s\n", m_cmd1,
|
||||
m_cmd0 & C0_FM ? "fm" : "mfm",
|
||||
m_cmd0 & C0_ENSYN ? 1 : 0,
|
||||
m_cmd0 & C0_NOMCK ? 1 : 0,
|
||||
m_cmd0 & C0_WGC ? 1 : 0,
|
||||
mode[m_cmd0 & 3]);
|
||||
|
||||
if(m_stat0 & S0_FREE)
|
||||
switch(m_cmd0 & 3) {
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
logerror("wsect\n");
|
||||
exit(0);
|
||||
case 2:
|
||||
logerror("rhead\n");
|
||||
exit(0);
|
||||
case 3:
|
||||
logerror("read_sector start h=%d t=%2d s=%2d sz=%d\n",
|
||||
m_cmd1 & C1_SIDE ? 1 : 0,
|
||||
m_trck,
|
||||
m_sect,
|
||||
128 << ((m_cmd1 >> 5) & 3));
|
||||
m_state = S_WAIT_HEADER_SYNC;
|
||||
m_stat0 &= ~S0_FREE;
|
||||
m_window_start = m_last_sync;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void cd90_351_device::cmd1_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
m_cmd1 = data;
|
||||
logerror("cmd1_w %02x, sector=(size=%d, side=%d) precomp=%d sync_only_when_ready=%s\n", m_cmd1,
|
||||
128 << ((m_cmd1 >> 5) & 3),
|
||||
m_cmd1 & C1_SIDE ? 1 : 0,
|
||||
(m_cmd1 >> 1) & 7,
|
||||
m_cmd1 & C1_DSYRD ? "on" : "off");
|
||||
}
|
||||
|
||||
void cd90_351_device::cmd2_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
u8 prev = m_cmd2;
|
||||
|
||||
m_cmd2 = data;
|
||||
logerror("cmd2_w %02x, side=%d dir=%d step=%d motor=%s sel=%c%c\n", m_cmd2,
|
||||
m_cmd2 & C2_SISELB ? 1 : 0,
|
||||
m_cmd2 & C2_DIRECB ? 1 : 0,
|
||||
m_cmd2 & C2_STEP ? 1 : 0,
|
||||
m_cmd2 & C2_MTON ? "on" : "off",
|
||||
m_cmd2 & C2_DRS1 ? 'b' : '-',
|
||||
m_cmd2 & C2_DRS0 ? 'a' : '-');
|
||||
|
||||
if(m_cmd2 & C2_DRS0)
|
||||
m_cur_floppy = m_floppy[0]->get_device();
|
||||
else if(m_cmd2 & C2_DRS1)
|
||||
m_cur_floppy = m_floppy[1]->get_device();
|
||||
else
|
||||
m_cur_floppy = nullptr;
|
||||
|
||||
if(m_cur_floppy) {
|
||||
if((prev & C2_MTON) && !(m_cmd2 & C2_MTON))
|
||||
m_timer_motoroff->adjust(attotime::from_seconds(2));
|
||||
if(m_cmd2 & C2_MTON) {
|
||||
m_cur_floppy->mon_w(0);
|
||||
m_timer_motoroff->adjust(attotime::never);
|
||||
}
|
||||
m_cur_floppy->ss_w(m_cmd2 & C2_SISELB ? 0 : 1);
|
||||
m_cur_floppy->dir_w(m_cmd2 & C2_DIRECB ? 0 : 1);
|
||||
m_cur_floppy->stp_w(m_cmd2 & C2_STEP ? 0 : 1);
|
||||
}
|
||||
}
|
||||
|
||||
void cd90_351_device::wdata_w(u8 data)
|
||||
{
|
||||
m_data = data;
|
||||
m_stat0 &= ~(S0_BYTE | S0_DREQ);
|
||||
logerror("wdata_w %02x\n", data);
|
||||
}
|
||||
|
||||
void cd90_351_device::wclk_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
m_clk = data;
|
||||
logerror("wclk_w %02x\n", data);
|
||||
}
|
||||
|
||||
void cd90_351_device::wsect_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
m_sect = data;
|
||||
logerror("wsect_w %02x\n", data);
|
||||
}
|
||||
|
||||
void cd90_351_device::wtrck_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
m_trck = data;
|
||||
logerror("wtrck_w %02x\n", data);
|
||||
}
|
||||
|
||||
void cd90_351_device::wcell_w(u8 data)
|
||||
{
|
||||
sync();
|
||||
|
||||
m_cell = data;
|
||||
logerror("wcell_w %02x\n", data);
|
||||
}
|
||||
|
||||
u8 cd90_351_device::stat0_r()
|
||||
{
|
||||
if(!machine().side_effects_disabled()) {
|
||||
sync();
|
||||
static int ps = -1;
|
||||
if(m_stat0 != ps)
|
||||
logerror("stat0_r %02x -%s%s%s%s%s%s\n", m_stat0,
|
||||
m_stat0 & S0_BYTE ? " byte" : "",
|
||||
m_stat0 & S0_END ? " end" : "",
|
||||
m_stat0 & S0_FREE ? " free" : "",
|
||||
m_stat0 & S0_CRCER ? " crcer" : "",
|
||||
m_stat0 & S0_DREQ ? " dreq" : "",
|
||||
m_stat0 & S0_SYNC ? " sync" : "");
|
||||
ps = m_stat0;
|
||||
}
|
||||
return m_stat0;
|
||||
}
|
||||
|
||||
u8 cd90_351_device::stat1_r()
|
||||
{
|
||||
u8 res = 0;
|
||||
if(m_cur_floppy) {
|
||||
if(m_cur_floppy->idx_r())
|
||||
res |= S1_INDX;
|
||||
if(!m_cur_floppy->dskchg_r())
|
||||
res |= S1_DKCH;
|
||||
if(!m_cur_floppy->mon_r())
|
||||
res |= S1_MTON;
|
||||
if(!m_cur_floppy->trk00_r())
|
||||
res |= S1_TRK0;
|
||||
if(!m_cur_floppy->wpt_r())
|
||||
res |= S1_WPRT;
|
||||
if(!m_cur_floppy->ready_r())
|
||||
res |= S1_RDY;
|
||||
}
|
||||
|
||||
if(!machine().side_effects_disabled())
|
||||
logerror("stat1_r %02x -%s%s%s%s%s%s\n", res,
|
||||
res & S1_INDX ? " index" : "",
|
||||
res & S1_DKCH ? " dskchg" : "",
|
||||
res & S1_MTON ? " mton" : "",
|
||||
res & S1_TRK0 ? " trk0" : "",
|
||||
res & S1_WPRT ? " wprt" : "",
|
||||
res & S1_RDY ? " ready" : "");
|
||||
return res;
|
||||
}
|
||||
|
||||
u8 cd90_351_device::rdata_r()
|
||||
{
|
||||
if(!machine().side_effects_disabled())
|
||||
m_stat0 &= ~(S0_BYTE | S0_DREQ);
|
||||
return m_data;
|
||||
}
|
||||
|
||||
void cd90_351_device::bank_w(u8 data)
|
||||
{
|
||||
logerror("bank_w %d\n", data & 3);
|
||||
m_rom_bank->set_entry(data & 3);
|
||||
}
|
||||
|
||||
u64 cd90_351_device::time_to_cycles(const attotime &tm) const
|
||||
{
|
||||
return tm.as_ticks(clock());
|
||||
}
|
||||
|
||||
attotime cd90_351_device::cycles_to_time(u64 cycles) const
|
||||
{
|
||||
return attotime::from_ticks(cycles, clock());
|
||||
}
|
||||
|
||||
bool cd90_351_device::read_one_bit(u64 limit, u64 &next_flux_change)
|
||||
{
|
||||
while(next_flux_change <= m_last_sync) {
|
||||
attotime flux = m_cur_floppy ? m_cur_floppy->get_next_transition(cycles_to_time(m_last_sync+1)) : attotime::never;
|
||||
next_flux_change = flux.is_never() ? u64(-1) : time_to_cycles(flux);
|
||||
}
|
||||
|
||||
u64 window_end = m_window_start + (m_cell & 0x7f);
|
||||
if(window_end > limit)
|
||||
return true;
|
||||
|
||||
int bit = next_flux_change < window_end;
|
||||
if(bit && (m_cmd0 & C0_NOMCK))
|
||||
m_window_start = next_flux_change + ((m_cell & 0x7f) >> 1);
|
||||
else
|
||||
m_window_start = window_end;
|
||||
|
||||
m_last_sync = window_end;
|
||||
|
||||
m_shift_reg = (m_shift_reg << 1) | bit;
|
||||
m_bit_counter++;
|
||||
if(m_data_separator_phase) {
|
||||
m_data_reg = (m_data_reg << 1) | bit;
|
||||
if((m_crc ^ (bit ? 0x8000 : 0x0000)) & 0x8000)
|
||||
m_crc = (m_crc << 1) ^ 0x1021;
|
||||
else
|
||||
m_crc = m_crc << 1;
|
||||
}
|
||||
|
||||
m_data_separator_phase = !m_data_separator_phase;
|
||||
return false;
|
||||
}
|
||||
|
||||
u8 cd90_351_device::clk_bits() const
|
||||
{
|
||||
return
|
||||
(m_shift_reg & 0x8000 ? 0x80 : 0x00) |
|
||||
(m_shift_reg & 0x2000 ? 0x40 : 0x00) |
|
||||
(m_shift_reg & 0x0800 ? 0x20 : 0x00) |
|
||||
(m_shift_reg & 0x0200 ? 0x10 : 0x00) |
|
||||
(m_shift_reg & 0x0080 ? 0x08 : 0x00) |
|
||||
(m_shift_reg & 0x0020 ? 0x04 : 0x00) |
|
||||
(m_shift_reg & 0x0008 ? 0x02 : 0x00) |
|
||||
(m_shift_reg & 0x0002 ? 0x01 : 0x00);
|
||||
}
|
||||
|
||||
|
||||
void cd90_351_device::sync()
|
||||
{
|
||||
u64 next_sync = machine().time().as_ticks(clock());
|
||||
u64 next_flux_change = 0;
|
||||
while(m_last_sync < next_sync)
|
||||
switch(m_state) {
|
||||
case S_IDLE:
|
||||
m_last_sync = next_sync;
|
||||
break;
|
||||
|
||||
case S_WAIT_HEADER_SYNC: {
|
||||
if(read_one_bit(next_sync, next_flux_change))
|
||||
return;
|
||||
if(m_shift_reg == 0xaaaa) {
|
||||
m_crc = 0xffff;
|
||||
m_data_separator_phase = false;
|
||||
}
|
||||
if(m_data_reg == m_data && clk_bits() == m_clk) {
|
||||
m_bit_counter = 0;
|
||||
m_state = S_VERIFY_HEADER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case S_VERIFY_HEADER: {
|
||||
if(read_one_bit(next_sync, next_flux_change))
|
||||
return;
|
||||
if(m_bit_counter & 0xf)
|
||||
break;
|
||||
bool valid = true;
|
||||
switch(m_bit_counter >> 4) {
|
||||
case 1:
|
||||
case 2:
|
||||
valid = m_data_reg == m_data && clk_bits() == m_clk;
|
||||
break;
|
||||
case 3:
|
||||
valid = m_data_reg == 0xfe;
|
||||
break;
|
||||
case 4:
|
||||
valid = m_data_reg == m_trck;
|
||||
break;
|
||||
case 5:
|
||||
valid = (m_data_reg & 1) == (m_cmd1 & C1_SIDE ? 1 : 0);
|
||||
break;
|
||||
case 6:
|
||||
valid = m_data_reg == m_sect;
|
||||
break;
|
||||
case 7:
|
||||
valid = (m_data_reg & 3) == ((m_cmd1 >> 5) & 3);
|
||||
break;
|
||||
// 8 skipped
|
||||
case 9:
|
||||
valid = m_crc == 0;
|
||||
m_bit_counter = 0;
|
||||
m_state = S_SKIP_GAP;
|
||||
break;
|
||||
}
|
||||
if(!valid)
|
||||
m_state = S_WAIT_HEADER_SYNC;
|
||||
break;
|
||||
}
|
||||
|
||||
case S_SKIP_GAP:
|
||||
if(read_one_bit(next_sync, next_flux_change))
|
||||
return;
|
||||
if(m_bit_counter == 27 << 4) {
|
||||
m_bit_counter = 0;
|
||||
m_state = S_WAIT_SECTOR_SYNC;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case S_WAIT_SECTOR_SYNC: {
|
||||
if(read_one_bit(next_sync, next_flux_change))
|
||||
return;
|
||||
if(m_shift_reg == 0xaaaa) {
|
||||
m_crc = 0xffff;
|
||||
m_data_separator_phase = false;
|
||||
}
|
||||
if(m_data_reg == m_data && clk_bits() == m_clk) {
|
||||
m_bit_counter = 0;
|
||||
m_data = m_data_reg;
|
||||
m_stat0 |= S0_DREQ;
|
||||
m_state = S_READ_SECTOR;
|
||||
}
|
||||
if(m_bit_counter == 42 << 4)
|
||||
m_state = S_WAIT_HEADER_SYNC;
|
||||
break;
|
||||
}
|
||||
|
||||
case S_READ_SECTOR:
|
||||
if(read_one_bit(next_sync, next_flux_change))
|
||||
return;
|
||||
if(m_bit_counter != 16)
|
||||
break;
|
||||
if(m_stat0 & (S0_BYTE|S0_DREQ)) {
|
||||
logerror("read_sector end\n");
|
||||
if(m_crc)
|
||||
m_stat0 |= S0_CRCER;
|
||||
m_stat0 &= ~S0_BYTE;
|
||||
m_stat0 |= S0_FREE;
|
||||
m_cmd0 &= ~3;
|
||||
m_state = S_IDLE;
|
||||
break;
|
||||
}
|
||||
m_stat0 |= S0_BYTE;
|
||||
m_data = m_data_reg;
|
||||
m_bit_counter = 0;
|
||||
break;
|
||||
}
|
||||
}
|
122
src/devices/bus/thomson/cd90_351.h
Normal file
122
src/devices/bus/thomson/cd90_351.h
Normal file
@ -0,0 +1,122 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CD 90-351 - Custom floppy drive controller (THMFC1)
|
||||
//
|
||||
// Handles up to two 3.5 dual-sided drives (DD 90-352)
|
||||
// or up to two 2.8 dual-sided QDD drivers (QD 90-280)
|
||||
|
||||
#ifndef MAME_BUS_THOMSON_CD90_351_H
|
||||
#define MAME_BUS_THOMSON_CD90_351_H
|
||||
|
||||
#include "extension.h"
|
||||
#include "imagedev/floppy.h"
|
||||
|
||||
class cd90_351_device : public device_t, public thomson_extension_interface
|
||||
{
|
||||
public:
|
||||
cd90_351_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 16000000);
|
||||
virtual ~cd90_351_device() = default;
|
||||
|
||||
virtual void rom_map(address_map &map) override;
|
||||
virtual void io_map(address_map &map) override;
|
||||
|
||||
protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
virtual void device_post_load() override;
|
||||
|
||||
private:
|
||||
enum {
|
||||
ID_MOTOROFF = 0,
|
||||
};
|
||||
|
||||
enum {
|
||||
S0_BYTE = 0x80,
|
||||
S0_END = 0x10,
|
||||
S0_FREE = 0x08,
|
||||
S0_CRCER = 0x04,
|
||||
S0_DREQ = 0x02,
|
||||
S0_SYNC = 0x01,
|
||||
|
||||
S1_INDX = 0x40,
|
||||
S1_DKCH = 0x20,
|
||||
S1_MTON = 0x10,
|
||||
S1_TRK0 = 0x08,
|
||||
S1_WPRT = 0x04,
|
||||
S1_RDY = 0x02,
|
||||
|
||||
C0_FM = 0x20,
|
||||
C0_ENSYN = 0x10,
|
||||
C0_NOMCK = 0x08,
|
||||
C0_WGC = 0x04,
|
||||
|
||||
C1_SIDE = 0x10,
|
||||
C1_DSYRD = 0x01,
|
||||
|
||||
C2_SISELB = 0x40,
|
||||
C2_DIRECB = 0x20,
|
||||
C2_STEP = 0x10,
|
||||
C2_MTON = 0x04,
|
||||
C2_DRS1 = 0x02,
|
||||
C2_DRS0 = 0x01,
|
||||
};
|
||||
|
||||
enum {
|
||||
S_IDLE,
|
||||
S_WAIT_HEADER_SYNC,
|
||||
S_VERIFY_HEADER,
|
||||
S_SKIP_GAP,
|
||||
S_WAIT_SECTOR_SYNC,
|
||||
S_READ_SECTOR,
|
||||
};
|
||||
|
||||
required_device_array<floppy_connector, 2> m_floppy;
|
||||
required_memory_region m_rom;
|
||||
memory_bank_creator m_rom_bank;
|
||||
floppy_image_device *m_cur_floppy;
|
||||
emu_timer *m_timer_motoroff;
|
||||
|
||||
u64 m_last_sync, m_window_start;
|
||||
int m_state;
|
||||
|
||||
u16 m_shift_reg, m_crc, m_bit_counter;
|
||||
u8 m_data_reg;
|
||||
|
||||
u8 m_cmd0, m_cmd1, m_cmd2, m_stat0;
|
||||
u8 m_data, m_clk, m_sect, m_trck, m_cell;
|
||||
|
||||
bool m_data_separator_phase;
|
||||
|
||||
static void floppy_formats(format_registration &fr);
|
||||
static void floppy_drives(device_slot_interface &device);
|
||||
|
||||
u8 clk_bits() const;
|
||||
|
||||
void cmd0_w(u8 data);
|
||||
void cmd1_w(u8 data);
|
||||
void cmd2_w(u8 data);
|
||||
void wdata_w(u8 data);
|
||||
void wclk_w(u8 data);
|
||||
void wsect_w(u8 data);
|
||||
void wtrck_w(u8 data);
|
||||
void wcell_w(u8 data);
|
||||
void bank_w(u8 data);
|
||||
|
||||
u8 stat0_r();
|
||||
u8 stat1_r();
|
||||
u8 rdata_r();
|
||||
|
||||
u64 time_to_cycles(const attotime &tm) const;
|
||||
attotime cycles_to_time(u64 cycles) const;
|
||||
|
||||
void sync();
|
||||
bool read_one_bit(u64 limit, u64 &next_flux_change);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(CD90_351, cd90_351_device)
|
||||
|
||||
#endif
|
91
src/devices/bus/thomson/cd90_640.cpp
Normal file
91
src/devices/bus/thomson/cd90_640.cpp
Normal file
@ -0,0 +1,91 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CD 90-640 - Floppy drive controller built from a wd1770
|
||||
//
|
||||
// Handles up to two 5.25 dual-sided drives (DD 90-320)
|
||||
|
||||
#include "emu.h"
|
||||
#include "cd90_640.h"
|
||||
#include "formats/thom_dsk.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(CD90_640, cd90_640_device, "cd90_640", "Thomson CD90-640 floppy drive controller")
|
||||
|
||||
cd90_640_device::cd90_640_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, CD90_640, tag, owner, clock),
|
||||
thomson_extension_interface(mconfig, *this),
|
||||
m_fdc(*this, "fdc"),
|
||||
m_floppy(*this, "%u", 0U),
|
||||
m_rom(*this, "rom")
|
||||
{
|
||||
}
|
||||
|
||||
ROM_START(cd90_640)
|
||||
ROM_REGION( 0x7c0, "rom", 0 )
|
||||
ROM_LOAD ( "cd90-640.rom", 0x000, 0x7c0, CRC(5114c0a5) SHA1(5c72566c22d8160ef0c75959e1863a1309bbbe49) )
|
||||
ROM_END
|
||||
|
||||
void cd90_640_device::rom_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0x7bf).rom().region(m_rom, 0);
|
||||
}
|
||||
|
||||
void cd90_640_device::io_map(address_map &map)
|
||||
{
|
||||
map(0, 3).rw(m_fdc, FUNC(wd1770_device::read), FUNC(wd1770_device::write));
|
||||
map(8, 8).rw(FUNC(cd90_640_device::control_r), FUNC(cd90_640_device::control_w));
|
||||
}
|
||||
|
||||
const tiny_rom_entry *cd90_640_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(cd90_640);
|
||||
}
|
||||
|
||||
void cd90_640_device::floppy_drives(device_slot_interface &device)
|
||||
{
|
||||
device.option_add("dd90_640", FLOPPY_525_DD);
|
||||
}
|
||||
|
||||
void cd90_640_device::floppy_formats(format_registration &fr)
|
||||
{
|
||||
fr.add(FLOPPY_THOMSON_525_FORMAT);
|
||||
}
|
||||
|
||||
void cd90_640_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
WD1770(config, m_fdc, 8_MHz_XTAL);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[0], floppy_drives, "dd90_640", floppy_formats).enable_sound(true);
|
||||
FLOPPY_CONNECTOR(config, m_floppy[1], floppy_drives, nullptr, floppy_formats).enable_sound(true);
|
||||
}
|
||||
|
||||
void cd90_640_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_control));
|
||||
}
|
||||
|
||||
void cd90_640_device::device_reset()
|
||||
{
|
||||
m_control = 0;
|
||||
m_fdc->set_floppy(nullptr);
|
||||
m_fdc->dden_w(0);
|
||||
}
|
||||
|
||||
void cd90_640_device::control_w(u8 data)
|
||||
{
|
||||
m_control = data;
|
||||
floppy_image_device *floppy = nullptr;
|
||||
if(m_control & 2)
|
||||
floppy = m_floppy[0]->get_device();
|
||||
else if(m_control & 4)
|
||||
floppy = m_floppy[1]->get_device();
|
||||
if(floppy)
|
||||
floppy->ss_w(m_control & 1);
|
||||
m_fdc->set_floppy(floppy);
|
||||
m_fdc->dden_w(m_control & 0x80 ? 1 : 0);
|
||||
logerror("control %02x\n", m_control);
|
||||
}
|
||||
|
||||
u8 cd90_640_device::control_r()
|
||||
{
|
||||
return m_control;
|
||||
}
|
46
src/devices/bus/thomson/cd90_640.h
Normal file
46
src/devices/bus/thomson/cd90_640.h
Normal file
@ -0,0 +1,46 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CD 90-640 - Floppy drive controller built from a wd1770
|
||||
//
|
||||
// Handles up to two 5.25 dual-sided drives (DD 90-320)
|
||||
|
||||
#ifndef MAME_BUS_THOMSON_CD90_640_H
|
||||
#define MAME_BUS_THOMSON_CD90_640_H
|
||||
|
||||
#include "extension.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
|
||||
class cd90_640_device : public device_t, public thomson_extension_interface
|
||||
{
|
||||
public:
|
||||
cd90_640_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
virtual ~cd90_640_device() = default;
|
||||
|
||||
virtual void rom_map(address_map &map) override;
|
||||
virtual void io_map(address_map &map) override;
|
||||
|
||||
protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
private:
|
||||
required_device<wd1770_device> m_fdc;
|
||||
required_device_array<floppy_connector, 2> m_floppy;
|
||||
required_memory_region m_rom;
|
||||
|
||||
u8 m_control;
|
||||
|
||||
void control_w(u8 data);
|
||||
u8 control_r();
|
||||
|
||||
static void floppy_formats(format_registration &fr);
|
||||
static void floppy_drives(device_slot_interface &device);
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(CD90_640, cd90_640_device)
|
||||
|
||||
#endif
|
76
src/devices/bus/thomson/cq90_028.cpp
Normal file
76
src/devices/bus/thomson/cq90_028.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CQ 90-028 - QDD drive controller built from a motorola 6852 (serial chip)
|
||||
//
|
||||
// Handles n? QDD drives (QD 90-128)
|
||||
|
||||
// Nonfunctional, essentially because we have no container for the QDD
|
||||
// (it's not a floppy, the closest equivalent would be a digital tape)
|
||||
|
||||
#include "emu.h"
|
||||
#include "cq90_028.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(CQ90_028, cq90_028_device, "cq90_028", "Thomson CQ90-028 QDD 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_extension_interface(mconfig, *this),
|
||||
m_serial(*this, "serial"),
|
||||
m_rom(*this, "rom")
|
||||
{
|
||||
}
|
||||
|
||||
ROM_START(cq90_028)
|
||||
ROM_REGION( 0x7c0, "rom", 0 )
|
||||
ROM_LOAD ( "cq90-028.rom", 0x000, 0x7c0, CRC(ca4dba3d) SHA1(949c1f777c892da62c242215d79757d61e71e62b) )
|
||||
ROM_END
|
||||
|
||||
void cq90_028_device::rom_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0x7bf).rom().region(m_rom, 0);
|
||||
}
|
||||
|
||||
void cq90_028_device::io_map(address_map &map)
|
||||
{
|
||||
map(0x0, 0x1).rw(m_serial, FUNC(mc6852_device::read), FUNC(mc6852_device::write));
|
||||
map(0x8, 0x8).rw(FUNC(cq90_028_device::status_r), FUNC(cq90_028_device::drive_w));
|
||||
map(0xc, 0xc).w(FUNC(cq90_028_device::motor_w));
|
||||
}
|
||||
|
||||
const tiny_rom_entry *cq90_028_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(cq90_028);
|
||||
}
|
||||
|
||||
void cq90_028_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
MC6852(config, m_serial, 16_MHz_XTAL / 16); // Comes from the main board
|
||||
// Base tx/rx clock is 101564Hz
|
||||
// There's probably a pll in the gate array
|
||||
}
|
||||
|
||||
void cq90_028_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
void cq90_028_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
void cq90_028_device::drive_w(u8 data)
|
||||
{
|
||||
logerror("drive_w %02x\n", data);
|
||||
}
|
||||
|
||||
void cq90_028_device::motor_w(u8 data)
|
||||
{
|
||||
logerror("motor_w %02x\n", data);
|
||||
}
|
||||
|
||||
u8 cq90_028_device::status_r()
|
||||
{
|
||||
// 40 = disk absent
|
||||
// 80 = index pulse
|
||||
return 0x40;
|
||||
}
|
42
src/devices/bus/thomson/cq90_028.h
Normal file
42
src/devices/bus/thomson/cq90_028.h
Normal file
@ -0,0 +1,42 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// CQ 90-028 - QDD drive controller built from a motorola 6852 (serial chip)
|
||||
//
|
||||
// Handles n? QDD drives (QD 90-128)
|
||||
|
||||
#ifndef MAME_BUS_THOMSON_CQ90_028_H
|
||||
#define MAME_BUS_THOMSON_CQ90_028_H
|
||||
|
||||
#include "extension.h"
|
||||
#include "machine/mc6852.h"
|
||||
|
||||
class cq90_028_device : public device_t, public thomson_extension_interface
|
||||
{
|
||||
public:
|
||||
cq90_028_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
virtual ~cq90_028_device() = default;
|
||||
|
||||
static constexpr feature_type unemulated_features() { return feature::DISK; }
|
||||
|
||||
virtual void rom_map(address_map &map) override;
|
||||
virtual void io_map(address_map &map) override;
|
||||
|
||||
protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
private:
|
||||
required_device<mc6852_device> m_serial;
|
||||
required_memory_region m_rom;
|
||||
|
||||
void drive_w(u8 data);
|
||||
void motor_w(u8 data);
|
||||
u8 status_r();
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(CQ90_028, cq90_028_device)
|
||||
|
||||
#endif
|
40
src/devices/bus/thomson/extension.cpp
Normal file
40
src/devices/bus/thomson/extension.cpp
Normal file
@ -0,0 +1,40 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// Generic Thomson TO*/MO* extension slot
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "extension.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(THOMSON_EXTENSION, thomson_extension_device, "thomson_extension", "Thomson TO*/MO* extension port")
|
||||
|
||||
thomson_extension_device::thomson_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, THOMSON_EXTENSION, tag, owner, clock),
|
||||
device_single_card_slot_interface<thomson_extension_interface>(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
void thomson_extension_device::rom_map(address_space_installer &space, offs_t start, offs_t end)
|
||||
{
|
||||
auto dev = get_card_device();
|
||||
if(dev)
|
||||
space.install_device(start, end, *dev, &thomson_extension_interface::rom_map);
|
||||
}
|
||||
|
||||
void thomson_extension_device::io_map(address_space_installer &space, offs_t start, offs_t end)
|
||||
{
|
||||
auto dev = get_card_device();
|
||||
if(dev)
|
||||
space.install_device(start, end, *dev, &thomson_extension_interface::io_map);
|
||||
}
|
||||
|
||||
void thomson_extension_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
thomson_extension_interface::thomson_extension_interface(const machine_config &mconfig, device_t &device) :
|
||||
device_interface(device, "extension")
|
||||
{
|
||||
}
|
||||
|
39
src/devices/bus/thomson/extension.h
Normal file
39
src/devices/bus/thomson/extension.h
Normal file
@ -0,0 +1,39 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
// Generic Thomson TO*/MO* extension slot
|
||||
|
||||
#ifndef MAME_BUS_THOMSON_EXTENSION_H
|
||||
#define MAME_BUS_THOMSON_EXTENSION_H
|
||||
|
||||
class thomson_extension_interface : public device_interface
|
||||
{
|
||||
public:
|
||||
thomson_extension_interface(const machine_config &mconfig, device_t &device);
|
||||
virtual ~thomson_extension_interface() = default;
|
||||
|
||||
// 0x7c0 window at e000 on TO* and a000 on MO*
|
||||
virtual void rom_map(address_map &map) = 0;
|
||||
|
||||
// 0x10 window at e7d0 on TO* and a7e0 on MO*
|
||||
virtual void io_map(address_map &map) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class thomson_extension_device : public device_t, public device_single_card_slot_interface<thomson_extension_interface>
|
||||
{
|
||||
public:
|
||||
thomson_extension_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
|
||||
virtual ~thomson_extension_device() = default;
|
||||
|
||||
void rom_map(address_space_installer &space, offs_t start, offs_t end);
|
||||
void io_map(address_space_installer &space, offs_t start, offs_t end);
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(THOMSON_EXTENSION, thomson_extension_device)
|
||||
|
||||
#endif
|
205
src/devices/bus/thomson/nanoreseau.cpp
Normal file
205
src/devices/bus/thomson/nanoreseau.cpp
Normal file
@ -0,0 +1,205 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Antoine Mine, Olivier Galibert
|
||||
|
||||
// The "Nanoreseau" was a proprietary networking for MO/TO Thomson
|
||||
// computers using rs-485. A PC is supposed to be used as a network
|
||||
// head.
|
||||
|
||||
#include "emu.h"
|
||||
#include "nanoreseau.h"
|
||||
|
||||
DEFINE_DEVICE_TYPE(NANORESEAU_TO, nanoreseau_to_device, "nanoreseau_to", "Nanoreseau controller (TO rom)")
|
||||
DEFINE_DEVICE_TYPE(NANORESEAU_MO, nanoreseau_mo_device, "nanoreseau_mo", "Nanoreseau controller (MO rom)")
|
||||
|
||||
nanoreseau_device::nanoreseau_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool no_id) :
|
||||
device_t(mconfig, type, tag, owner, clock),
|
||||
thomson_extension_interface(mconfig, *this),
|
||||
m_mc6854(*this, "mc6854"),
|
||||
m_rom(*this, "rom"),
|
||||
m_id(*this, "id"),
|
||||
m_no_id(no_id)
|
||||
{
|
||||
}
|
||||
|
||||
nanoreseau_to_device::nanoreseau_to_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, bool no_id) :
|
||||
nanoreseau_device(mconfig, NANORESEAU_TO, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
nanoreseau_mo_device::nanoreseau_mo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, bool no_id) :
|
||||
nanoreseau_device(mconfig, NANORESEAU_MO, tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
ROM_START(nanoreseau_to)
|
||||
ROM_REGION( 0x7c0, "rom", 0 )
|
||||
ROM_LOAD ( "nano7.rom", 0x000, 0x7c0, CRC(42a1d1a6) SHA1(973209f4baa5e81bf7885c0602949e064bac7862) )
|
||||
ROM_END
|
||||
|
||||
ROM_START(nanoreseau_mo)
|
||||
ROM_REGION( 0x7c0, "rom", 0 )
|
||||
ROM_LOAD ( "nano5.rom", 0x000, 0x7c0, CRC(2f756868) SHA1(b5b7cb6d12493d849330b6b5628efd1a83a4bbf5) )
|
||||
ROM_END
|
||||
|
||||
static INPUT_PORTS_START(nanoreseau_config)
|
||||
PORT_START("id")
|
||||
PORT_CONFNAME(0x1f, 0x01, "Network ID")
|
||||
PORT_CONFSETTING(0x00, "0 (Master)")
|
||||
PORT_CONFSETTING(0x01, "1")
|
||||
PORT_CONFSETTING(0x02, "2")
|
||||
PORT_CONFSETTING(0x03, "3")
|
||||
PORT_CONFSETTING(0x04, "4")
|
||||
PORT_CONFSETTING(0x05, "5")
|
||||
PORT_CONFSETTING(0x06, "6")
|
||||
PORT_CONFSETTING(0x07, "7")
|
||||
PORT_CONFSETTING(0x08, "8")
|
||||
PORT_CONFSETTING(0x09, "9")
|
||||
PORT_CONFSETTING(0x0a, "10")
|
||||
PORT_CONFSETTING(0x0b, "11")
|
||||
PORT_CONFSETTING(0x0c, "12")
|
||||
PORT_CONFSETTING(0x0d, "13")
|
||||
PORT_CONFSETTING(0x0e, "14")
|
||||
PORT_CONFSETTING(0x0f, "15")
|
||||
PORT_CONFSETTING(0x10, "16")
|
||||
PORT_CONFSETTING(0x11, "17")
|
||||
PORT_CONFSETTING(0x12, "18")
|
||||
PORT_CONFSETTING(0x13, "19")
|
||||
PORT_CONFSETTING(0x14, "20")
|
||||
PORT_CONFSETTING(0x15, "21")
|
||||
PORT_CONFSETTING(0x16, "22")
|
||||
PORT_CONFSETTING(0x17, "23")
|
||||
PORT_CONFSETTING(0x18, "24")
|
||||
PORT_CONFSETTING(0x19, "25")
|
||||
PORT_CONFSETTING(0x1a, "26")
|
||||
PORT_CONFSETTING(0x1b, "27")
|
||||
PORT_CONFSETTING(0x1c, "28")
|
||||
PORT_CONFSETTING(0x1d, "29")
|
||||
PORT_CONFSETTING(0x1e, "30")
|
||||
PORT_CONFSETTING(0x1f, "31")
|
||||
INPUT_PORTS_END
|
||||
|
||||
void nanoreseau_device::rom_map(address_map &map)
|
||||
{
|
||||
map(0x000, 0x7bf).rom().region(m_rom, 0);
|
||||
}
|
||||
|
||||
void nanoreseau_device::io_map(address_map &map)
|
||||
{
|
||||
map(0, 3).rw(m_mc6854, FUNC(mc6854_device::read), FUNC(mc6854_device::write));
|
||||
if(!m_no_id)
|
||||
map(8, 8).r(FUNC(nanoreseau_device::id_r));
|
||||
}
|
||||
|
||||
const tiny_rom_entry *nanoreseau_to_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(nanoreseau_to);
|
||||
}
|
||||
|
||||
const tiny_rom_entry *nanoreseau_mo_device::device_rom_region() const
|
||||
{
|
||||
return ROM_NAME(nanoreseau_mo);
|
||||
}
|
||||
|
||||
void nanoreseau_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
MC6854(config, m_mc6854);
|
||||
m_mc6854->set_out_frame_callback(FUNC(nanoreseau_device::got_frame));
|
||||
}
|
||||
|
||||
void nanoreseau_device::device_start()
|
||||
{
|
||||
m_timer = timer_alloc(0);
|
||||
save_item(NAME(m_answer_step));
|
||||
}
|
||||
|
||||
void nanoreseau_device::device_reset()
|
||||
{
|
||||
m_answer_step = 4;
|
||||
m_mc6854->set_cts(0);
|
||||
m_mc6854->set_cts(1);
|
||||
}
|
||||
|
||||
ioport_constructor nanoreseau_device::device_input_ports() const
|
||||
{
|
||||
return m_no_id ? nullptr : INPUT_PORTS_NAME(nanoreseau_config);
|
||||
}
|
||||
|
||||
/*********************** Network ************************/
|
||||
|
||||
/* The network extension is built as an external floppy controller.
|
||||
It uses the same ROM and I/O space, and so, it is natural to have the
|
||||
toplevel network emulation here!
|
||||
*/
|
||||
|
||||
/* NOTE: This is work in progress!
|
||||
For the moment, only hand-checks works: the TO7 can take the line, then
|
||||
perform a DKBOOT request. We do not have the server emulated yet, so,
|
||||
no way to answer the request.
|
||||
*/
|
||||
|
||||
/* consigne DKBOOT
|
||||
|
||||
MO5 BASIC
|
||||
$00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $01 $00<$41 $00 $FF $20
|
||||
$3D $4C $01 $60 $20 $3C $4F $01 $05 $20 $3F $9C $19 $25 $03 $11
|
||||
$93 $15 $10 $25 $32 $8A $7E $FF $E1 $FD $E9 $41>$00 $00 $00 $00
|
||||
$00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
|
||||
|
||||
TO7/70 BASIC
|
||||
$00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $02 $00<$20 $42 $41 $53
|
||||
$49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30
|
||||
$04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00
|
||||
$00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
|
||||
|
||||
TO7 BASIC
|
||||
$00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$20 $42 $41 $53
|
||||
$49 $43 $20 $4D $49 $43 $52 $4F $53 $4F $46 $54 $20 $31 $2E $30
|
||||
$04 $00 $00 $00 $00 $00 $60 $FF $37 $9B $37 $9C>$00 $00 $00 $00
|
||||
$00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
|
||||
|
||||
TO7 LOGO
|
||||
$00 $00 $01 $00 $00 $00 $00 $00 $00 $00 $00 $00<$00 $00 $00 $00
|
||||
$00 $20 $4C $4F $47 $4F $04 $00 $00 $00 $00 $00 $00 $00 $00 $00
|
||||
$00 $00 $00 $00 $00 $00 $AA $FF $01 $16 $00 $C8>$00 $00 $00 $00
|
||||
$00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00 $00
|
||||
|
||||
|
||||
*/
|
||||
|
||||
void nanoreseau_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
m_answer_step ++;
|
||||
m_mc6854->set_cts(m_answer_step & 1);
|
||||
if(m_answer_step < 4)
|
||||
m_timer->adjust(attotime::from_usec(100));
|
||||
}
|
||||
|
||||
void nanoreseau_device::got_frame(uint8_t *data, int length)
|
||||
{
|
||||
std::string frame = util::string_format("%s: frame", machine().time().to_string());
|
||||
for(int i = 0; i < length; i++)
|
||||
frame += util::string_format(" %02x", data[i]);
|
||||
logerror("%s\n", frame);
|
||||
|
||||
if(data[1] == 0xff) {
|
||||
logerror("frame: %d phones %d\n", data[2], data[0]);
|
||||
m_answer_step = 0;
|
||||
m_timer->adjust(attotime::from_usec(100));
|
||||
m_mc6854->set_cts(0);
|
||||
|
||||
} else if (!data[1]) {
|
||||
char name[33];
|
||||
memcpy(name, data + 12, 32);
|
||||
name[32] = 0;
|
||||
for(int i=0; i<32; i++)
|
||||
if(name[i] < 32 || name[i] >= 127)
|
||||
name[i]='.';
|
||||
logerror("DKBOOT system %s appli %s\n", data[10] == 0 ? "TO7" : data[10] == 1 ? "MO5" : data[10] == 2 ? "TO7/70" : "?", name);
|
||||
}
|
||||
}
|
||||
|
||||
u8 nanoreseau_device::id_r()
|
||||
{
|
||||
// network ID of the computer
|
||||
return m_id->read();
|
||||
}
|
66
src/devices/bus/thomson/nanoreseau.h
Normal file
66
src/devices/bus/thomson/nanoreseau.h
Normal file
@ -0,0 +1,66 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Antoine Mine, Olivier Galibert
|
||||
|
||||
// The "Nanoreseau" was a proprietary networking for MO/TO Thomson
|
||||
// computers using rs-485. A PC is supposed to be used as a network
|
||||
// head.
|
||||
|
||||
#ifndef MAME_BUS_THOMSON_NANORESEAU_H
|
||||
#define MAME_BUS_THOMSON_NANORESEAU_H
|
||||
|
||||
#include "extension.h"
|
||||
#include "machine/mc6854.h"
|
||||
|
||||
class nanoreseau_device : public device_t, public thomson_extension_interface
|
||||
{
|
||||
public:
|
||||
nanoreseau_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool no_id = false);
|
||||
virtual ~nanoreseau_device() = default;
|
||||
|
||||
virtual void rom_map(address_map &map) override;
|
||||
virtual void io_map(address_map &map) override;
|
||||
|
||||
protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
required_device<mc6854_device> m_mc6854;
|
||||
required_memory_region m_rom;
|
||||
required_ioport m_id;
|
||||
bool m_no_id;
|
||||
|
||||
emu_timer *m_timer;
|
||||
int m_answer_step;
|
||||
|
||||
void got_frame(uint8_t *data, int length);
|
||||
u8 id_r();
|
||||
};
|
||||
|
||||
class nanoreseau_mo_device : public nanoreseau_device
|
||||
{
|
||||
public:
|
||||
nanoreseau_mo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0, bool no_id = false);
|
||||
virtual ~nanoreseau_mo_device() = default;
|
||||
|
||||
protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
};
|
||||
|
||||
class nanoreseau_to_device : public nanoreseau_device
|
||||
{
|
||||
public:
|
||||
nanoreseau_to_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0, bool no_id = false);
|
||||
virtual ~nanoreseau_to_device() = default;
|
||||
|
||||
protected:
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(NANORESEAU_MO, nanoreseau_mo_device)
|
||||
DECLARE_DEVICE_TYPE(NANORESEAU_TO, nanoreseau_to_device)
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
@ -1,43 +1,30 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Antoine Mine
|
||||
/**********************************************************************
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
Copyright (C) Antoine Mine' 2007
|
||||
|
||||
Motorola 6843 Floppy Disk Controller emulation.
|
||||
|
||||
**********************************************************************/
|
||||
// Motorola 6843 floppy drive controller
|
||||
//
|
||||
// The Hitachi HD46503S, HD6843 and HD68A43 seem identical
|
||||
|
||||
#ifndef MAME_MACHINE_MC6843_H
|
||||
#define MAME_MACHINE_MC6843_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "imagedev/flopdrv.h"
|
||||
|
||||
#include "imagedev/floppy.h"
|
||||
#include "fdc_pll.h"
|
||||
|
||||
class mc6843_device : public device_t
|
||||
{
|
||||
public:
|
||||
mc6843_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
template<int Id, typename T> void set_floppy_drive(T &&tag) { m_floppy[Id].set_tag(std::forward<T>(tag)); }
|
||||
template<typename T, typename U, typename V, typename W> void set_floppy_drives(T &&tag0, U &&tag1, V &&tag2, W &&tag3)
|
||||
{
|
||||
m_floppy[0].set_tag(std::forward<T>(tag0));
|
||||
m_floppy[1].set_tag(std::forward<U>(tag1));
|
||||
m_floppy[2].set_tag(std::forward<V>(tag2));
|
||||
m_floppy[3].set_tag(std::forward<W>(tag3));
|
||||
}
|
||||
void force_ready() { m_force_ready = true; }
|
||||
|
||||
auto irq() { return m_write_irq.bind(); }
|
||||
auto irq() { return m_irq.bind(); }
|
||||
|
||||
uint8_t read(offs_t offset);
|
||||
void write(offs_t offset, uint8_t data);
|
||||
void set_floppy(floppy_image_device *floppy);
|
||||
|
||||
void set_drive(int drive);
|
||||
void set_side(int side);
|
||||
void set_index_pulse(int index_pulse);
|
||||
void map(address_map &map);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -46,52 +33,163 @@ protected:
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
TIMER_CONT
|
||||
// Status flags
|
||||
enum {
|
||||
SA_BUSY = 0x80,
|
||||
SA_IDX = 0x40,
|
||||
SA_TNEQ = 0x20,
|
||||
SA_WPT = 0x10,
|
||||
SA_TRK0 = 0x08,
|
||||
SA_RDY = 0x04,
|
||||
SA_DDM = 0x02,
|
||||
SA_DTR = 0x01,
|
||||
|
||||
SB_HERR = 0x80,
|
||||
SB_WERR = 0x40,
|
||||
SB_FI = 0x20,
|
||||
SB_SERR = 0x10,
|
||||
SB_SAERR = 0x08,
|
||||
SB_DMERR = 0x04,
|
||||
SB_CRC = 0x02,
|
||||
SB_DTERR = 0x01,
|
||||
|
||||
I_STRB = 0x08,
|
||||
I_SSR = 0x04,
|
||||
I_SCE = 0x02,
|
||||
I_RWCE = 0x01,
|
||||
|
||||
C_STZ = 0x2,
|
||||
C_SEK = 0x3,
|
||||
C_SSR = 0x4,
|
||||
C_SSW = 0x5,
|
||||
C_RCR = 0x6,
|
||||
C_SWD = 0x7,
|
||||
C_FFR = 0xa,
|
||||
C_FFW = 0xb,
|
||||
C_MSR = 0xc,
|
||||
C_MSW = 0xd,
|
||||
};
|
||||
|
||||
optional_device_array<legacy_floppy_image_device, 4> m_floppy;
|
||||
enum {
|
||||
S_IDLE,
|
||||
|
||||
devcb_write_line m_write_irq;
|
||||
S_STZ_STEP,
|
||||
S_STZ_STEP_WAIT,
|
||||
S_STZ_HEAD_SETTLING,
|
||||
|
||||
/* registers */
|
||||
uint8_t m_CTAR; /* current track */
|
||||
uint8_t m_CMR; /* command */
|
||||
uint8_t m_ISR; /* interrupt status */
|
||||
uint8_t m_SUR; /* set-up */
|
||||
uint8_t m_STRA; /* status */
|
||||
uint8_t m_STRB; /* status */
|
||||
uint8_t m_SAR; /* sector address */
|
||||
uint8_t m_GCR; /* general count */
|
||||
uint8_t m_CCR; /* CRC control */
|
||||
uint8_t m_LTAR; /* logical address track (=track destination) */
|
||||
S_SEEK_STEP,
|
||||
S_SEEK_STEP_WAIT,
|
||||
S_SEEK_HEAD_SETTLING,
|
||||
|
||||
/* internal state */
|
||||
uint8_t m_drive;
|
||||
uint8_t m_side;
|
||||
uint8_t m_data[128]; /* sector buffer */
|
||||
uint32_t m_data_size; /* size of data */
|
||||
uint32_t m_data_idx; /* current read/write position in data */
|
||||
uint32_t m_data_id; /* chrd_id for sector write */
|
||||
uint8_t m_index_pulse;
|
||||
uint8_t m_crc_wait;
|
||||
S_SRW_WAIT_READY,
|
||||
S_SRW_HEAD_SETTLING,
|
||||
S_SRW_START,
|
||||
|
||||
/* trigger delayed actions (bottom halves) */
|
||||
emu_timer* m_timer_cont;
|
||||
S_FFW_WAIT_READY,
|
||||
S_FFW_HEAD_SETTLING,
|
||||
S_FFW_START,
|
||||
|
||||
S_IDAM_BAD_TRACK,
|
||||
S_IDAM_BAD_CRC,
|
||||
S_IDAM_FOUND,
|
||||
S_IDAM_NOT_FOUND,
|
||||
|
||||
legacy_floppy_image_device* floppy_image();
|
||||
void status_update();
|
||||
void cmd_end();
|
||||
void finish_STZ();
|
||||
void finish_SEK();
|
||||
int address_search(chrn_id* id);
|
||||
int address_search_read(chrn_id* id);
|
||||
void finish_RCR();
|
||||
void cont_SR();
|
||||
void finish_SR();
|
||||
void cont_SW();
|
||||
S_DAM_NOT_FOUND,
|
||||
S_DAM_BAD_CRC,
|
||||
S_DAM_DONE,
|
||||
};
|
||||
|
||||
enum {
|
||||
L_IDLE,
|
||||
|
||||
L_IDAM_SEARCH,
|
||||
L_IDAM_CHECK_TRACK,
|
||||
L_IDAM_CHECK_SECTOR,
|
||||
L_IDAM_CHECK_CRC,
|
||||
|
||||
L_DAM_SEARCH,
|
||||
L_DAM_DELETED,
|
||||
L_DAM_READ,
|
||||
L_DAM_READ_BYTE,
|
||||
|
||||
L_DAM_WAIT,
|
||||
L_DAM_WRITE,
|
||||
L_DAM_WRITE_BYTE,
|
||||
|
||||
L_FFW_BYTE,
|
||||
L_FFW_WRITE,
|
||||
};
|
||||
|
||||
struct live_info {
|
||||
attotime tm;
|
||||
fdc_pll_t pll;
|
||||
int state, next_state;
|
||||
u16 shift_reg;
|
||||
u16 crc;
|
||||
int bit_counter;
|
||||
bool data_separator_phase, data_bit_context;
|
||||
uint8_t data_reg;
|
||||
};
|
||||
|
||||
devcb_write_line m_irq;
|
||||
bool m_force_ready;
|
||||
|
||||
emu_timer *m_timer;
|
||||
floppy_image_device *m_floppy;
|
||||
|
||||
live_info m_cur_live, m_checkpoint_live;
|
||||
|
||||
int m_state;
|
||||
|
||||
bool m_head_loaded, m_dir_loaded, m_dor_loaded, m_dor_needed;
|
||||
|
||||
u8 m_dir;
|
||||
u8 m_dor;
|
||||
u8 m_ctar;
|
||||
u8 m_cmr;
|
||||
u8 m_isr;
|
||||
u8 m_sur;
|
||||
u8 m_stra;
|
||||
u8 m_sar;
|
||||
u8 m_strb;
|
||||
u8 m_gcr;
|
||||
u8 m_ccr;
|
||||
u8 m_ltar;
|
||||
|
||||
u8 m_step_count;
|
||||
u8 m_idam_turns;
|
||||
|
||||
u8 dir_r();
|
||||
void dor_w(u8 data);
|
||||
u8 ctar_r();
|
||||
void ctar_w(u8 data);
|
||||
u8 isr_r();
|
||||
void cmr_w(u8 data);
|
||||
u8 stra_r();
|
||||
void sur_w(u8 data);
|
||||
u8 strb_r();
|
||||
void sar_w(u8 data);
|
||||
void gcr_w(u8 data);
|
||||
void ccr_w(u8 data);
|
||||
void ltar_w(u8 data);
|
||||
|
||||
void index_callback(floppy_image_device *floppy, int state);
|
||||
void ready_callback(floppy_image_device *floppy, int state);
|
||||
|
||||
void command_start();
|
||||
void run(bool timeout, bool ready, bool index);
|
||||
void isr_raise(u8 flag);
|
||||
void delay(int);
|
||||
void live_start(int state, bool start_writing = false);
|
||||
void checkpoint();
|
||||
void rollback();
|
||||
void live_delay(int state);
|
||||
void live_sync();
|
||||
void live_abort();
|
||||
bool read_one_bit(const attotime &limit);
|
||||
bool write_one_bit(const attotime &limit);
|
||||
void live_run(attotime limit = attotime::never);
|
||||
bool is_ready() const;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(MC6843, mc6843_device)
|
||||
|
@ -23,7 +23,7 @@
|
||||
#define LOG_LIVE (1U << 13) // Live states
|
||||
#define LOG_FUNC (1U << 14) // Function calls
|
||||
|
||||
#define VERBOSE (LOG_GENERAL)
|
||||
#define VERBOSE (LOG_DESC)
|
||||
//#define LOG_OUTPUT_STREAM std::cout
|
||||
|
||||
#include "logmacro.h"
|
||||
|
@ -589,6 +589,10 @@
|
||||
#include "thom_cas.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAS_FORMATS_THOM_DSK
|
||||
#include "thom_dsk.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAS_FORMATS_TI99_DSK
|
||||
#include "ti99_dsk.h"
|
||||
#endif
|
||||
@ -1202,6 +1206,10 @@ void mame_formats_full_list(mame_formats_enumerator &en)
|
||||
en.add(to7_cassette_formats); // thom_cas.h
|
||||
en.add(mo5_cassette_formats); // thom_cas.h
|
||||
#endif
|
||||
#ifdef HAS_FORMATS_THOM_DSK
|
||||
en.add(FLOPPY_THOMSON_525_FORMAT); // thom_dsk.h
|
||||
en.add(FLOPPY_THOMSON_35_FORMAT); // thom_dsk.h
|
||||
#endif
|
||||
|
||||
en.category("Texas Instruments");
|
||||
#ifdef HAS_FORMATS_TI99_DSK
|
||||
|
@ -1,444 +1,86 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Antoine Mine
|
||||
/*********************************************************************
|
||||
// copyright-holders:Olivier Galibert
|
||||
|
||||
formats/thom_dsk.c
|
||||
|
||||
Thomson disk images
|
||||
|
||||
Based on work of Antoine Mine'
|
||||
|
||||
*********************************************************************/
|
||||
|
||||
#include <cstring>
|
||||
#include <cassert>
|
||||
#include "thom_dsk.h"
|
||||
#include "basicdsk.h"
|
||||
|
||||
static const int sap_magic_num = 0xB3; /* simple XOR crypt */
|
||||
|
||||
|
||||
static const char sap_header[] =
|
||||
"\001SYSTEME D'ARCHIVAGE PUKALL S.A.P. "
|
||||
"(c) Alexandre PUKALL Avril 1998";
|
||||
|
||||
|
||||
static const uint16_t sap_crc[] =
|
||||
thomson_525_format::thomson_525_format() : wd177x_format(formats)
|
||||
{
|
||||
0x0000, 0x1081, 0x2102, 0x3183, 0x4204, 0x5285, 0x6306, 0x7387,
|
||||
0x8408, 0x9489, 0xa50a, 0xb58b, 0xc60c, 0xd68d, 0xe70e, 0xf78f,
|
||||
}
|
||||
|
||||
const char *thomson_525_format::name() const
|
||||
{
|
||||
return "thomson_525";
|
||||
}
|
||||
|
||||
const char *thomson_525_format::description() const
|
||||
{
|
||||
return "Thomson 5.25 disk image";
|
||||
}
|
||||
|
||||
const char *thomson_525_format::extensions() const
|
||||
{
|
||||
return "fd";
|
||||
}
|
||||
|
||||
const thomson_525_format::format thomson_525_format::formats[] = {
|
||||
{
|
||||
floppy_image::FF_525, floppy_image::SSSD, floppy_image::FM,
|
||||
4000,
|
||||
16, 40, 1,
|
||||
128, {},
|
||||
1, {},
|
||||
17, 22, 12
|
||||
},
|
||||
{
|
||||
floppy_image::FF_525, floppy_image::SSDD, floppy_image::MFM,
|
||||
2000,
|
||||
16, 40, 1,
|
||||
256, {},
|
||||
1, {},
|
||||
31, 22, 44
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
struct sap_dsk_tag
|
||||
|
||||
thomson_35_format::thomson_35_format() : wd177x_format(formats)
|
||||
{
|
||||
int tracks;
|
||||
int sector_size;
|
||||
int sector_pos[80][16]; /* remember sector position in file */
|
||||
}
|
||||
|
||||
const char *thomson_35_format::name() const
|
||||
{
|
||||
return "thomson_35";
|
||||
}
|
||||
|
||||
const char *thomson_35_format::description() const
|
||||
{
|
||||
return "Thomson 3.5 disk image";
|
||||
}
|
||||
|
||||
const char *thomson_35_format::extensions() const
|
||||
{
|
||||
return "fd";
|
||||
}
|
||||
|
||||
const thomson_35_format::format thomson_35_format::formats[] = {
|
||||
{
|
||||
floppy_image::FF_35, floppy_image::SSDD, floppy_image::MFM,
|
||||
2000,
|
||||
16, 80, 1,
|
||||
256, {},
|
||||
1, {},
|
||||
31, 22, 44
|
||||
},
|
||||
{
|
||||
floppy_image::FF_35, floppy_image::DSDD, floppy_image::MFM,
|
||||
2000,
|
||||
16, 80, 2,
|
||||
256, {},
|
||||
1, {},
|
||||
31, 22, 44
|
||||
},
|
||||
{}
|
||||
};
|
||||
|
||||
static uint16_t thom_sap_crc( uint8_t* data, int size )
|
||||
{
|
||||
int i;
|
||||
uint16_t crc = 0xffff, crc2;
|
||||
for ( i = 0; i < size; i++ )
|
||||
{
|
||||
crc2 = ( crc >> 4 ) ^ sap_crc[ ( crc ^ data[i] ) & 15 ];
|
||||
crc = ( crc2 >> 4 ) ^ sap_crc[ ( crc2 ^ (data[i] >> 4) ) & 15 ];
|
||||
}
|
||||
return crc;
|
||||
}
|
||||
|
||||
static struct sap_dsk_tag *get_tag(floppy_image_legacy *floppy)
|
||||
{
|
||||
struct sap_dsk_tag *tag;
|
||||
tag = (sap_dsk_tag *)floppy_tag(floppy);
|
||||
return tag;
|
||||
}
|
||||
|
||||
|
||||
static FLOPPY_IDENTIFY(sap_dsk_identify)
|
||||
{
|
||||
char header[0x100];
|
||||
floppy_image_read(floppy, header, 0, sizeof(sap_header));
|
||||
if (!memcmp( header, sap_header, sizeof(sap_header) ) )
|
||||
{
|
||||
*vote= 100;
|
||||
} else {
|
||||
*vote = 0;
|
||||
}
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
static int sap_get_heads_per_disk(floppy_image_legacy *floppy)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int sap_get_tracks_per_disk(floppy_image_legacy *floppy)
|
||||
{
|
||||
return get_tag(floppy)->tracks;
|
||||
}
|
||||
|
||||
|
||||
static floperr_t get_offset(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, uint64_t *offset)
|
||||
{
|
||||
uint64_t offs;
|
||||
struct sap_dsk_tag *tag = get_tag(floppy);
|
||||
/* translate the sector to a raw sector */
|
||||
if (!sector_is_index)
|
||||
{
|
||||
sector -= 1;
|
||||
}
|
||||
/* check to see if we are out of range */
|
||||
if ((head < 0) || (head >= 1) || (track < 0) || (track >=tag->tracks)
|
||||
|| (sector < 0) || (sector >= 16))
|
||||
return FLOPPY_ERROR_SEEKERROR;
|
||||
|
||||
offs = tag->sector_pos[track][sector];
|
||||
if (offs <= 0 )
|
||||
return FLOPPY_ERROR_SEEKERROR;
|
||||
|
||||
if (offset)
|
||||
*offset = offs;
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static floperr_t internal_sap_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, void *buffer, size_t buflen)
|
||||
{
|
||||
uint64_t offset;
|
||||
floperr_t err;
|
||||
int i;
|
||||
uint8_t *buf;
|
||||
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
floppy_image_read(floppy, buffer, offset+4, buflen);
|
||||
buf = (uint8_t*)buffer;
|
||||
for (i=0;i<buflen;i++) {
|
||||
buf[i] ^= sap_magic_num;
|
||||
}
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static floperr_t internal_sap_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, bool sector_is_index, const void *buffer, size_t buflen, int ddam)
|
||||
{
|
||||
uint64_t offset;
|
||||
floperr_t err;
|
||||
uint8_t buf[256+6];
|
||||
uint16_t crc;
|
||||
int i;
|
||||
err = get_offset(floppy, head, track, sector, sector_is_index, &offset);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* buf = 4-byte header + sector + 2-byte CRC */
|
||||
floppy_image_read(floppy, buf, offset, 4);
|
||||
for (i=0;i<buflen;i++) {
|
||||
buf[i+4] = ((uint8_t*)buffer)[i];
|
||||
}
|
||||
crc = thom_sap_crc( buf, buflen+4 );
|
||||
buf[buflen+4] = crc >> 8;
|
||||
buf[buflen+5] = crc & 0xff;
|
||||
for (i=0;i<buflen;i++) {
|
||||
buf[i+4] ^= sap_magic_num;
|
||||
}
|
||||
floppy_image_write(floppy, buf, offset, buflen+6);
|
||||
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static floperr_t sap_read_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
|
||||
{
|
||||
return internal_sap_read_sector(floppy, head, track, sector, false, buffer, buflen);
|
||||
}
|
||||
|
||||
static floperr_t sap_write_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
|
||||
{
|
||||
return internal_sap_write_sector(floppy, head, track, sector, false, buffer, buflen, ddam);
|
||||
}
|
||||
|
||||
static floperr_t sap_read_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, void *buffer, size_t buflen)
|
||||
{
|
||||
return internal_sap_read_sector(floppy, head, track, sector, true, buffer, buflen);
|
||||
}
|
||||
|
||||
static floperr_t sap_write_indexed_sector(floppy_image_legacy *floppy, int head, int track, int sector, const void *buffer, size_t buflen, int ddam)
|
||||
{
|
||||
return internal_sap_write_sector(floppy, head, track, sector, true, buffer, buflen, ddam);
|
||||
}
|
||||
|
||||
static floperr_t sap_get_sector_length(floppy_image_legacy *floppy, int head, int track, int sector, uint32_t *sector_length)
|
||||
{
|
||||
floperr_t err;
|
||||
err = get_offset(floppy, head, track, sector, false, nullptr);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (sector_length) {
|
||||
*sector_length = get_tag(floppy)->sector_size;
|
||||
}
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static floperr_t sap_get_indexed_sector_info(floppy_image_legacy *floppy, int head, int track, int sector_index, int *cylinder, int *side, int *sector, uint32_t *sector_length, unsigned long *flags)
|
||||
{
|
||||
floperr_t err;
|
||||
uint8_t header[4];
|
||||
uint64_t offset = 0;
|
||||
sector_index += 1;
|
||||
err = get_offset(floppy, head, track, sector_index, false, &offset);
|
||||
|
||||
floppy_image_read(floppy, header, offset, 4);
|
||||
if (cylinder)
|
||||
*cylinder = header[2];
|
||||
if (side)
|
||||
*side = head;
|
||||
if (sector)
|
||||
*sector = header[3];
|
||||
if (sector_length)
|
||||
*sector_length = get_tag(floppy)->sector_size;
|
||||
if (flags)
|
||||
/* TODO: read DAM or DDAM and determine flags */
|
||||
*flags = 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static floperr_t sap_post_format(floppy_image_legacy *floppy, util::option_resolution *params)
|
||||
{
|
||||
int track,sector;
|
||||
int pos;
|
||||
uint8_t buf[256], header[4];
|
||||
struct sap_dsk_tag *tag;
|
||||
tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag));
|
||||
|
||||
/* default options */
|
||||
if ( !tag->tracks )
|
||||
{
|
||||
tag->tracks = 80;
|
||||
tag->sector_size = 256;
|
||||
}
|
||||
|
||||
/* create SAP file header */
|
||||
floppy_image_write( floppy, sap_header, 0, 66 );
|
||||
|
||||
for ( track = 0; track < 80; track++ )
|
||||
for ( sector = 0; sector < 16; sector++ )
|
||||
tag->sector_pos[track][sector] = 0;
|
||||
|
||||
/* create all sectors with valid header and CRC */
|
||||
memset(buf, 0xe5, 256);
|
||||
pos = 0x42;
|
||||
header[0] = (tag->sector_size==128) ? 1 : 0;
|
||||
header[1] = 0;
|
||||
for ( track = 0, pos = 0x42; track < tag->tracks; track++ )
|
||||
for ( sector = 0; sector < 16; sector++, pos += tag->sector_size + 6 ) {
|
||||
tag->sector_pos[track][sector] = pos;
|
||||
header[2] = track;
|
||||
header[3] = sector + 1;
|
||||
floppy_image_write(floppy, header, pos, 4);
|
||||
sap_write_indexed_sector( floppy, 0, track, sector, buf, tag->sector_size, 0 );
|
||||
}
|
||||
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static FLOPPY_CONSTRUCT(sap_dsk_construct)
|
||||
{
|
||||
struct FloppyCallbacks *callbacks;
|
||||
struct sap_dsk_tag *tag;
|
||||
int j;
|
||||
uint8_t fmt;
|
||||
tag = (struct sap_dsk_tag *) floppy_create_tag(floppy, sizeof(struct sap_dsk_tag));
|
||||
if (!tag)
|
||||
return FLOPPY_ERROR_OUTOFMEMORY;
|
||||
|
||||
/* guess format */
|
||||
floppy_image_read(floppy, &fmt, 0x42, 1);
|
||||
if ( fmt==1 ) tag->sector_size = 128; else tag->sector_size = 256;
|
||||
|
||||
/* start with an empty offset table */
|
||||
tag->tracks = 0;
|
||||
for ( int i = 0; i < 80; i++ )
|
||||
for ( j = 0; j < 16; j++ )
|
||||
tag->sector_pos[i][j] = 0;
|
||||
|
||||
/* count tracks & fill sector offset table */
|
||||
for ( uint64_t i = 0x42; i+4 < floppy_image_size(floppy); i += tag->sector_size + 6 ) // CRC 2 bytes + 4 bytes sector header
|
||||
{
|
||||
uint8_t sector, track;
|
||||
floppy_image_read(floppy, &track, i+2, 1);
|
||||
floppy_image_read(floppy, §or, i+3, 1);
|
||||
if ( track >= 80 || sector < 1 || sector > 16 ) continue;
|
||||
if ( track > tag->tracks ) tag->tracks = track+1;
|
||||
tag->sector_pos[track][sector-1] = i;
|
||||
}
|
||||
callbacks = floppy_callbacks(floppy);
|
||||
callbacks->read_sector = sap_read_sector;
|
||||
callbacks->write_sector = sap_write_sector;
|
||||
callbacks->read_indexed_sector = sap_read_indexed_sector;
|
||||
callbacks->write_indexed_sector = sap_write_indexed_sector;
|
||||
callbacks->get_sector_length = sap_get_sector_length;
|
||||
callbacks->get_heads_per_disk = sap_get_heads_per_disk;
|
||||
callbacks->get_tracks_per_disk = sap_get_tracks_per_disk;
|
||||
callbacks->get_indexed_sector_info = sap_get_indexed_sector_info;
|
||||
callbacks->post_format = sap_post_format;
|
||||
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static FLOPPY_IDENTIFY(qdd_dsk_identify)
|
||||
{
|
||||
*vote = (floppy_image_size(floppy) == (51200)) ? 100 : 0;
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* fixed interlacing map for QDDs */
|
||||
static int thom_qdd_map[400];
|
||||
|
||||
static int qdd_translate_sector(floppy_image_legacy *floppy, int sector)
|
||||
{
|
||||
return thom_qdd_map[sector-1];
|
||||
}
|
||||
|
||||
static void thom_qdd_compute_map ( void )
|
||||
{
|
||||
/* this map is hardcoded in the QDD BIOS */
|
||||
static const int p[6][4] =
|
||||
{
|
||||
{ 20, 2, 14, 8 }, { 21, 19, 13, 7 },
|
||||
{ 22, 18, 12, 6 }, { 23, 17, 11, 5 },
|
||||
{ 24, 16, 10, 4 }, { 1, 15, 9, 3 }
|
||||
};
|
||||
static const int q[4] = { 0, 8, 4, 12 };
|
||||
int t, s;
|
||||
for ( t = 0; t < 24; t++ )
|
||||
{
|
||||
for ( s = 0; s < 16; s++ )
|
||||
{
|
||||
thom_qdd_map[ t*16 + s ] = p[ t/4 ][ s%4 ] * 16 + (s/4) + 4*(t%4);
|
||||
}
|
||||
}
|
||||
for ( s = 0; s < 16; s++ )
|
||||
{
|
||||
thom_qdd_map[ 24*16 + s ] = q[ s%4 ] + (s/4);
|
||||
}
|
||||
}
|
||||
|
||||
static FLOPPY_CONSTRUCT(qdd_dsk_construct)
|
||||
{
|
||||
struct basicdsk_geometry geometry;
|
||||
|
||||
thom_qdd_compute_map();
|
||||
|
||||
memset(&geometry, 0, sizeof(geometry));
|
||||
geometry.heads = 1;
|
||||
geometry.first_sector_id = 1;
|
||||
geometry.sector_length = 128;
|
||||
geometry.tracks = 1;
|
||||
geometry.sectors = 400;
|
||||
geometry.translate_sector = qdd_translate_sector;
|
||||
return basicdsk_construct(floppy, &geometry);
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
static floperr_t fd_identify(floppy_image_legacy *floppy, int *vote, int tracks, int sector_size)
|
||||
{
|
||||
uint64_t expected_size;
|
||||
expected_size = sector_size;
|
||||
expected_size *= tracks;
|
||||
expected_size *= 16; /* secetors */
|
||||
*vote = (floppy_image_size(floppy) == expected_size) ? 100 : 50;
|
||||
return FLOPPY_ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
static floperr_t fd_construct(floppy_image_legacy *floppy, int tracks, int sector_size)
|
||||
{
|
||||
struct basicdsk_geometry geometry;
|
||||
memset(&geometry, 0, sizeof(geometry));
|
||||
geometry.heads = 1;
|
||||
geometry.first_sector_id = 1;
|
||||
geometry.sector_length = sector_size;
|
||||
geometry.tracks = tracks;
|
||||
geometry.sectors = 16;
|
||||
return basicdsk_construct(floppy, &geometry);
|
||||
}
|
||||
|
||||
|
||||
static FLOPPY_IDENTIFY(fd_80_256_identify)
|
||||
{
|
||||
return fd_identify(floppy, vote, 80, 256);
|
||||
}
|
||||
|
||||
static FLOPPY_CONSTRUCT(fd_80_256_construct)
|
||||
{
|
||||
return fd_construct(floppy, 80, 256);
|
||||
}
|
||||
|
||||
static FLOPPY_IDENTIFY(fd_40_256_identify)
|
||||
{
|
||||
return fd_identify(floppy, vote, 40, 256);
|
||||
}
|
||||
|
||||
static FLOPPY_CONSTRUCT(fd_40_256_construct)
|
||||
{
|
||||
return fd_construct(floppy, 40, 256);
|
||||
}
|
||||
|
||||
static FLOPPY_IDENTIFY(fd_80_128_identify)
|
||||
{
|
||||
return fd_identify(floppy, vote, 80, 128);
|
||||
}
|
||||
|
||||
static FLOPPY_CONSTRUCT(fd_80_128_construct)
|
||||
{
|
||||
return fd_construct(floppy, 80, 128);
|
||||
}
|
||||
|
||||
static FLOPPY_IDENTIFY(fd_40_128_identify)
|
||||
{
|
||||
return fd_identify(floppy, vote, 40, 128);
|
||||
}
|
||||
|
||||
static FLOPPY_CONSTRUCT(fd_40_128_construct)
|
||||
{
|
||||
return fd_construct(floppy, 40, 128);
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
LEGACY_FLOPPY_OPTIONS_START(thomson)
|
||||
|
||||
LEGACY_FLOPPY_OPTION(fdmfm2, "fd", "Thomson FD (MFM) 80 tracks disk image (3\"1/2 DD)",
|
||||
fd_80_256_identify, fd_80_256_construct, nullptr, nullptr)
|
||||
|
||||
// Note: no way to distinguish between FD files for 5"1/4 DD and 3"1/2 SD actually, as they have the same size
|
||||
// however, we expect 3"1/2 SD to be rather rare, so, we simply put it after 5"1/4 DD
|
||||
|
||||
LEGACY_FLOPPY_OPTION(fdmfm, "fd", "Thomson FD (MFM) 40 tracks disk image (5\"1/4 DD)",
|
||||
fd_40_256_identify, fd_40_256_construct, nullptr, nullptr)
|
||||
|
||||
LEGACY_FLOPPY_OPTION(fd2, "fd", "Thomson FD (FM) 80 tracks disk image (3\"1/2 SD)",
|
||||
fd_80_128_identify, fd_80_128_construct, nullptr, nullptr)
|
||||
|
||||
LEGACY_FLOPPY_OPTION(fd, "fd", "Thomson FD (FM) 40 tracks disk image (5\"1/4 SD)",
|
||||
fd_40_128_identify, fd_40_128_construct, nullptr, nullptr)
|
||||
|
||||
LEGACY_FLOPPY_OPTION(sap,"sap", "Thomson SAP floppy disk image",
|
||||
sap_dsk_identify, sap_dsk_construct, nullptr, nullptr)
|
||||
|
||||
LEGACY_FLOPPY_OPTION(qdd,"qd", "Thomson QDD floppy disk image (2\"8 SD)",
|
||||
qdd_dsk_identify, qdd_dsk_construct, nullptr, nullptr)
|
||||
|
||||
LEGACY_FLOPPY_OPTIONS_END
|
||||
const floppy_format_type FLOPPY_THOMSON_525_FORMAT = &floppy_image_format_creator<thomson_525_format>;
|
||||
const floppy_format_type FLOPPY_THOMSON_35_FORMAT = &floppy_image_format_creator<thomson_35_format>;
|
||||
|
@ -1,18 +1,40 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Miodrag Milanovic
|
||||
// copyright-holders:Olivier Galibert
|
||||
#ifndef MAME_FORMATS_THOM_DSK_H
|
||||
#define MAME_FORMATS_THOM_DSK_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "flopimg.h"
|
||||
#include "wd177x_dsk.h"
|
||||
|
||||
/* recognized image formats:
|
||||
- .fd one-side 5"1/4 (single and double density), 3"1/2
|
||||
- .qd one-side QDD
|
||||
- .sap one-side double-density 5"1/4, 3"1/2
|
||||
*/
|
||||
class thomson_525_format : public wd177x_format
|
||||
{
|
||||
public:
|
||||
thomson_525_format();
|
||||
|
||||
LEGACY_FLOPPY_OPTIONS_EXTERN(thomson);
|
||||
virtual const char *name() const override;
|
||||
virtual const char *description() const override;
|
||||
virtual const char *extensions() const override;
|
||||
|
||||
private:
|
||||
static const format formats[];
|
||||
};
|
||||
|
||||
class thomson_35_format : public wd177x_format
|
||||
{
|
||||
public:
|
||||
thomson_35_format();
|
||||
|
||||
virtual const char *name() const override;
|
||||
virtual const char *description() const override;
|
||||
virtual const char *extensions() const override;
|
||||
|
||||
private:
|
||||
static const format formats[];
|
||||
};
|
||||
|
||||
|
||||
extern const floppy_format_type FLOPPY_THOMSON_525_FORMAT;
|
||||
extern const floppy_format_type FLOPPY_THOMSON_35_FORMAT;
|
||||
|
||||
#endif // MAME_FORMATS_THOM_DSK_H
|
||||
|
@ -438,7 +438,7 @@ void wd177x_format::check_compatibility(floppy_image *image, std::vector<int> &c
|
||||
break;
|
||||
}
|
||||
int ns = 0;
|
||||
for(int j = 0; j < 256 && j < sectors.size(); j++)
|
||||
for(int j=0; j<int(sectors.size()); j++)
|
||||
if(!sectors[j].empty()) {
|
||||
int sid;
|
||||
if(tf.sector_base_id == -1) {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -17,20 +17,18 @@
|
||||
#include "formats/thom_cas.h"
|
||||
#include "formats/thom_dsk.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "machine/6821pia.h"
|
||||
#include "machine/6850acia.h"
|
||||
#include "machine/input_merger.h"
|
||||
#include "machine/mc6843.h"
|
||||
#include "machine/mc6846.h"
|
||||
#include "machine/mc6846.h"
|
||||
#include "machine/mc6854.h"
|
||||
#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"
|
||||
#include "bus/thomson/extension.h"
|
||||
#include "bus/thomson/nanoreseau.h"
|
||||
|
||||
#include "bus/centronics/ctronics.h"
|
||||
#include "bus/generic/slot.h"
|
||||
@ -55,7 +53,6 @@
|
||||
/* bank-switching */
|
||||
#define THOM_CART_BANK "bank2" /* cartridge ROM */
|
||||
#define THOM_RAM_BANK "bank3" /* data RAM */
|
||||
#define THOM_FLOP_BANK "bank4" /* external floppy controller ROM */
|
||||
#define THOM_BASE_BANK "bank5" /* system RAM */
|
||||
|
||||
/* bank-switching */
|
||||
@ -104,7 +101,6 @@ class thomson_state : public driver_device
|
||||
public:
|
||||
thomson_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
driver_device(mconfig, type, tag),
|
||||
m_mc6854(*this, "mc6854"),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_cassette(*this, "cassette"),
|
||||
m_dac(*this, "dac"),
|
||||
@ -117,10 +113,10 @@ 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"),
|
||||
m_extension(*this, "extension"),
|
||||
m_io_game_port_directions(*this, "game_port_directions"),
|
||||
m_io_game_port_buttons(*this, "game_port_buttons"),
|
||||
m_io_mouse_x(*this, "mouse_x"),
|
||||
@ -132,54 +128,30 @@ public:
|
||||
m_io_config(*this, "config"),
|
||||
m_io_vconfig(*this, "vconfig"),
|
||||
m_io_mconfig(*this, "mconfig"),
|
||||
m_io_fconfig(*this, "fconfig"),
|
||||
m_io_keyboard(*this, "keyboard.%u", 0),
|
||||
m_vrambank(*this, THOM_VRAM_BANK),
|
||||
m_cartbank(*this, THOM_CART_BANK),
|
||||
m_rambank(*this, THOM_RAM_BANK),
|
||||
m_flopbank(*this, THOM_FLOP_BANK),
|
||||
m_basebank(*this, THOM_BASE_BANK),
|
||||
m_syslobank(*this, TO8_SYS_LO),
|
||||
m_syshibank(*this, TO8_SYS_HI),
|
||||
m_datalobank(*this, TO8_DATA_LO),
|
||||
m_datahibank(*this, TO8_DATA_HI),
|
||||
m_biosbank(*this, TO8_BIOS_BANK),
|
||||
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),
|
||||
m_caps_led(*this, "led0")
|
||||
{
|
||||
}
|
||||
|
||||
void to9(machine_config &config);
|
||||
void to7_base(machine_config &config);
|
||||
void to7_base(machine_config &config, bool is_mo);
|
||||
void to7(machine_config &config);
|
||||
void mo5e(machine_config &config);
|
||||
void to770a(machine_config &config);
|
||||
void t9000(machine_config &config);
|
||||
void to8(machine_config &config);
|
||||
void pro128(machine_config &config);
|
||||
void mo6(machine_config &config);
|
||||
void mo5(machine_config &config);
|
||||
void to9p(machine_config &config);
|
||||
void mo5nr(machine_config &config);
|
||||
void to770(machine_config &config);
|
||||
void to8d(machine_config &config);
|
||||
|
||||
void to770_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mo5_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mo5alt_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void to9_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap4_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap4alt_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap4althalf_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap16_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mode80_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mode80_to9_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void page1_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void page2_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void overlay_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
@ -189,31 +161,31 @@ public:
|
||||
void to770_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mo5_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mo5alt_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void to9_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap4_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap4alt_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap4althalf_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap16_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mode80_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mode80_to9_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void page1_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void page2_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void overlay_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void overlayhalf_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void overlay3_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void bitmap16alt_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void to9_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mode80_to9_scandraw_16( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void to9_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
void mode80_to9_scandraw_8( uint8_t* vram, uint16_t* dst, uint16_t* pal, int org, int len );
|
||||
|
||||
protected:
|
||||
emu_timer* m_mo5_periodic_timer;
|
||||
uint8_t m_mo5_reg_cart; /* 0xa7cb bank switch */
|
||||
|
||||
virtual void video_start() override;
|
||||
|
||||
private:
|
||||
static void cd90_640_formats(format_registration &fr);
|
||||
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( to7_cartridge );
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mo5_cartridge );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( to7_set_cassette_motor );
|
||||
DECLARE_WRITE_LINE_MEMBER( mo5_set_cassette_motor );
|
||||
DECLARE_WRITE_LINE_MEMBER( thom_dev_irq_0 );
|
||||
void to7_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t to7_cartridge_r(offs_t offset);
|
||||
@ -249,102 +221,12 @@ private:
|
||||
DECLARE_MACHINE_RESET( to770 );
|
||||
DECLARE_MACHINE_START( to770 );
|
||||
void to7_lightpen_cb( int step );
|
||||
void mo5_lightpen_cb( int step );
|
||||
TIMER_CALLBACK_MEMBER( mo5_periodic_cb );
|
||||
void mo5_sys_porta_out(uint8_t data);
|
||||
uint8_t mo5_sys_porta_in();
|
||||
uint8_t mo5_sys_portb_in();
|
||||
uint8_t mo5_gatearray_r(offs_t offset);
|
||||
void mo5_gatearray_w(offs_t offset, uint8_t data);
|
||||
void mo5_update_cart_bank_postload();
|
||||
void mo5_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo5_cartridge_r(offs_t offset);
|
||||
void mo5_ext_w(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( mo5 );
|
||||
DECLARE_MACHINE_START( mo5 );
|
||||
void to9_ieee_w(offs_t offset, uint8_t data);
|
||||
uint8_t to9_ieee_r(offs_t offset);
|
||||
uint8_t to9_gatearray_r(offs_t offset);
|
||||
void to9_gatearray_w(offs_t offset, uint8_t data);
|
||||
uint8_t to9_vreg_r(offs_t offset);
|
||||
void to9_vreg_w(offs_t offset, uint8_t data);
|
||||
void to9_update_cart_bank_postload();
|
||||
void to9_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t to9_cartridge_r(offs_t offset);
|
||||
void to9_update_ram_bank_postload();
|
||||
uint8_t to9_kbd_r(offs_t offset);
|
||||
void to9_kbd_w(offs_t offset, uint8_t data);
|
||||
TIMER_CALLBACK_MEMBER( to9_kbd_timer_cb );
|
||||
uint8_t to9_sys_porta_in();
|
||||
void to9_sys_porta_out(uint8_t data);
|
||||
void to9_sys_portb_out(uint8_t data);
|
||||
void to9_timer_port_out(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( to9 );
|
||||
DECLARE_MACHINE_START( to9 );
|
||||
TIMER_CALLBACK_MEMBER( to8_kbd_timer_cb );
|
||||
void to8_update_floppy_bank_postload();
|
||||
void to8_update_ram_bank_postload();
|
||||
void to8_update_cart_bank_postload();
|
||||
void to8_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_cartridge_r(offs_t offset);
|
||||
uint8_t to8_floppy_r(offs_t offset);
|
||||
void to8_floppy_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_gatearray_r(offs_t offset);
|
||||
void to8_gatearray_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_vreg_r(offs_t offset);
|
||||
void to8_vreg_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_sys_porta_in();
|
||||
void to8_sys_portb_out(uint8_t data);
|
||||
uint8_t to8_timer_port_in();
|
||||
void to8_timer_port_out(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( to8_timer_cp2_out );
|
||||
void to8_lightpen_cb( int step );
|
||||
DECLARE_MACHINE_RESET( to8 );
|
||||
DECLARE_MACHINE_START( to8 );
|
||||
uint8_t to9p_timer_port_in();
|
||||
void to9p_timer_port_out(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( to9p );
|
||||
DECLARE_MACHINE_START( to9p );
|
||||
void mo6_update_ram_bank_postload();
|
||||
void mo6_update_cart_bank_postload();
|
||||
void mo6_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo6_cartridge_r(offs_t offset);
|
||||
void mo6_ext_w(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( mo6_centronics_busy );
|
||||
void mo6_game_porta_out(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( mo6_game_cb2_out );
|
||||
TIMER_CALLBACK_MEMBER( mo6_game_update_cb );
|
||||
uint8_t mo6_sys_porta_in();
|
||||
uint8_t mo6_sys_portb_in();
|
||||
void mo6_sys_porta_out(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( mo6_sys_cb2_out );
|
||||
uint8_t mo6_gatearray_r(offs_t offset);
|
||||
void mo6_gatearray_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo6_vreg_r(offs_t offset);
|
||||
void mo6_vreg_w(offs_t offset, uint8_t data);
|
||||
DECLARE_MACHINE_RESET( mo6 );
|
||||
DECLARE_MACHINE_START( mo6 );
|
||||
uint8_t mo5nr_net_r(offs_t offset);
|
||||
void mo5nr_net_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo5nr_prn_r();
|
||||
void mo5nr_prn_w(uint8_t data);
|
||||
uint8_t mo5nr_sys_portb_in();
|
||||
void mo5nr_sys_porta_out(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( mo5nr );
|
||||
DECLARE_MACHINE_START( mo5nr );
|
||||
|
||||
TIMER_CALLBACK_MEMBER( thom_lightpen_step );
|
||||
TIMER_CALLBACK_MEMBER( thom_scanline_start );
|
||||
uint32_t screen_update_thom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
void to7_vram_w(offs_t offset, uint8_t data);
|
||||
void to770_vram_w(offs_t offset, uint8_t data);
|
||||
void to8_sys_lo_w(offs_t offset, uint8_t data);
|
||||
void to8_sys_hi_w(offs_t offset, uint8_t data);
|
||||
void to8_data_lo_w(offs_t offset, uint8_t data);
|
||||
void to8_data_hi_w(offs_t offset, uint8_t data);
|
||||
void to8_vcart_w(offs_t offset, uint8_t data);
|
||||
void mo6_vcart_lo_w(offs_t offset, uint8_t data);
|
||||
void mo6_vcart_hi_w(offs_t offset, uint8_t data);
|
||||
TIMER_CALLBACK_MEMBER( thom_set_init );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(thom_vblank);
|
||||
@ -357,37 +239,13 @@ private:
|
||||
TIMER_CALLBACK_MEMBER( ans3 );
|
||||
TIMER_CALLBACK_MEMBER( ans2 );
|
||||
TIMER_CALLBACK_MEMBER( ans );
|
||||
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);
|
||||
WRITE_LINE_MEMBER( fdc_index_3_w);
|
||||
void thomson_index_callback(int index, int state);
|
||||
void thom_palette(palette_device &palette);
|
||||
void mo5_palette(palette_device &palette);
|
||||
|
||||
optional_device<mc6854_device> m_mc6854;
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
|
||||
|
||||
int m_centronics_busy;
|
||||
int m_centronics_perror;
|
||||
|
||||
void to7_network_got_frame(uint8_t *data, int length);
|
||||
|
||||
void mo5_map(address_map &map);
|
||||
void mo5nr_map(address_map &map);
|
||||
void mo6_map(address_map &map);
|
||||
void to7_map(address_map &map);
|
||||
void to770_map(address_map &map);
|
||||
void to8_map(address_map &map);
|
||||
void to9_map(address_map &map);
|
||||
void to9p_map(address_map &map);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
@ -401,10 +259,10 @@ private:
|
||||
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;
|
||||
required_device<thomson_extension_device> m_extension;
|
||||
required_ioport m_io_game_port_directions;
|
||||
required_ioport m_io_game_port_buttons;
|
||||
required_ioport m_io_mouse_x;
|
||||
@ -416,34 +274,19 @@ private:
|
||||
required_ioport m_io_config;
|
||||
required_ioport m_io_vconfig;
|
||||
optional_ioport m_io_mconfig;
|
||||
required_ioport m_io_fconfig;
|
||||
required_ioport_array<10> m_io_keyboard;
|
||||
required_memory_bank m_vrambank;
|
||||
optional_memory_bank m_cartbank;
|
||||
optional_memory_bank m_rambank;
|
||||
required_memory_bank m_flopbank;
|
||||
required_memory_bank m_basebank;
|
||||
required_memory_bank m_syslobank;
|
||||
optional_memory_bank m_syshibank;
|
||||
optional_memory_bank m_datalobank;
|
||||
optional_memory_bank m_datahibank;
|
||||
optional_memory_bank m_biosbank;
|
||||
optional_memory_bank m_cartlobank;
|
||||
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;
|
||||
|
||||
output_finder<> m_caps_led;
|
||||
|
||||
/* bank logging and optimisations */
|
||||
int m_old_cart_bank;
|
||||
int m_old_cart_bank_was_read_only;
|
||||
int m_old_ram_bank;
|
||||
int m_old_floppy_bank;
|
||||
/* buffer storing demodulated bits, only for k7 and with speed hack */
|
||||
uint32_t m_to7_k7_bitsize;
|
||||
uint8_t* m_to7_k7_bits;
|
||||
@ -457,43 +300,6 @@ private:
|
||||
emu_timer* m_to7_game_timer;
|
||||
uint8_t m_to7_game_sound;
|
||||
uint8_t m_to7_game_mute;
|
||||
emu_timer* m_mo5_periodic_timer;
|
||||
uint8_t m_mo5_reg_cart; /* 0xa7cb bank switch */
|
||||
uint8_t m_to9_palette_data[32];
|
||||
uint8_t m_to9_palette_idx;
|
||||
uint8_t m_to9_soft_bank;
|
||||
uint8_t m_to9_kbd_parity; /* 0=even, 1=odd, 2=no parity */
|
||||
uint8_t m_to9_kbd_intr; /* interrupt mode */
|
||||
uint8_t m_to9_kbd_in; /* data from keyboard */
|
||||
uint8_t m_to9_kbd_status; /* status */
|
||||
uint8_t m_to9_kbd_overrun; /* character lost */
|
||||
uint8_t m_to9_kbd_periph; /* peripheral mode */
|
||||
uint8_t m_to9_kbd_byte_count; /* byte-count in peripheral mode */
|
||||
uint16_t m_to9_mouse_x;
|
||||
uint16_t m_to9_mouse_y;
|
||||
uint8_t m_to9_kbd_last_key; /* for key repetition */
|
||||
uint16_t m_to9_kbd_key_count;
|
||||
uint8_t m_to9_kbd_caps; /* caps-lock */
|
||||
uint8_t m_to9_kbd_pad; /* keypad outputs special codes */
|
||||
emu_timer* m_to9_kbd_timer;
|
||||
uint8_t m_to8_kbd_ack; /* 1 = cpu inits / accepts transfers */
|
||||
uint16_t m_to8_kbd_data; /* data to transmit */
|
||||
uint16_t m_to8_kbd_step; /* transmission automaton state */
|
||||
uint8_t m_to8_kbd_last_key; /* last key (for repetition) */
|
||||
uint32_t m_to8_kbd_key_count; /* keypress time (for repetition) */
|
||||
uint8_t m_to8_kbd_caps; /* caps lock */
|
||||
emu_timer* m_to8_kbd_timer; /* bit-send */
|
||||
emu_timer* m_to8_kbd_signal; /* signal from CPU */
|
||||
uint8_t m_to8_data_vpage;
|
||||
uint8_t m_to8_cart_vpage;
|
||||
uint8_t m_to8_reg_ram;
|
||||
uint8_t m_to8_reg_cart;
|
||||
uint8_t m_to8_reg_sys1;
|
||||
uint8_t m_to8_reg_sys2;
|
||||
uint8_t m_to8_lightpen_intr;
|
||||
uint8_t m_to8_soft_select;
|
||||
uint8_t m_to8_soft_bank;
|
||||
uint8_t m_to8_bios_bank;
|
||||
|
||||
/* We allow choosing dynamically:
|
||||
- the border size
|
||||
@ -516,7 +322,7 @@ private:
|
||||
/* called thom_lightpen_nb times */
|
||||
emu_timer *m_thom_lightpen_timer;
|
||||
/* lightpen callback function to call from timer */
|
||||
void (thomson_state::*m_thom_lightpen_cb)(int step);
|
||||
std::function<void (int)> m_thom_lightpen_cb;
|
||||
uint8_t* m_thom_vram; /* pointer to video memory */
|
||||
emu_timer* m_thom_scanline_timer; /* scan-line update */
|
||||
uint16_t m_thom_last_pal[16]; /* palette at last scanline start */
|
||||
@ -546,19 +352,10 @@ private:
|
||||
bool m_thom_vstate_dirty;
|
||||
bool m_thom_vstate_last_dirty;
|
||||
uint32_t m_thom_mode_point;
|
||||
uint32_t m_thom_floppy_wcount;
|
||||
uint32_t m_thom_floppy_rcount;
|
||||
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 );
|
||||
void thom_irq_reset();
|
||||
void to7_update_cart_bank();
|
||||
void to7_set_init( int init );
|
||||
@ -571,35 +368,11 @@ private:
|
||||
void to7_midi_reset();
|
||||
void to7_midi_init();
|
||||
void to770_update_ram_bank();
|
||||
|
||||
TIMER_CALLBACK_MEMBER( mo5_periodic_cb );
|
||||
int mo5_get_cassette();
|
||||
void mo5_set_cassette( int data );
|
||||
void mo5_init_timer();
|
||||
void mo5_update_cart_bank();
|
||||
void to9_set_video_mode( uint8_t data, int style );
|
||||
void to9_palette_init();
|
||||
void to9_update_cart_bank();
|
||||
void to9_update_ram_bank();
|
||||
int to9_kbd_ktest();
|
||||
void to9_kbd_update_irq();
|
||||
void to9_kbd_send( uint8_t data, int parity );
|
||||
int to9_kbd_get_key();
|
||||
void to9_kbd_reset();
|
||||
void to9_kbd_init();
|
||||
int to8_kbd_ktest();
|
||||
int to8_kbd_get_key();
|
||||
void to8_kbd_timer_func();
|
||||
void to8_kbd_set_ack( int data );
|
||||
void to8_kbd_reset();
|
||||
void to8_kbd_init();
|
||||
void to8_update_floppy_bank();
|
||||
void to8_update_ram_bank();
|
||||
void to8_update_cart_bank();
|
||||
void to8_floppy_init();
|
||||
void to8_floppy_reset();
|
||||
void mo6_update_ram_bank();
|
||||
void mo6_update_cart_bank();
|
||||
void mo6_game_init();
|
||||
void mo6_game_reset();
|
||||
void mo5nr_game_init();
|
||||
void mo5nr_game_reset();
|
||||
|
||||
bool update_screen_size();
|
||||
unsigned thom_video_elapsed();
|
||||
@ -615,21 +388,262 @@ private:
|
||||
void thom_set_video_mode( unsigned mode );
|
||||
void thom_set_video_page( unsigned page );
|
||||
void thom_set_mode_point( int point );
|
||||
void thom_floppy_active( int write );
|
||||
unsigned to7_lightpen_gpl( int decx, int decy );
|
||||
void thom_configure_palette( double gamma, const uint16_t* pal, palette_device& palette );
|
||||
|
||||
void to7_5p14_reset();
|
||||
void to7_5p14_init();
|
||||
void to7_5p14_index_pulse_callback( int state );
|
||||
void to7_5p14sd_reset();
|
||||
void to7_5p14sd_init();
|
||||
void to7_network_init();
|
||||
void to7_network_reset();
|
||||
void to7_floppy_init();
|
||||
void to7_floppy_reset();
|
||||
void to9_floppy_init(void* int_base);
|
||||
void to9_floppy_reset();
|
||||
DECLARE_WRITE_LINE_MEMBER( mo5_set_cassette_motor );
|
||||
DECLARE_DEVICE_IMAGE_LOAD_MEMBER( mo5_cartridge );
|
||||
};
|
||||
|
||||
class mo5_state : public thomson_state
|
||||
{
|
||||
public:
|
||||
mo5_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
thomson_state(mconfig, type, tag)
|
||||
{
|
||||
}
|
||||
|
||||
void mo5(machine_config &config);
|
||||
void mo5e(machine_config &config);
|
||||
|
||||
protected:
|
||||
void mo5_lightpen_cb( int step );
|
||||
void mo5_sys_porta_out(uint8_t data);
|
||||
uint8_t mo5_sys_porta_in();
|
||||
uint8_t mo5_sys_portb_in();
|
||||
uint8_t mo5_gatearray_r(offs_t offset);
|
||||
void mo5_gatearray_w(offs_t offset, uint8_t data);
|
||||
void mo5_update_cart_bank_postload();
|
||||
void mo5_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo5_cartridge_r(offs_t offset);
|
||||
void mo5_ext_w(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( mo5 );
|
||||
DECLARE_MACHINE_START( mo5 );
|
||||
|
||||
void mo5_palette(palette_device &palette);
|
||||
|
||||
void mo5_map(address_map &map);
|
||||
|
||||
void mo5_update_cart_bank();
|
||||
};
|
||||
|
||||
class to9_state : public thomson_state
|
||||
{
|
||||
public:
|
||||
to9_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
thomson_state(mconfig, type, tag),
|
||||
m_syslobank(*this, TO8_SYS_LO),
|
||||
m_syshibank(*this, TO8_SYS_HI),
|
||||
m_datalobank(*this, TO8_DATA_LO),
|
||||
m_datahibank(*this, TO8_DATA_HI),
|
||||
m_biosbank(*this, TO8_BIOS_BANK)
|
||||
{
|
||||
}
|
||||
|
||||
void to8(machine_config &config);
|
||||
void to8d(machine_config &config);
|
||||
void to9(machine_config &config);
|
||||
void to9p(machine_config &config);
|
||||
|
||||
protected:
|
||||
required_memory_bank m_syslobank;
|
||||
optional_memory_bank m_syshibank;
|
||||
optional_memory_bank m_datalobank;
|
||||
optional_memory_bank m_datahibank;
|
||||
optional_memory_bank m_biosbank;
|
||||
|
||||
uint8_t m_to8_kbd_ack; /* 1 = cpu inits / accepts transfers */
|
||||
uint16_t m_to8_kbd_data; /* data to transmit */
|
||||
uint16_t m_to8_kbd_step; /* transmission automaton state */
|
||||
uint8_t m_to8_kbd_last_key; /* last key (for repetition) */
|
||||
uint32_t m_to8_kbd_key_count; /* keypress time (for repetition) */
|
||||
uint8_t m_to8_kbd_caps; /* caps lock */
|
||||
emu_timer* m_to8_kbd_timer; /* bit-send */
|
||||
emu_timer* m_to8_kbd_signal; /* signal from CPU */
|
||||
uint8_t m_to8_data_vpage;
|
||||
uint8_t m_to8_cart_vpage;
|
||||
uint8_t m_to8_reg_ram;
|
||||
uint8_t m_to8_reg_cart;
|
||||
uint8_t m_to8_reg_sys1;
|
||||
uint8_t m_to8_reg_sys2;
|
||||
uint8_t m_to8_lightpen_intr;
|
||||
uint8_t m_to8_soft_select;
|
||||
uint8_t m_to8_soft_bank;
|
||||
uint8_t m_to8_bios_bank;
|
||||
|
||||
TIMER_CALLBACK_MEMBER( to8_kbd_timer_cb );
|
||||
void to8_update_ram_bank_postload();
|
||||
void to8_update_cart_bank_postload();
|
||||
void to8_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_cartridge_r(offs_t offset);
|
||||
uint8_t to8_gatearray_r(offs_t offset);
|
||||
void to8_gatearray_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_vreg_r(offs_t offset);
|
||||
void to8_vreg_w(offs_t offset, uint8_t data);
|
||||
uint8_t to8_sys_porta_in();
|
||||
void to8_sys_portb_out(uint8_t data);
|
||||
uint8_t to8_timer_port_in();
|
||||
void to8_timer_port_out(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( to8_timer_cp2_out );
|
||||
void to8_lightpen_cb( int step );
|
||||
DECLARE_MACHINE_RESET( to8 );
|
||||
DECLARE_MACHINE_START( to8 );
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(write_centronics_busy);
|
||||
|
||||
void to8_sys_lo_w(offs_t offset, uint8_t data);
|
||||
void to8_sys_hi_w(offs_t offset, uint8_t data);
|
||||
void to8_data_lo_w(offs_t offset, uint8_t data);
|
||||
void to8_data_hi_w(offs_t offset, uint8_t data);
|
||||
void to8_vcart_w(offs_t offset, uint8_t data);
|
||||
|
||||
int to8_kbd_ktest();
|
||||
int to8_kbd_get_key();
|
||||
void to8_kbd_timer_func();
|
||||
void to8_kbd_set_ack( int data );
|
||||
void to8_kbd_reset();
|
||||
void to8_kbd_init();
|
||||
void to8_update_ram_bank();
|
||||
void to8_update_cart_bank();
|
||||
|
||||
void to9_ieee_w(offs_t offset, uint8_t data);
|
||||
uint8_t to9_ieee_r(offs_t offset);
|
||||
uint8_t to9_gatearray_r(offs_t offset);
|
||||
void to9_gatearray_w(offs_t offset, uint8_t data);
|
||||
uint8_t to9_vreg_r(offs_t offset);
|
||||
void to9_vreg_w(offs_t offset, uint8_t data);
|
||||
void to9_update_cart_bank_postload();
|
||||
void to9_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t to9_cartridge_r(offs_t offset);
|
||||
void to9_update_ram_bank_postload();
|
||||
uint8_t to9_kbd_r(offs_t offset);
|
||||
void to9_kbd_w(offs_t offset, uint8_t data);
|
||||
TIMER_CALLBACK_MEMBER( to9_kbd_timer_cb );
|
||||
uint8_t to9_sys_porta_in();
|
||||
void to9_sys_porta_out(uint8_t data);
|
||||
void to9_sys_portb_out(uint8_t data);
|
||||
void to9_timer_port_out(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( to9 );
|
||||
DECLARE_MACHINE_START( to9 );
|
||||
uint8_t to9p_timer_port_in();
|
||||
void to9p_timer_port_out(uint8_t data);
|
||||
DECLARE_MACHINE_RESET( to9p );
|
||||
DECLARE_MACHINE_START( to9p );
|
||||
|
||||
void to8_map(address_map &map);
|
||||
void to9_map(address_map &map);
|
||||
void to9p_map(address_map &map);
|
||||
|
||||
uint8_t m_to9_palette_data[32];
|
||||
uint8_t m_to9_palette_idx;
|
||||
uint8_t m_to9_soft_bank;
|
||||
uint8_t m_to9_kbd_parity; /* 0=even, 1=odd, 2=no parity */
|
||||
uint8_t m_to9_kbd_intr; /* interrupt mode */
|
||||
uint8_t m_to9_kbd_in; /* data from keyboard */
|
||||
uint8_t m_to9_kbd_status; /* status */
|
||||
uint8_t m_to9_kbd_overrun; /* character lost */
|
||||
uint8_t m_to9_kbd_periph; /* peripheral mode */
|
||||
uint8_t m_to9_kbd_byte_count; /* byte-count in peripheral mode */
|
||||
uint16_t m_to9_mouse_x;
|
||||
uint16_t m_to9_mouse_y;
|
||||
uint8_t m_to9_kbd_last_key; /* for key repetition */
|
||||
uint16_t m_to9_kbd_key_count;
|
||||
uint8_t m_to9_kbd_caps; /* caps-lock */
|
||||
uint8_t m_to9_kbd_pad; /* keypad outputs special codes */
|
||||
emu_timer* m_to9_kbd_timer;
|
||||
|
||||
void to9_set_video_mode( uint8_t data, int style );
|
||||
void to9_palette_init();
|
||||
void to9_update_cart_bank();
|
||||
void to9_update_ram_bank();
|
||||
int to9_kbd_ktest();
|
||||
void to9_kbd_update_irq();
|
||||
void to9_kbd_send( uint8_t data, int parity );
|
||||
int to9_kbd_get_key();
|
||||
void to9_kbd_reset();
|
||||
void to9_kbd_init();
|
||||
};
|
||||
|
||||
class mo6_state : public to9_state
|
||||
{
|
||||
public:
|
||||
mo6_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
to9_state(mconfig, type, tag),
|
||||
m_cartlobank(*this, MO6_CART_LO),
|
||||
m_carthibank(*this, MO6_CART_HI)
|
||||
{
|
||||
}
|
||||
|
||||
void mo6(machine_config &config);
|
||||
void pro128(machine_config &config);
|
||||
|
||||
DECLARE_MACHINE_RESET( mo6 );
|
||||
DECLARE_MACHINE_START( mo6 );
|
||||
|
||||
protected:
|
||||
optional_memory_bank m_cartlobank;
|
||||
optional_memory_bank m_carthibank;
|
||||
|
||||
void mo6_update_ram_bank_postload();
|
||||
void mo6_update_cart_bank_postload();
|
||||
void mo6_cartridge_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo6_cartridge_r(offs_t offset);
|
||||
void mo6_ext_w(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( mo6_centronics_busy );
|
||||
void mo6_game_porta_out(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( mo6_game_cb2_out );
|
||||
TIMER_CALLBACK_MEMBER( mo6_game_update_cb );
|
||||
uint8_t mo6_sys_porta_in();
|
||||
uint8_t mo6_sys_portb_in();
|
||||
void mo6_sys_porta_out(uint8_t data);
|
||||
DECLARE_WRITE_LINE_MEMBER( mo6_sys_cb2_out );
|
||||
uint8_t mo6_gatearray_r(offs_t offset);
|
||||
void mo6_gatearray_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo6_vreg_r(offs_t offset);
|
||||
void mo6_vreg_w(offs_t offset, uint8_t data);
|
||||
void mo6_vcart_lo_w(offs_t offset, uint8_t data);
|
||||
void mo6_vcart_hi_w(offs_t offset, uint8_t data);
|
||||
void mo6_map(address_map &map);
|
||||
void mo6_update_ram_bank();
|
||||
void mo6_update_cart_bank();
|
||||
void mo6_game_init();
|
||||
void mo6_game_reset();
|
||||
};
|
||||
|
||||
class mo5nr_state : public mo6_state
|
||||
{
|
||||
public:
|
||||
mo5nr_state(const machine_config &mconfig, device_type type, const char *tag) :
|
||||
mo6_state(mconfig, type, tag),
|
||||
m_nanoreseau(*this, "nanoreseau"),
|
||||
m_nanoreseau_config(*this, "nanoreseau_config"),
|
||||
m_extension_view(*this, "extension_view")
|
||||
{
|
||||
}
|
||||
|
||||
void mo5nr(machine_config &config);
|
||||
|
||||
DECLARE_MACHINE_RESET( mo5nr );
|
||||
DECLARE_MACHINE_START( mo5nr );
|
||||
|
||||
protected:
|
||||
required_device<nanoreseau_device> m_nanoreseau;
|
||||
required_ioport m_nanoreseau_config;
|
||||
memory_view m_extension_view;
|
||||
|
||||
void mo5nr_map(address_map &map);
|
||||
|
||||
void mo5nr_game_init();
|
||||
void mo5nr_game_reset();
|
||||
|
||||
uint8_t id_r();
|
||||
|
||||
uint8_t mo5nr_net_r(offs_t offset);
|
||||
void mo5nr_net_w(offs_t offset, uint8_t data);
|
||||
uint8_t mo5nr_prn_r();
|
||||
void mo5nr_prn_w(uint8_t data);
|
||||
uint8_t mo5nr_sys_portb_in();
|
||||
void mo5nr_sys_porta_out(uint8_t data);
|
||||
};
|
||||
|
||||
/*----------- defined in video/thomson.cpp -----------*/
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,159 +0,0 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Antoine Mine
|
||||
/**********************************************************************
|
||||
|
||||
Copyright (C) Antoine Mine' 2006
|
||||
|
||||
Thomson 8-bit computers
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef THOMFLOP_H_
|
||||
#define THOMFLOP_H_
|
||||
|
||||
#include "image.h"
|
||||
#include "imagedev/flopdrv.h"
|
||||
#include "machine/mc6843.h"
|
||||
#include "machine/mc6854.h"
|
||||
|
||||
/* number of external floppy controller ROM banks */
|
||||
#define TO7_NB_FLOP_BANK 9
|
||||
|
||||
/* external floppy / network controller active */
|
||||
#define THOM_FLOPPY_EXT (m_to7_controller_type >= 1)
|
||||
|
||||
/* internal floppy controller active (no or network extension) */
|
||||
#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 thomson_legacy_floppy_interface : public device_interface
|
||||
{
|
||||
protected:
|
||||
thomson_legacy_floppy_interface(const machine_config &mconfig, device_t &device)
|
||||
: device_interface(device, "thom_flop")
|
||||
{
|
||||
}
|
||||
|
||||
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(); }
|
||||
|
||||
uint8_t floppy_r(offs_t offset);
|
||||
void floppy_w(offs_t offset, uint8_t data);
|
||||
|
||||
void index_pulse_cb( int index, int state );
|
||||
void floppy_reset();
|
||||
|
||||
protected:
|
||||
virtual void device_resolve_objects() override;
|
||||
virtual void device_start() override;
|
||||
|
||||
private:
|
||||
// types of high-level operations
|
||||
enum thmfc1_op : uint8_t
|
||||
{
|
||||
OP_RESET = 0,
|
||||
OP_WRITE_SECT = 1,
|
||||
OP_READ_ADDR = 2,
|
||||
OP_READ_SECT = 3
|
||||
};
|
||||
|
||||
TIMER_CALLBACK_MEMBER( floppy_cmd_complete_cb );
|
||||
legacy_floppy_image_device *get_floppy_image();
|
||||
bool floppy_is_qdd( legacy_floppy_image_device *image ) const;
|
||||
int floppy_find_sector( chrn_id* dst );
|
||||
void floppy_cmd_complete();
|
||||
uint8_t floppy_read_byte();
|
||||
uint8_t floppy_raw_read_byte();
|
||||
void floppy_qdd_write_byte( uint8_t data );
|
||||
void floppy_write_byte( uint8_t data );
|
||||
void floppy_format_byte( uint8_t data );
|
||||
|
||||
required_device_array<legacy_floppy_image_device, 4> m_floppy_image;
|
||||
|
||||
devcb_write_line m_floppy_active_cb;
|
||||
|
||||
thmfc1_op m_op;
|
||||
uint8_t m_sector; // target sector, in [1,16]
|
||||
uint32_t m_sector_id;
|
||||
uint8_t m_track; // current track, in [0,79]
|
||||
uint8_t m_side; // current side, 0 or 1
|
||||
uint8_t m_drive; // 0 to 3
|
||||
uint16_t m_sector_size; // 128 or 256 (512, 1024 not supported)
|
||||
uint8_t m_formatting;
|
||||
uint8_t m_ipl; // index pulse / QDD start
|
||||
uint8_t m_wsync; // synchronization word
|
||||
int m_motor_on;
|
||||
|
||||
std::unique_ptr<uint8_t[]> m_data; // enough for a whole track
|
||||
uint32_t m_data_idx; // reading / writing / formatting pos
|
||||
uint32_t m_data_size; // bytes to read / write
|
||||
uint32_t m_data_finish; // when to raise the finished flag
|
||||
uint32_t m_data_raw_idx; // byte index for raw track reading
|
||||
uint32_t m_data_raw_size; // size of track already cached in data
|
||||
uint8_t m_data_crc; // check-sum of written data
|
||||
|
||||
uint8_t m_stat0; // status register
|
||||
|
||||
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_ */
|
File diff suppressed because it is too large
Load Diff
@ -40885,6 +40885,7 @@ outzoneb // TP-O18 (c) 1990 Toaplan
|
||||
outzonec // TP-O18 (c) 1990 Toaplan
|
||||
outzoneh // TP-O18 (c) 1990 Toaplan
|
||||
outzonecv // TP-O18 (c) 1990 Toaplan (TP-015 conversion)
|
||||
outzoned // Bootleg
|
||||
rallybik // B45 / TP-O12 (c) 1988 Taito
|
||||
samesame // TP-O17 (c) 1989 Toaplan
|
||||
samesame2 // TP-O17 (c) 1989 Toaplan
|
||||
|
@ -172,7 +172,7 @@ TIMER_CALLBACK_MEMBER( thomson_state::thom_lightpen_step )
|
||||
int step = param;
|
||||
|
||||
if ( m_thom_lightpen_cb )
|
||||
(this->*m_thom_lightpen_cb)( step );
|
||||
m_thom_lightpen_cb( step );
|
||||
|
||||
if ( step < m_thom_lightpen_nb )
|
||||
m_thom_lightpen_timer->adjust(attotime::from_usec( 64 ), step + 1);
|
||||
@ -902,10 +902,6 @@ TIMER_CALLBACK_MEMBER( thomson_state::thom_scanline_start )
|
||||
/* -------------- misc --------------- */
|
||||
|
||||
|
||||
#define FLOP_STATE (m_thom_floppy_wcount ? 2 : m_thom_floppy_rcount ? 1 : 0)
|
||||
|
||||
|
||||
|
||||
void thomson_state::thom_set_mode_point( int point )
|
||||
{
|
||||
assert( point >= 0 && point <= 1 );
|
||||
@ -915,24 +911,6 @@ void thomson_state::thom_set_mode_point( int point )
|
||||
|
||||
|
||||
|
||||
void thomson_state::thom_floppy_active( int write )
|
||||
{
|
||||
int fold = FLOP_STATE, fnew;
|
||||
|
||||
/* stays up for a few frames */
|
||||
if ( write )
|
||||
m_thom_floppy_wcount = 25;
|
||||
else
|
||||
m_thom_floppy_rcount = 25;
|
||||
|
||||
/* update icon */
|
||||
fnew = FLOP_STATE;
|
||||
if ( fold != fnew )
|
||||
m_floppy_led = fnew;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* -------------- main update function --------------- */
|
||||
|
||||
|
||||
@ -1065,22 +1043,12 @@ WRITE_LINE_MEMBER(thomson_state::thom_vblank)
|
||||
// rising edge
|
||||
if (state)
|
||||
{
|
||||
int fnew, fold = FLOP_STATE;
|
||||
int i;
|
||||
uint16_t b = 0;
|
||||
struct thom_vsignal l = thom_get_lightpen_vsignal( 0, -1, 0 );
|
||||
|
||||
LOG("%f thom: video eof called\n", machine().time().as_double());
|
||||
|
||||
/* floppy indicator count */
|
||||
if ( m_thom_floppy_wcount )
|
||||
m_thom_floppy_wcount--;
|
||||
if ( m_thom_floppy_rcount )
|
||||
m_thom_floppy_rcount--;
|
||||
fnew = FLOP_STATE;
|
||||
if ( fnew != fold )
|
||||
m_floppy_led = fnew;
|
||||
|
||||
/* prepare state for next frame */
|
||||
for ( i = 0; i <= THOM_TOTAL_HEIGHT; i++ )
|
||||
{
|
||||
@ -1194,12 +1162,6 @@ void thomson_state::video_start()
|
||||
save_item(NAME(m_thom_mode_point));
|
||||
m_vrambank->set_entry( 0 );
|
||||
|
||||
m_thom_floppy_rcount = 0;
|
||||
m_thom_floppy_wcount = 0;
|
||||
save_item(NAME(m_thom_floppy_wcount));
|
||||
save_item(NAME(m_thom_floppy_rcount));
|
||||
m_floppy_led.resolve();
|
||||
|
||||
m_caps_led.resolve();
|
||||
|
||||
m_thom_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
|
||||
@ -1258,7 +1220,7 @@ void thomson_state::thom_palette(palette_device &palette)
|
||||
thom_configure_palette(1.0 / 2.8, thom_pal_init, palette);
|
||||
}
|
||||
|
||||
void thomson_state::mo5_palette(palette_device &palette)
|
||||
void mo5_state::mo5_palette(palette_device &palette)
|
||||
{
|
||||
LOG("thom: MO5 palette init called\n");
|
||||
|
||||
@ -1334,7 +1296,7 @@ void thomson_state::to770_vram_w(offs_t offset, uint8_t data)
|
||||
|
||||
/* write to video memory through system space (always page 1) */
|
||||
|
||||
void thomson_state::to8_sys_lo_w(offs_t offset, uint8_t data)
|
||||
void to9_state::to8_sys_lo_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + offset + 0x6000;
|
||||
assert( offset < 0x2000 );
|
||||
@ -1347,7 +1309,7 @@ void thomson_state::to8_sys_lo_w(offs_t offset, uint8_t data)
|
||||
|
||||
|
||||
|
||||
void thomson_state::to8_sys_hi_w(offs_t offset, uint8_t data)
|
||||
void to9_state::to8_sys_hi_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + offset + 0x4000;
|
||||
assert( offset < 0x2000 );
|
||||
@ -1361,7 +1323,7 @@ void thomson_state::to8_sys_hi_w(offs_t offset, uint8_t data)
|
||||
|
||||
/* write to video memory through data space */
|
||||
|
||||
void thomson_state::to8_data_lo_w(offs_t offset, uint8_t data)
|
||||
void to9_state::to8_data_lo_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage + 0x2000 ) & m_ram->mask() );
|
||||
assert( offset < 0x2000 );
|
||||
@ -1376,7 +1338,7 @@ void thomson_state::to8_data_lo_w(offs_t offset, uint8_t data)
|
||||
|
||||
|
||||
|
||||
void thomson_state::to8_data_hi_w(offs_t offset, uint8_t data)
|
||||
void to9_state::to8_data_hi_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_data_vpage ) & m_ram->mask() );
|
||||
assert( offset < 0x2000 );
|
||||
@ -1392,7 +1354,7 @@ void thomson_state::to8_data_hi_w(offs_t offset, uint8_t data)
|
||||
|
||||
|
||||
/* write to video memory page through cartridge addresses space */
|
||||
void thomson_state::to8_vcart_w(offs_t offset, uint8_t data)
|
||||
void to9_state::to8_vcart_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() );
|
||||
assert( offset < 0x4000 );
|
||||
@ -1405,7 +1367,7 @@ void thomson_state::to8_vcart_w(offs_t offset, uint8_t data)
|
||||
m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = true;
|
||||
}
|
||||
|
||||
void thomson_state::mo6_vcart_lo_w(offs_t offset, uint8_t data)
|
||||
void mo6_state::mo6_vcart_lo_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + ( ( offset + 0x3000 + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() );
|
||||
assert( offset < 0x1000 );
|
||||
@ -1418,7 +1380,7 @@ void thomson_state::mo6_vcart_lo_w(offs_t offset, uint8_t data)
|
||||
m_thom_vmem_dirty[ (offset & 0x1fff) / 40 ] = true;
|
||||
}
|
||||
|
||||
void thomson_state::mo6_vcart_hi_w(offs_t offset, uint8_t data)
|
||||
void mo6_state::mo6_vcart_hi_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
uint8_t* dst = m_thom_vram + ( ( offset + 0x4000 * m_to8_cart_vpage ) & m_ram->mask() );
|
||||
assert( offset < 0x3000 );
|
||||
|
Loading…
Reference in New Issue
Block a user