Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbbert committed Jul 9, 2024
2 parents eb32729 + 81284c6 commit a236e31
Show file tree
Hide file tree
Showing 68 changed files with 1,301 additions and 634 deletions.
22 changes: 17 additions & 5 deletions scripts/src/sound.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1624,14 +1624,26 @@ if (SOUNDS["XT446"]~=null) then
end

---------------------------------------------------
-- Roland sample players
--@src/devices/sound/rolandpcm.h,SOUNDS["ROLANDPCM"] = true
-- Roland LP-based sample players
--@src/devices/sound/roland_lp.h,SOUNDS["ROLANDLP"] = true
---------------------------------------------------

if (SOUNDS["ROLANDPCM"]~=null) then
if (SOUNDS["ROLANDLP"]~=null) then
files {
MAME_DIR .. "src/devices/sound/rolandpcm.cpp",
MAME_DIR .. "src/devices/sound/rolandpcm.h",
MAME_DIR .. "src/devices/sound/roland_lp.cpp",
MAME_DIR .. "src/devices/sound/roland_lp.h",
}
end

---------------------------------------------------
-- Roland GP-based sample players
--@src/devices/sound/roland_gp.h,SOUNDS["ROLANDGP"] = true
---------------------------------------------------

if (SOUNDS["ROLANDGP"]~=null) then
files {
MAME_DIR .. "src/devices/sound/roland_gp.cpp",
MAME_DIR .. "src/devices/sound/roland_gp.h",
}
end

Expand Down
47 changes: 38 additions & 9 deletions src/devices/bus/nscsi/cd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ nscsi_cdrom_device::nscsi_cdrom_device(const machine_config &mconfig, device_typ
: nscsi_full_device(mconfig, type, tag, owner, clock)
, image(*this, "image")
, cdda(*this, "cdda")
, m_removal_prevented(false)
, bytes_per_block(bytes_per_sector)
, lba(0)
, cur_sector(0)
Expand Down Expand Up @@ -549,6 +550,7 @@ void nscsi_cdrom_device::scsi_command()
case SC_PREVENT_ALLOW_MEDIUM_REMOVAL:
// TODO: support eject prevention
LOG("command %s MEDIUM REMOVAL\n", (scsi_cmdbuf[4] & 0x1) ? "PREVENT" : "ALLOW");
m_removal_prevented = BIT(scsi_cmdbuf[4], 0);
scsi_status_complete(SS_GOOD);
break;

Expand Down Expand Up @@ -883,11 +885,21 @@ void nscsi_cdrom_apple_device::device_start()
}

/*
The Apple II SCSI Card firmware demands that ASC on a failing TEST_UNIT_READY be either 0x28 or 0xb0.
0x28 is MEDIA_CHANGED, 0xb0 is vendor-specific. If the drive returns the normal 0x3A for disc-not-present,
The Apple II SCSI Card firmware demands that ASC on a failing TEST_UNIT_READY be either 0x28 or 0xB0.
0x28 is MEDIA_CHANGED, 0xB0 is vendor-specific. If the drive returns the normal 0x3A for disc-not-present,
the firmware assumes the drive is broken and retries the TEST_UNIT_READY for 60 seconds before giving up
and booting the machine.
MacOS will see the normal 0x3A disc-not-present and simply disbelieve it and hammer on the drive while
asking the user to format it because it's unreadable. 0xB0 makes it behave as expected.
*/

void nscsi_cdrom_apple_device::return_no_cd()
{
sense(false, SK_NOT_READY, 0xb0);
scsi_status_complete(SS_CHECK_CONDITION);
}

void nscsi_cdrom_apple_device::scsi_command()
{
if (scsi_cmdbuf[0] != 8 && scsi_cmdbuf[0] != 0x28 && scsi_cmdbuf[0] != 0 && scsi_cmdbuf[0] != 0x03)
Expand All @@ -908,8 +920,7 @@ void nscsi_cdrom_apple_device::scsi_command()
}
else
{
sense(false, SK_NOT_READY, 0xb0);
scsi_status_complete(SS_CHECK_CONDITION);
return_no_cd();
}
break;

Expand Down Expand Up @@ -1312,15 +1323,33 @@ void nscsi_cdrom_apple_device::scsi_command()
case APPLE_AUDIO_CONTROL:
LOG("command APPLE AUDIO CONTROL, size %d\n", scsi_cmdbuf[8]);

scsi_data_out(3, scsi_cmdbuf[8]);
scsi_status_complete(SS_GOOD);
if (image->exists())
{
scsi_data_out(3, scsi_cmdbuf[8]);
scsi_status_complete(SS_GOOD);
}
else
{
return_no_cd();
}
break;

case APPLE_EJECT:
LOG("command APPLE EJECT\n");
cdda->stop_audio();
m_stopped = true;
scsi_status_complete(SS_GOOD);
if (!m_removal_prevented)
{
cdda->stop_audio();
m_stopped = true;
image->unload();
sense(false, SK_NOT_READY, SK_ASC_MEDIUM_NOT_PRESENT);
scsi_status_complete(SS_GOOD);
}
else
{
LOG("Eject not allowed by PREVENT_ALLOW_MEDIA_REMOVAL\n");
sense(false, SK_ILLEGAL_REQUEST, 0x80); // "Prevent bit is set"
scsi_status_complete(SS_CHECK_CONDITION);
}
break;

case SC_READ_6:
Expand Down
5 changes: 4 additions & 1 deletion src/devices/bus/nscsi/cd.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ class nscsi_cdrom_device : public nscsi_full_device
virtual uint8_t scsi_get_data(int id, int pos) override;
virtual void scsi_put_data(int buf, int offset, uint8_t data) override;

void return_no_cd();
virtual void return_no_cd();
static int to_msf(int frame);

bool m_removal_prevented;

private:
static constexpr uint32_t bytes_per_sector = 2048;

Expand Down Expand Up @@ -133,6 +135,7 @@ class nscsi_cdrom_apple_device : public nscsi_cdrom_device
virtual void scsi_command() override;
virtual bool scsi_command_done(uint8_t command, uint8_t length) override;
virtual void scsi_put_data(int buf, int offset, uint8_t data) override;
virtual void return_no_cd() override;

private:
bool m_stopped;
Expand Down
11 changes: 4 additions & 7 deletions src/devices/bus/vme/mvme180.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ void vme_mvme180_card_device::device_add_mconfig(machine_config &config)
{
MC88100(config, m_cpu, 40_MHz_XTAL / 2);
m_cpu->set_addrmap(AS_PROGRAM, &vme_mvme180_card_device::cpu_mem);
m_cpu->set_cmmu_code([this](u32 const address) -> mc88200_device & { return *m_mmu[0]; });
m_cpu->set_cmmu_data([this](u32 const address) -> mc88200_device & { return *m_mmu[1]; });

MC88200(config, m_mmu[0], 40_MHz_XTAL / 2, 0x7e);
m_mmu[0]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_i(m_mmu[0]);

MC88200(config, m_mmu[1], 40_MHz_XTAL / 2, 0x7f);
m_mmu[1]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_d(m_mmu[1]);
MC88200(config, m_mmu[0], 40_MHz_XTAL / 2, 0x7e).set_mbus(m_cpu, AS_PROGRAM);
MC88200(config, m_mmu[1], 40_MHz_XTAL / 2, 0x7f).set_mbus(m_cpu, AS_PROGRAM);

SCN2681(config, m_duart, 3.6864_MHz_XTAL);
m_duart->irq_cb().set(FUNC(vme_mvme180_card_device::irq_w<6>));
Expand Down
11 changes: 4 additions & 7 deletions src/devices/bus/vme/mvme181.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,11 @@ void vme_mvme181_card_device::device_add_mconfig(machine_config &config)
{
MC88100(config, m_cpu, 40_MHz_XTAL / 2);
m_cpu->set_addrmap(AS_PROGRAM, &vme_mvme181_card_device::cpu_mem);
m_cpu->set_cmmu_code([this](u32 const address) -> mc88200_device & { return *m_mmu[0]; });
m_cpu->set_cmmu_data([this](u32 const address) -> mc88200_device & { return *m_mmu[1]; });

MC88200(config, m_mmu[0], 40_MHz_XTAL / 2, 0x7e);
m_mmu[0]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_i(m_mmu[0]);

MC88200(config, m_mmu[1], 40_MHz_XTAL / 2, 0x7f);
m_mmu[1]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_d(m_mmu[1]);
MC88200(config, m_mmu[0], 40_MHz_XTAL / 2, 0x7e).set_mbus(m_cpu, AS_PROGRAM);
MC88200(config, m_mmu[1], 40_MHz_XTAL / 2, 0x7f).set_mbus(m_cpu, AS_PROGRAM);

DS1315(config, m_rtc, 0); // DS1216

Expand Down
11 changes: 4 additions & 7 deletions src/devices/bus/vme/mvme187.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,11 @@ void vme_mvme187_card_device::device_add_mconfig(machine_config &config)
{
MC88100(config, m_cpu, 50_MHz_XTAL / 2);
m_cpu->set_addrmap(AS_PROGRAM, &vme_mvme187_card_device::cpu_mem);
m_cpu->set_cmmu_code([this](u32 const address) -> mc88200_device & { return *m_mmu[0]; });
m_cpu->set_cmmu_data([this](u32 const address) -> mc88200_device & { return *m_mmu[1]; });

MC88200(config, m_mmu[0], 50_MHz_XTAL / 2, 0x77);
m_mmu[0]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_i(m_mmu[0]);

MC88200(config, m_mmu[1], 50_MHz_XTAL / 2, 0x7f);
m_mmu[1]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_d(m_mmu[1]);
MC88200(config, m_mmu[0], 50_MHz_XTAL / 2, 0x77).set_mbus(m_cpu, AS_PROGRAM);
MC88200(config, m_mmu[1], 50_MHz_XTAL / 2, 0x7f).set_mbus(m_cpu, AS_PROGRAM);

DS1643(config, m_rtc);

Expand Down
11 changes: 4 additions & 7 deletions src/devices/bus/vme/tp881v.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,11 @@ void vme_tp881v_card_device::device_add_mconfig(machine_config &config)
{
MC88100(config, m_cpu, 40_MHz_XTAL / 2);
m_cpu->set_addrmap(AS_PROGRAM, &vme_tp881v_card_device::cpu_mem);
m_cpu->set_cmmu_code([this](u32 const address) -> mc88200_device & { return *m_mmu[0]; });
m_cpu->set_cmmu_data([this](u32 const address) -> mc88200_device & { return *m_mmu[1]; });

MC88200(config, m_mmu[0], 40_MHz_XTAL / 2, 0x00);
m_mmu[0]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_i(m_mmu[0]);

MC88200(config, m_mmu[1], 40_MHz_XTAL / 2, 0x01);
m_mmu[1]->set_mbus(m_cpu, AS_PROGRAM);
m_cpu->set_cmmu_d(m_mmu[1]);
MC88200(config, m_mmu[0], 40_MHz_XTAL / 2, 0x00).set_mbus(m_cpu, AS_PROGRAM);
MC88200(config, m_mmu[1], 40_MHz_XTAL / 2, 0x01).set_mbus(m_cpu, AS_PROGRAM);

// per-jp interrupt controllers
// 4MHz input clock, ct3 gives 100Hz clock, ct2 counts at 10kHz
Expand Down
42 changes: 21 additions & 21 deletions src/devices/cpu/m88000/m88000.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ mc88100_device::mc88100_device(const machine_config &mconfig, const char *tag, d
: cpu_device(mconfig, MC88100, tag, owner, clock)
, m_code_config("code", ENDIANNESS_BIG, 32, 32, 0)
, m_data_config("data", ENDIANNESS_BIG, 32, 32, 0)
, m_cmmu_d(*this, finder_base::DUMMY_TAG)
, m_cmmu_i(*this, finder_base::DUMMY_TAG)
, m_cmmu_code(nullptr)
, m_cmmu_data(nullptr)
, m_sb(0)
, m_r{ 0 }
, m_cr{ 0 }
Expand Down Expand Up @@ -183,13 +183,13 @@ bool mc88100_device::memory_translate(int spacenum, int intention, offs_t &addre
{
case TR_READ:
case TR_WRITE:
if (m_cmmu_d)
return m_cmmu_d->translate(intention, address, m_cr[PSR] & PSR_MODE);
if (m_cmmu_data)
return m_cmmu_data(address).translate(intention, address, m_cr[PSR] & PSR_MODE);
break;

case TR_FETCH:
if (m_cmmu_i)
return m_cmmu_i->translate(intention, address, m_cr[PSR] & PSR_MODE);
if (m_cmmu_code)
return m_cmmu_code(address).translate(intention, address, m_cr[PSR] & PSR_MODE);
break;
}

Expand All @@ -198,7 +198,7 @@ bool mc88100_device::memory_translate(int spacenum, int intention, offs_t &addre

void mc88100_device::device_start()
{
space(AS_PROGRAM).specific(m_inst_space);
space(AS_PROGRAM).specific(m_code_space);

if (has_configured_map(AS_DATA))
space(AS_DATA).specific(m_data_space);
Expand Down Expand Up @@ -1525,16 +1525,16 @@ void mc88100_device::fset(unsigned const td, unsigned const d, float64_t const d

void mc88100_device::fetch(u32 &address, u32 &inst)
{
if (m_cmmu_i)
if (m_cmmu_code)
{
std::optional<u32> data = m_cmmu_i->read<u32>(address & IP_A, m_cr[PSR] & PSR_MODE);
std::optional<u32> data = m_cmmu_code(address & IP_A).read<u32>(address & IP_A, m_cr[PSR] & PSR_MODE);
if (data.has_value())
inst = data.value();
else
address |= IP_E;
}
else
inst = m_inst_space.read_dword(address & IP_A);
inst = m_code_space.read_dword(address & IP_A);
}

template <typename T, bool Usr> void mc88100_device::ld(u32 address, unsigned const reg)
Expand All @@ -1552,11 +1552,11 @@ template <typename T, bool Usr> void mc88100_device::ld(u32 address, unsigned co
address &= ~(sizeof(T) - 1);
}

if (m_cmmu_d)
if (m_cmmu_data)
{
if constexpr (sizeof(T) < 8)
{
std::optional<T> const data = m_cmmu_d->read<typename std::make_unsigned<T>::type>(address, (m_cr[PSR] & PSR_MODE) && !Usr);
std::optional<T> const data = m_cmmu_data(address).read<typename std::make_unsigned<T>::type>(address, (m_cr[PSR] & PSR_MODE) && !Usr);

if (data.has_value() && reg)
m_r[reg] = std::is_signed<T>() ? s32(data.value()) : data.value();
Expand Down Expand Up @@ -1585,8 +1585,8 @@ template <typename T, bool Usr> void mc88100_device::ld(u32 address, unsigned co
}
else
{
std::optional<u32> const hi = m_cmmu_d->read<u32>(address + 0, (m_cr[PSR] & PSR_MODE) && !Usr);
std::optional<u32> const lo = m_cmmu_d->read<u32>(address + 4, (m_cr[PSR] & PSR_MODE) && !Usr);
std::optional<u32> const hi = m_cmmu_data(address + 0).read<u32>(address + 0, (m_cr[PSR] & PSR_MODE) && !Usr);
std::optional<u32> const lo = m_cmmu_data(address + 4).read<u32>(address + 4, (m_cr[PSR] & PSR_MODE) && !Usr);
if (lo.has_value() && hi.has_value())
{
if (reg != 0)
Expand Down Expand Up @@ -1673,11 +1673,11 @@ template <typename T, bool Usr> void mc88100_device::st(u32 address, unsigned co
address &= ~(sizeof(T) - 1);
}

if (m_cmmu_d)
if (m_cmmu_data)
{
if constexpr (sizeof(T) < 8)
{
if (!m_cmmu_d->write(address, T(m_r[reg]), (m_cr[PSR] & PSR_MODE) && !Usr))
if (!m_cmmu_data(address).write(address, T(m_r[reg]), (m_cr[PSR] & PSR_MODE) && !Usr))
{
m_cr[DMT0] = DMT_EN<T>(address) | DMT_WRITE | DMT_VALID;
m_cr[DMT1] = 0;
Expand All @@ -1701,8 +1701,8 @@ template <typename T, bool Usr> void mc88100_device::st(u32 address, unsigned co
else
{
bool result = true;
result &= m_cmmu_d->write(address + 0, m_r[(reg + 0) & 31], (m_cr[PSR] & PSR_MODE) && !Usr);
result &= m_cmmu_d->write(address + 4, m_r[(reg + 1) & 31], (m_cr[PSR] & PSR_MODE) && !Usr);
result &= m_cmmu_data(address + 0).write(address + 0, m_r[(reg + 0) & 31], (m_cr[PSR] & PSR_MODE) && !Usr);
result &= m_cmmu_data(address + 4).write(address + 4, m_r[(reg + 1) & 31], (m_cr[PSR] & PSR_MODE) && !Usr);

if (!result)
{
Expand Down Expand Up @@ -1762,18 +1762,18 @@ template <typename T, bool Usr> void mc88100_device::xmem(u32 address, unsigned
// save source value
T const src = m_r[reg];

if (m_cmmu_d)
if (m_cmmu_data)
{
// read destination
std::optional<T> const dst = m_cmmu_d->read<T>(address, (m_cr[PSR] & PSR_MODE) && !Usr);
std::optional<T> const dst = m_cmmu_data(address).read<T>(address, (m_cr[PSR] & PSR_MODE) && !Usr);
if (dst.has_value())
{
// update register
if (reg)
m_r[reg] = dst.value();

// write destination
if (m_cmmu_d->write<T>(address, src, (m_cr[PSR] & PSR_MODE) && !Usr))
if (m_cmmu_data(address).write<T>(address, src, (m_cr[PSR] & PSR_MODE) && !Usr))
return;
}

Expand Down
10 changes: 5 additions & 5 deletions src/devices/cpu/m88000/m88000.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class mc88100_device : public cpu_device
// construction/destruction
mc88100_device(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock);

template <typename T> void set_cmmu_d(T &&tag) { m_cmmu_d.set_tag(std::forward<T>(tag)); }
template <typename T> void set_cmmu_i(T &&tag) { m_cmmu_i.set_tag(std::forward<T>(tag)); }
void set_cmmu_code(std::function<mc88200_device &(u32 const address)> f) { m_cmmu_code = f; }
void set_cmmu_data(std::function<mc88200_device &(u32 const address)> f) { m_cmmu_data = f; }

protected:
// device_t implementation
Expand Down Expand Up @@ -64,11 +64,11 @@ class mc88100_device : public cpu_device
// address spaces
address_space_config m_code_config;
address_space_config m_data_config;
memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_inst_space;
memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_code_space;
memory_access<32, 2, 0, ENDIANNESS_BIG>::specific m_data_space;

optional_device<mc88200_device> m_cmmu_d;
optional_device<mc88200_device> m_cmmu_i;
std::function<mc88200_device &(u32 const address)> m_cmmu_code;
std::function<mc88200_device &(u32 const address)> m_cmmu_data;

// register storage
u32 m_xip; // execute instruction pointer
Expand Down
18 changes: 11 additions & 7 deletions src/devices/machine/fm_scsi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,17 @@ fmscsi_device::fmscsi_device(const machine_config &mconfig, const char *tag, dev

void fmscsi_device::device_start()
{
m_input_lines = 0;
m_output_lines = 0;
m_data = 0;
m_command_index = 0;
m_last_id = 0;
m_target = 0;
m_phase = SCSI_PHASE_BUS_FREE;
save_item(NAME(m_command));
save_item(NAME(m_command_index));
save_item(NAME(m_result_length));
save_item(NAME(m_result_index));
save_item(NAME(m_input_lines));
save_item(NAME(m_output_lines));
save_item(NAME(m_data));
save_item(NAME(m_last_id));
save_item(NAME(m_phase));
save_item(NAME(m_target));
save_item(NAME(m_buffer));

// allocate read timer
m_transfer_timer = timer_alloc(FUNC(fmscsi_device::update_transfer), this);
Expand Down
Loading

0 comments on commit a236e31

Please sign in to comment.