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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/lib/formats/flopimg.h
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ class floppy_image
DSQD = 0x44515344, //!< "DSQD", Double-sided quad-density (720K in 5.25, means DD+80 tracks)
DSQD10 = 0x30315144, //!< "DQ10", Double-sided quad-density 10 hard sector
DSQD16 = 0x36315144, //!< "DQ16", Double-sided quad-density 16 hard sector (720K in 5.25, means DD+80 tracks)
DSHD = 0x44485344, //!< "DSHD", Double-sided high-density (1440K)
DSHD = 0x44485344, //!< "DSHD", Double-sided high-density (1440K in 3.5, 1200K in 5.25)
DSED = 0x44455344 //!< "DSED", Double-sided extra-density (2880K)
};

Expand Down
60 changes: 34 additions & 26 deletions src/mame/olivetti/att6300p.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

#include "emu.h"

#include "att6300p_fdc.h"
#include "att6300p_mmu.h"
#include "m24_kbd.h"

Expand Down Expand Up @@ -249,7 +250,7 @@ class att6300p_state : public driver_device
void nmi_enable_w(uint8_t data);
void update_nmi();

void set_protected_mode(bool enabled);
void set_protection_enabled(bool enabled);

required_device<i80286_cpu_device> m_maincpu;
required_device<ram_device> m_ram;
Expand Down Expand Up @@ -294,8 +295,6 @@ class att6300p_state : public driver_device

void update_ir1();

static void floppy_formats(format_registration &fr);

void soft_reset();
void configure_mapping(int sel);

Expand All @@ -315,13 +314,13 @@ class att6300p_state : public driver_device
void cltrap_w(offs_t offset, uint8_t data);

bool m_protected;
bool m_realmode;
bool m_mapping_sel;
bool m_warm_reset;

uint8_t m_trapio_reg_idx;
uint16_t m_trapio_reg[4][4];

static void cfg_m20_format(device_t *device);
static void cfg_no_serial_mouse(device_t *device);
void kbc_map(address_map &map) ATTR_COLD;

Expand Down Expand Up @@ -385,14 +384,16 @@ void att6300p_state::machine_start()
save_item(NAME(m_p2_out));
save_item(NAME(m_kbdata));
save_item(NAME(m_protected));
save_item(NAME(m_realmode));
save_item(NAME(m_warm_reset));
save_item(NAME(m_trapio_reg_idx));
save_item(NAME(m_trapio_reg));
}

void att6300p_state::machine_reset()
{
set_protected_mode(false);
set_protection_enabled(false);
m_realmode = true;
configure_mapping(0);

ctrlport_a_w(0);
Expand Down Expand Up @@ -662,7 +663,12 @@ void att6300p_state::zc02_cb(int state)

void att6300p_state::soft_reset()
{
set_protected_mode(false);
if (!m_realmode)
{
m_realmode = true;
configure_mapping(m_mapping_sel);
m_mmu->set_a20_enabled(!m_realmode);
}
m_maincpu->reset();
}

Expand All @@ -675,7 +681,7 @@ void att6300p_state::configure_mapping(int sel)
0x03, 0x13, 0x0b, 0x1b, 0x07, 0x17, 0x0f, 0x1f,
};

bool rom_upper = (sel & 0x8) == 0 || m_protected;
bool rom_upper = !((sel & 0x8) && m_realmode);
int rom_region = (sel & 7) + (rom_upper ? 8 : 0);

uint8_t *rom = m_map_rom->base() + rom_region*32;
Expand All @@ -701,13 +707,23 @@ void att6300p_state::configure_mapping(int sel)
m_mapping_sel = sel;
}

void att6300p_state::set_protected_mode(bool enabled)
void att6300p_state::set_protection_enabled(bool enabled)
{
if (m_protected != enabled)
{
if (enabled)
{
// Rising edge of protection enable indicates we are to use
// A20-A23 for the PROM-based address mapping.
if (m_realmode)
{
m_realmode = false;
configure_mapping(m_mapping_sel);
m_mmu->set_a20_enabled(!m_realmode);
}
}
m_protected = enabled;
configure_mapping(m_mapping_sel);
m_mmu->set_protected_mode_enabled(enabled);
m_mmu->set_protection_enabled(enabled);
}
}

Expand Down Expand Up @@ -743,7 +759,7 @@ void att6300p_state::timeslice_w(offs_t offset, uint8_t data)

void att6300p_state::protecten_w(offs_t offset, uint8_t data)
{
set_protected_mode(data & B_VIRT_PE_PROTECTEN);
set_protection_enabled(data & B_VIRT_PE_PROTECTEN);

m_mmu->set_mem_setup_enabled(data & B_VIRT_PE_MEMSETUP);
m_mmu->set_io_setup_enabled(data & B_VIRT_PE_IOSETUP);
Expand Down Expand Up @@ -862,7 +878,7 @@ void att6300p_state::att6300p_vio_map(address_map &map)
static INPUT_PORTS_START( att6300p )
PORT_START("DSW1")

PORT_DIPNAME( 0x01, 0x01, "Drive B Type") PORT_DIPLOCATION("DSW1:1")
PORT_DIPNAME( 0x01, 0x00, "Drive B Type") PORT_DIPLOCATION("DSW1:1")
PORT_DIPSETTING( 0x01, "96 TPI" )
PORT_DIPSETTING( 0x00, "48 TPI" )
PORT_DIPNAME( 0x02, 0x02, "Drive A Type") PORT_DIPLOCATION("DSW1:2")
Expand Down Expand Up @@ -903,25 +919,17 @@ static INPUT_PORTS_START( att6300p )
PORT_DIPSETTING( 0x80, "32K" )
INPUT_PORTS_END

void att6300p_state::floppy_formats(format_registration &fr)
{
fr.add_pc_formats();
fr.add(FLOPPY_NASLITE_FORMAT);
fr.add(FLOPPY_M20_FORMAT);
}

void att6300p_state::cfg_m20_format(device_t *device)
{
device->subdevice<floppy_connector>("fdc:0")->set_formats(att6300p_state::floppy_formats);
device->subdevice<floppy_connector>("fdc:1")->set_formats(att6300p_state::floppy_formats);
}

void att6300p_state::cfg_no_serial_mouse(device_t *device)
{
/* Don't attach serial mouse, since there's a proprietary mouse */
device->subdevice<rs232_port_device>("serport0")->set_default_option(nullptr);
}

void att6300p_mb_isa_devices(device_slot_interface &device)
{
device.option_add("fdc_6300p", ISA8_FDC_6300P);
}

void att6300p_state::att6300p(machine_config &config)
{
I80286(config, m_maincpu, 12_MHz_XTAL / 2);
Expand Down Expand Up @@ -980,7 +988,7 @@ void att6300p_state::att6300p(machine_config &config)
m_isabus->iochck_callback().set(FUNC(att6300p_state::chck_w));

ISA8_SLOT(config, "mb1", 0, m_isabus, pc_isa8_cards, "cga_m24", true);
ISA8_SLOT(config, "mb2", 0, m_isabus, pc_isa8_cards, "fdc_xt", true).set_option_machine_config("fdc_xt", cfg_m20_format);
ISA8_SLOT(config, "mb2", 0, m_isabus, att6300p_mb_isa_devices, "fdc_6300p", true);
ISA8_SLOT(config, "mb3", 0, m_isabus, pc_isa8_cards, "lpt", true);
ISA8_SLOT(config, "mb4", 0, m_isabus, pc_isa8_cards, "com", true).set_option_machine_config("com", cfg_no_serial_mouse);

Expand Down
70 changes: 70 additions & 0 deletions src/mame/olivetti/att6300p_fdc.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// license:BSD-3-Clause
// copyright-holders: D. Donohoe

#include "emu.h"

#include "att6300p_fdc.h"

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

isa8_fdc_6300p_device::isa8_fdc_6300p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : isa8_upd765_fdc_device(mconfig, ISA8_FDC_6300P, tag, owner, clock)
{
}

void isa8_fdc_6300p_device::device_add_mconfig(machine_config &config)
{
upd765a_device &upd765a(UPD765A(config, m_fdc, 8'000'000, false, false));
upd765a.intrq_wr_callback().set(FUNC(isa8_fdc_6300p_device::fdc_irq_w));
upd765a.drq_wr_callback().set(FUNC(isa8_fdc_6300p_device::fdc_drq_w));

// According to "Getting Started with you AT&T 6300 Plus", when the
// system came in a two-floppy configuration, drive A (lower drive)
// was 1.2MB, and drive B was 360K.
FLOPPY_CONNECTOR(config, "fdc:0", att6300p_floppies, "525hd", isa8_fdc_device::floppy_formats).enable_sound(true);
FLOPPY_CONNECTOR(config, "fdc:1", att6300p_floppies, "525dd", isa8_fdc_device::floppy_formats).enable_sound(true);
Comment on lines +29 to +30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 525hd and 525dd a mistake or the sizes are really uneven by factory default? (I'd add a comment if latter)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the way they are by factory default, according to the User Guide. I can add a comment.

}

void isa8_fdc_6300p_device::rc_map(address_map &map)
{
map(0x0, 0x0).rw(FUNC(isa8_fdc_6300p_device::rc_r), FUNC(isa8_fdc_6300p_device::rc_w));
}

void isa8_fdc_6300p_device::map(address_map &map)
{
map(0x2, 0x2).rw(FUNC(isa8_fdc_6300p_device::dor_r), FUNC(isa8_fdc_6300p_device::dor_w));
map(0x4, 0x5).m(m_fdc, FUNC(upd765a_device::map));
}

void isa8_fdc_6300p_device::device_start()
{
set_isa_device();
m_isa->install_device(0x0065, 0x0065, *this, &isa8_fdc_6300p_device::rc_map);
m_isa->install_device(0x03f0, 0x03f7, *this, &isa8_fdc_6300p_device::map);
m_isa->set_dma_channel(2, this, true);

isa8_upd765_fdc_device::device_start();

m_fdc->set_rate(300000);

save_item(NAME(m_rate));
}

uint8_t isa8_fdc_6300p_device::rc_r()
{
return m_rate;
}

void isa8_fdc_6300p_device::rc_w(uint8_t data)
{
static const int rates[4] = { 500000, 300000, 250000, 250000 };
m_rate = rates[data&3];
m_fdc->set_rate(m_rate);
}

DEFINE_DEVICE_TYPE(ISA8_FDC_6300P, isa8_fdc_6300p_device, "isa8_fdc_6300p", "ISA 8bits 6300 Plus FDC hookup")
30 changes: 30 additions & 0 deletions src/mame/olivetti/att6300p_fdc.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// license:BSD-3-Clause
// copyright-holders: D. Donohoe

#include "emu.h"

#include "bus/isa/fdc.h"
#include "bus/isa/isa.h"
#include "imagedev/floppy.h"
#include "machine/upd765.h"

DECLARE_DEVICE_TYPE(ISA8_FDC_6300P, isa8_fdc_6300p_device)

class isa8_fdc_6300p_device : public isa8_upd765_fdc_device {
public:
isa8_fdc_6300p_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override ATTR_COLD;
virtual void device_start() override ATTR_COLD;

void map(address_map &map) ATTR_COLD;
void rc_map(address_map &map) ATTR_COLD;

uint8_t rc_r();
void rc_w(uint8_t data);

private:
int m_rate;
};
20 changes: 13 additions & 7 deletions src/mame/olivetti/att6300p_mmu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void att6300p_mmu_device::device_start()
space().specific(m_mem16_space);
m_io = &space(AS_IO);

save_item(NAME(m_protected_mode));
save_item(NAME(m_protection_enabled));
save_item(NAME(m_map_table));
save_item(NAME(m_map_imask));
save_item(NAME(m_map_omask));
Expand All @@ -53,14 +53,16 @@ void att6300p_mmu_device::device_start()

void att6300p_mmu_device::device_reset()
{
set_protected_mode_enabled(false);
set_protection_enabled(false);
m_mem_wr_fastpath = true;
m_mem_prot_limit = 0;
m_io_setup_enabled = false;
m_mem_setup_enabled = false;
m_io_read_traps_enabled = false;
m_io_write_traps_enabled = false;

set_a20_enabled(false);

for (int i = 0; i < 32; i++)
{
m_map_table[i] = i * 32*1024;
Expand All @@ -70,10 +72,8 @@ void att6300p_mmu_device::device_reset()
memset(m_io_prot_table, 0, sizeof m_mem_prot_table);
}

void att6300p_mmu_device::set_protected_mode_enabled(bool enabled)
void att6300p_mmu_device::set_a20_enabled(bool enabled)
{
m_protected_mode = enabled;

if (enabled)
{
// Replaces A15-A19
Expand All @@ -89,6 +89,12 @@ void att6300p_mmu_device::set_protected_mode_enabled(bool enabled)
}
}

// Set whether the machines-specific protection circuitry is active.
void att6300p_mmu_device::set_protection_enabled(bool enabled)
{
m_protection_enabled = enabled;
}

void att6300p_mmu_device::update_fastpath()
{
m_mem_wr_fastpath = (m_mem_prot_limit == 0 &&
Expand Down Expand Up @@ -183,7 +189,7 @@ uint16_t att6300p_mmu_device::io_r(offs_t offset, uint16_t mem_mask)
{
offset <<= 1;

if (m_protected_mode)
if (m_protection_enabled)
{
// Skip protection checks
switch (mem_mask)
Expand Down Expand Up @@ -264,7 +270,7 @@ void att6300p_mmu_device::io_w(offs_t offset, uint16_t data, uint16_t mem_mask)
{
offset <<= 1;

if (m_protected_mode)
if (m_protection_enabled)
{
// Skip protection checks
switch (mem_mask)
Expand Down
5 changes: 3 additions & 2 deletions src/mame/olivetti/att6300p_mmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class att6300p_mmu_device : public device_t, public device_memory_interface
auto trapio_callback() { return m_trapio.bind(); }

// MMU configuration
void set_protected_mode_enabled(bool enabled);
void set_a20_enabled(bool enabled);
void set_protection_enabled(bool enabled);
void set_mem_mapping(uint32_t target_addr[32]);
void set_mem_setup_enabled(bool enabled);
void set_io_setup_enabled(bool enabled);
Expand Down Expand Up @@ -53,7 +54,7 @@ class att6300p_mmu_device : public device_t, public device_memory_interface
memory_access<24, 1, 0, ENDIANNESS_LITTLE>::specific m_mem16_space;
address_space *m_io;

bool m_protected_mode;
bool m_protection_enabled;
uint32_t m_map_table[32];
uint32_t m_map_imask, m_map_omask;
bool m_mem_wr_fastpath;
Expand Down
Loading