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 Aug 2, 2024
2 parents 020eeb2 + 192dc72 commit 53f2b70
Show file tree
Hide file tree
Showing 21 changed files with 1,636 additions and 772 deletions.
22 changes: 6 additions & 16 deletions src/devices/bus/nubus/nubus_specpdq.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
TODO:
* Having no alternate oscillator installed is not emulated.
* Work out how active line length is configured.
* Alternate oscillator calibration is currently failing. Fixing this
probably requires a complete cycle-accurate Mac II.
Expand Down Expand Up @@ -326,22 +325,13 @@ void nubus_specpdq_device::update_crtc()
// for some reason you temporarily get invalid screen parameters - ignore them
if (m_crtc.valid(*this))
{
int h_start_adj = (m_crtc.h_start(1) + 3) * 16;

rectangle active(
m_crtc.h_start(16) + (m_hdelay * 4),
m_crtc.h_end(16) - 1,
m_crtc.v_start(),
m_crtc.v_end() - 1);

// FIXME: work out how it actually configures the RAMDAC end-of-line
// this is a horrible hack
if (active.width() < 832)
active.set_width(640);
else if (active.width() < 1024)
active.set_width(832);
else if (active.width() < 1152)
active.set_width(1024);
else
active.set_width(1152);
h_start_adj,
m_crtc.h_end(16) - 1,
m_crtc.v_start(),
m_crtc.v_end() - 1);

screen().configure(
m_crtc.h_total(16),
Expand Down
4 changes: 2 additions & 2 deletions src/devices/cpu/m6502/om65ce02.lst
Original file line number Diff line number Diff line change
Expand Up @@ -1657,15 +1657,15 @@ stz_ce_aba
PC++;
TMP = set_h(TMP, read_pc());
PC++;
write(TMP, A);
write(TMP, Z);
prefetch();

stz_ce_abx
TMP = read_pc();
PC++;
TMP = set_h(TMP, read_pc());
PC++;
write(TMP+X, A);
write(TMP+X, Z);
prefetch();

stz_ce_zpg
Expand Down
54 changes: 40 additions & 14 deletions src/mame/commodore/c65.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ C=65 / C=64DX (c) 1991 Commodore
- Complete interrupts;
- F011 FDC;
- C=64 mode (with "GO64" at BASIC prompt);
- bios 0 detects an expansion RAM without checking REC first and no matter if there's
effectively a RAM bank available or not, supposed to bus error or just buggy/hardwired code?
===================================================================================================
References:
Expand Down Expand Up @@ -42,7 +44,8 @@ Hardware pics:

#define MAIN_CLOCK XTAL(28'375'160)/8

// TODO: move to own file, subclass with f018a and f018b, use device_execute_interface
// TODO: move to own file, subclass with f018a and f018b
// using device_execute_interface will tank performance, avoid it for now.
class dmagic_f018_device : public device_t
{
public:
Expand Down Expand Up @@ -74,9 +77,13 @@ class dmagic_f018_device : public device_t

dma_state_t m_state;
u32 m_src, m_dst, m_length, m_command, m_modulo;
u8 m_src_mode, m_dst_mode;
bool m_chained_transfer;

emu_timer *m_dma_timer;
void check_state(int next_cycles);
void increment_src();
void increment_dst();
};

DEFINE_DEVICE_TYPE(DMAGIC_F018, dmagic_f018_device, "dmagic_f018", "DMAgic F018 Gate Array")
Expand Down Expand Up @@ -117,6 +124,19 @@ void dmagic_f018_device::check_state(int next_cycles)
}
}

void dmagic_f018_device::increment_src()
{
const int src_dir = BIT(m_src_mode, 2) ? -1 : +1;
m_src = ((m_src + src_dir) & 0xffff) | (m_src & 0xf'0000);
}

void dmagic_f018_device::increment_dst()
{
const int dst_dir = BIT(m_dst_mode, 2) ? -1 : +1;
m_dst = ((m_dst + dst_dir) & 0xffff) | (m_dst & 0xf'0000);
}


TIMER_CALLBACK_MEMBER(dmagic_f018_device::execute_cb)
{
switch(m_state)
Expand Down Expand Up @@ -157,7 +177,10 @@ TIMER_CALLBACK_MEMBER(dmagic_f018_device::execute_cb)
m_dmalist_address = address;
m_state = (dma_state_t)(m_command & 3);

logerror("DMAgic %s %06x -> %06x %04x %02x (CHAIN=%s)\n"
m_src_mode = m_src >> 20;
m_dst_mode = m_dst >> 20;

logerror("DMAgic %s [%06x] -> [%06x] length = %04x modulo = %02x (CHAIN=%s)\n"
, dma_cmd_string[m_command & 3]
, m_src
, m_dst
Expand All @@ -167,16 +190,16 @@ TIMER_CALLBACK_MEMBER(dmagic_f018_device::execute_cb)
);

if (m_command & 0xf8)
popmessage("DMAgic unhandled command %02x", m_command);
popmessage("DMAgic: unhandled command %02x", m_command);

// x--- I/O select
// -x-- DIR
// \- decrements instead of increment, used by "LIST"
// --x- MOD
// ---x HOLD
if ((m_src & 0xf0'0000 || m_dst & 0xf0'0000) && m_length != 1)
if ((m_src_mode & 0xb || m_dst_mode & 0xb) && m_length != 1)
{
popmessage("DMAgic unhandled source %06x dst %06x length %05x", m_src, m_dst, m_length);
machine().debug_break();
popmessage("DMAgic: unhandled source %06x dst %06x length %05x", m_src, m_dst, m_length);
}

m_dma_timer->adjust(attotime::from_ticks((1), clock()));
Expand All @@ -188,8 +211,8 @@ TIMER_CALLBACK_MEMBER(dmagic_f018_device::execute_cb)
// or length == 50 (for scrolling vertical text, cfr. c64dx)
case dma_state_t::COPY: {
m_space->write_byte(m_dst & 0xf'ffff, m_space->read_byte(m_src & 0xf'ffff));
m_src = ((m_src + 1) & 0xffff) | (m_src & 0xf'0000);
m_dst = ((m_dst + 1) & 0xffff) | (m_dst & 0xf'0000);
increment_src();
increment_dst();
m_length --;
check_state(2);
break;
Expand All @@ -205,16 +228,16 @@ TIMER_CALLBACK_MEMBER(dmagic_f018_device::execute_cb)
const u8 tmp_dst = m_space->read_byte(m_dst & 0xf'ffff);
m_space->write_byte(m_src & 0xf'ffff, tmp_dst);
m_space->write_byte(m_dst & 0xf'ffff, tmp_src);
m_src = ((m_src + 1) & 0xffff) | (m_src & 0xf'0000);
m_dst = ((m_dst + 1) & 0xffff) | (m_dst & 0xf'0000);
increment_src();
increment_dst();
m_length --;
check_state(4);
break;
}

case dma_state_t::FILL:
m_space->write_byte(m_dst & 0xf'ffff, m_src & 0xff);
m_dst = ((m_dst + 1) & 0xffff) | (m_dst & 0xf'0000);
increment_dst();
m_length --;
check_state(1);
break;
Expand Down Expand Up @@ -566,15 +589,17 @@ void c65_state::cia0_portb_w(uint8_t data)

void c65_state::c65_map(address_map &map)
{
map.unmap_value_high();
map(0x00000, 0x07fff).ram().share("work_ram");
map(0x08000, 0x0bfff).rom().region("ipl", 0x08000);
map(0x0c800, 0x0cfff).rom().region("ipl", 0x0c800);
map(0x0d000, 0x0d07f).m(*this, FUNC(c65_state::vic4567_map));
// 0x0d080, 0x0d09f FDC
map(0x0d080, 0x0d09f).lr8(NAME([] (offs_t offset) { return 0; }));
// 0x0d0a0, 0x0d0ff Ram Expansion Control (REC)
map(0x0d100, 0x0d1ff).ram().w(FUNC(c65_state::PalRed_w)).share("redpal");// 0x0d100, 0x0d1ff Red Palette
map(0x0d200, 0x0d2ff).ram().w(FUNC(c65_state::PalGreen_w)).share("greenpal"); // 0x0d200, 0x0d2ff Green Palette
map(0x0d300, 0x0d3ff).ram().w(FUNC(c65_state::PalBlue_w)).share("bluepal"); // 0x0d300, 0x0d3ff Blue Palette
map(0x0d100, 0x0d1ff).ram().w(FUNC(c65_state::PalRed_w)).share("redpal");
map(0x0d200, 0x0d2ff).ram().w(FUNC(c65_state::PalGreen_w)).share("greenpal");
map(0x0d300, 0x0d3ff).ram().w(FUNC(c65_state::PalBlue_w)).share("bluepal");
// 0x0d400, 0x0d4*f Right SID
// keyboard hold left shift will read to $d484 (?)
map(0x0d400, 0x0d41f).mirror(0x80).rw(m_sid[1], FUNC(mos6581_device::read), FUNC(mos6581_device::write));
Expand Down Expand Up @@ -602,6 +627,7 @@ void c65_state::c65_map(address_map &map)
map(0x20000, 0x3ffff).rom().region("ipl", 0);
// 0x40000, 0x7ffff cart expansion
// 0x80000, 0xfffff RAM expansion
// map(0x80000, 0xfffff).ram();
}


Expand Down
Loading

0 comments on commit 53f2b70

Please sign in to comment.