mirror of
https://github.com/holub/mame
synced 2025-06-04 11:56:28 +03:00
cpu/z80: Improved timing within instructions. (#9449)
This allows improved emulation of bus contention in the ZX Spectrum family. Also updated Z80 timings for MSX, Amstrad CPC, and Sega System 1/System 2.
This commit is contained in:
parent
d7cfc3c187
commit
44dae68dbb
File diff suppressed because it is too large
Load Diff
@ -38,6 +38,7 @@ public:
|
||||
template <typename... T> void set_io_map(T &&... args) { set_addrmap(AS_IO, std::forward<T>(args)...); }
|
||||
auto irqack_cb() { return m_irqack_cb.bind(); }
|
||||
auto refresh_cb() { return m_refresh_cb.bind(); }
|
||||
auto nomreq_cb() { return m_nomreq_cb.bind(); }
|
||||
auto halt_cb() { return m_halt_cb.bind(); }
|
||||
|
||||
protected:
|
||||
@ -149,9 +150,11 @@ protected:
|
||||
uint8_t in(uint16_t port);
|
||||
void out(uint16_t port, uint8_t value);
|
||||
virtual uint8_t rm(uint16_t addr);
|
||||
uint8_t rm_reg(uint16_t addr);
|
||||
void rm16(uint16_t addr, PAIR &r);
|
||||
virtual void wm(uint16_t addr, uint8_t value);
|
||||
void wm16(uint16_t addr, PAIR &r);
|
||||
void wm16back(uint16_t addr, PAIR &r);
|
||||
virtual uint8_t rop();
|
||||
virtual uint8_t arg();
|
||||
virtual uint16_t arg16();
|
||||
@ -232,6 +235,8 @@ protected:
|
||||
virtual void check_interrupts();
|
||||
void take_interrupt();
|
||||
void take_nmi();
|
||||
void nomreq_ir(s8 cycles);
|
||||
void nomreq_addr(u16 addr, s8 cycles);
|
||||
|
||||
// address spaces
|
||||
const address_space_config m_program_config;
|
||||
@ -244,22 +249,23 @@ protected:
|
||||
|
||||
devcb_write_line m_irqack_cb;
|
||||
devcb_write8 m_refresh_cb;
|
||||
devcb_write8 m_nomreq_cb;
|
||||
devcb_write_line m_halt_cb;
|
||||
|
||||
PAIR m_prvpc;
|
||||
PAIR m_pc;
|
||||
PAIR m_sp;
|
||||
PAIR m_af;
|
||||
PAIR m_bc;
|
||||
PAIR m_de;
|
||||
PAIR m_hl;
|
||||
PAIR m_ix;
|
||||
PAIR m_iy;
|
||||
PAIR m_wz;
|
||||
PAIR m_af2;
|
||||
PAIR m_bc2;
|
||||
PAIR m_de2;
|
||||
PAIR m_hl2;
|
||||
PAIR m_prvpc;
|
||||
PAIR m_pc;
|
||||
PAIR m_sp;
|
||||
PAIR m_af;
|
||||
PAIR m_bc;
|
||||
PAIR m_de;
|
||||
PAIR m_hl;
|
||||
PAIR m_ix;
|
||||
PAIR m_iy;
|
||||
PAIR m_wz;
|
||||
PAIR m_af2;
|
||||
PAIR m_bc2;
|
||||
PAIR m_de2;
|
||||
PAIR m_hl2;
|
||||
uint8_t m_r;
|
||||
uint8_t m_r2;
|
||||
uint8_t m_iff1;
|
||||
@ -270,13 +276,14 @@ protected:
|
||||
uint8_t m_nmi_state; /* nmi line state */
|
||||
uint8_t m_nmi_pending; /* nmi pending */
|
||||
uint8_t m_irq_state; /* irq line state */
|
||||
int m_wait_state; // wait line state
|
||||
int m_busrq_state; // bus request line state
|
||||
int m_wait_state; // wait line state
|
||||
int m_busrq_state; // bus request line state
|
||||
uint8_t m_after_ei; /* are we in the EI shadow? */
|
||||
uint8_t m_after_ldair; /* same, but for LD A,I or LD A,R */
|
||||
uint32_t m_ea;
|
||||
|
||||
int m_icount;
|
||||
int m_icount;
|
||||
int m_icount_executing;
|
||||
uint8_t m_rtemp;
|
||||
const uint8_t * m_cc_op;
|
||||
const uint8_t * m_cc_cb;
|
||||
|
@ -118,13 +118,12 @@ void pentagon_state::pentagon_scr2_w(offs_t offset, uint8_t data)
|
||||
|
||||
rectangle pentagon_state::get_screen_area()
|
||||
{
|
||||
//TODO Possible because of incorrect z80 we have to adjust x+1 to make AccrossTheEdge look nicer
|
||||
return rectangle{137, 137 + 255, 80, 80 + 191};
|
||||
return rectangle{136, 136 + 255, 80, 80 + 191};
|
||||
}
|
||||
|
||||
INTERRUPT_GEN_MEMBER(pentagon_state::pentagon_interrupt)
|
||||
{
|
||||
timer_set(m_screen->time_until_pos(0) - m_maincpu->clocks_to_attotime(1), TIMER_IRQ_ON, 0);
|
||||
timer_set(m_screen->time_until_pos(0) + /*???*/ m_maincpu->clocks_to_attotime(3), TIMER_IRQ_ON, 0);
|
||||
}
|
||||
|
||||
uint8_t pentagon_state::beta_neutral_r(offs_t offset)
|
||||
|
@ -165,6 +165,13 @@ resulting mess can be seen in the F4 viewer display.
|
||||
/****************************************************************************************************/
|
||||
/* Spectrum 128 specific functions */
|
||||
|
||||
void spectrum_128_state::video_start()
|
||||
{
|
||||
m_frame_invert_count = 16;
|
||||
m_screen_location = m_ram->pointer() + (5 << 14);
|
||||
m_contention_pattern = {1, 0, 7, 6, 5, 4, 3, 2};
|
||||
}
|
||||
|
||||
uint8_t spectrum_128_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
|
||||
{
|
||||
/* this allows expansion devices to act upon opcode fetches from MEM addresses
|
||||
@ -172,6 +179,7 @@ uint8_t spectrum_128_state::spectrum_128_pre_opcode_fetch_r(offs_t offset)
|
||||
enable paged ROM and then fetches at 0700 to disable it
|
||||
*/
|
||||
m_exp->pre_opcode_fetch(offset);
|
||||
if (is_contended(offset)) content_early();
|
||||
uint8_t retval = m_maincpu->space(AS_PROGRAM).read_byte(offset);
|
||||
m_exp->post_opcode_fetch(offset);
|
||||
return retval;
|
||||
@ -291,6 +299,18 @@ void spectrum_128_state::machine_reset()
|
||||
spectrum_128_update_memory();
|
||||
}
|
||||
|
||||
bool spectrum_128_state::is_vram_write(offs_t offset) {
|
||||
// TODO respect banks 2,5 mapped to 0xc000
|
||||
return (BIT(m_port_7ffd_data, 3))
|
||||
? offset >= 0x8000 && offset < 0x9b00
|
||||
: spectrum_state::is_vram_write(offset);
|
||||
}
|
||||
|
||||
bool spectrum_128_state::is_contended(offs_t offset) {
|
||||
// TODO Unlike the base 128K machine, RAM banks 4, 5, 6 and 7 are contended.
|
||||
return spectrum_state::is_contended(offset);// || (offset >= 0x8000 && offset < 0xc000);
|
||||
}
|
||||
|
||||
static const gfx_layout spectrum_charlayout =
|
||||
{
|
||||
8, 8, /* 8 x 8 characters */
|
||||
|
@ -293,6 +293,8 @@ SamRam
|
||||
|
||||
uint8_t spectrum_state::pre_opcode_fetch_r(offs_t offset)
|
||||
{
|
||||
if (is_contended(offset)) content_early();
|
||||
|
||||
/* this allows expansion devices to act upon opcode fetches from MEM addresses
|
||||
for example, interface1 detection fetches requires fetches at 0008 / 0708 to
|
||||
enable paged ROM and then fetches at 0700 to disable it
|
||||
@ -305,6 +307,8 @@ uint8_t spectrum_state::pre_opcode_fetch_r(offs_t offset)
|
||||
|
||||
uint8_t spectrum_state::spectrum_data_r(offs_t offset)
|
||||
{
|
||||
if (is_contended(offset)) content_early();
|
||||
|
||||
m_exp->pre_data_fetch(offset);
|
||||
uint8_t retval = m_specmem->space(AS_PROGRAM).read_byte(offset);
|
||||
m_exp->post_data_fetch(offset);
|
||||
@ -313,6 +317,9 @@ uint8_t spectrum_state::spectrum_data_r(offs_t offset)
|
||||
|
||||
void spectrum_state::spectrum_data_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
if (is_contended(offset)) content_early();
|
||||
if (is_vram_write(offset)) m_screen->update_now();
|
||||
|
||||
m_specmem->space(AS_PROGRAM).write_byte(offset,data);
|
||||
}
|
||||
|
||||
@ -341,6 +348,9 @@ uint8_t spectrum_state::spectrum_rom_r(offs_t offset)
|
||||
*/
|
||||
void spectrum_state::spectrum_ula_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
if (is_contended(offset)) content_early();
|
||||
content_early(1);
|
||||
|
||||
unsigned char Changed = m_port_fe_data^data;
|
||||
|
||||
/* border colour changed? */
|
||||
@ -363,11 +373,13 @@ void spectrum_state::spectrum_ula_w(offs_t offset, uint8_t data)
|
||||
m_port_fe_data = data;
|
||||
}
|
||||
|
||||
|
||||
/* KT: more accurate keyboard reading */
|
||||
/* DJR: Spectrum+ keys added */
|
||||
uint8_t spectrum_state::spectrum_ula_r(offs_t offset)
|
||||
{
|
||||
if (is_contended(offset)) content_early();
|
||||
content_early(1);
|
||||
|
||||
int lines = offset >> 8;
|
||||
int data = 0xff;
|
||||
|
||||
@ -443,6 +455,12 @@ uint8_t spectrum_state::spectrum_ula_r(offs_t offset)
|
||||
|
||||
void spectrum_state::spectrum_port_w(offs_t offset, uint8_t data)
|
||||
{
|
||||
if (is_contended(offset))
|
||||
{
|
||||
content_early();
|
||||
content_late();
|
||||
}
|
||||
|
||||
// Pass through to expansion device if present
|
||||
if (m_exp->get_card_device())
|
||||
m_exp->iorq_w(offset | 1, data);
|
||||
@ -450,6 +468,12 @@ void spectrum_state::spectrum_port_w(offs_t offset, uint8_t data)
|
||||
|
||||
uint8_t spectrum_state::spectrum_port_r(offs_t offset)
|
||||
{
|
||||
if (is_contended(offset))
|
||||
{
|
||||
content_early();
|
||||
content_late();
|
||||
}
|
||||
|
||||
// Pass through to expansion device if present
|
||||
if (m_exp->get_card_device())
|
||||
return m_exp->iorq_r(offset | 1);
|
||||
@ -745,19 +769,11 @@ void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
case TIMER_IRQ_ON:
|
||||
m_maincpu->set_input_line(0, HOLD_LINE);
|
||||
timer_set(m_maincpu->clocks_to_attotime(32), TIMER_IRQ_OFF, 0);
|
||||
m_irq_start_cycle = m_maincpu->total_cycles();
|
||||
break;
|
||||
case TIMER_IRQ_OFF:
|
||||
m_maincpu->set_input_line(0, CLEAR_LINE);
|
||||
break;
|
||||
case TIMER_SCANLINE:
|
||||
{
|
||||
auto vpos_next = m_screen->vpos() + 1;
|
||||
if(vpos_next <= get_screen_area().bottom()) {
|
||||
m_scanline_timer->adjust(m_screen->time_until_pos(vpos_next), get_screen_area().left());
|
||||
m_screen->update_now();
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw emu_fatalerror("Unknown id in spectrum_state::device_timer");
|
||||
}
|
||||
@ -765,14 +781,7 @@ void spectrum_state::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
|
||||
INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt)
|
||||
{
|
||||
timer_set(m_screen->time_until_pos(0), TIMER_IRQ_ON, 0);
|
||||
|
||||
/* Default implementation performs screen updates per scanline. Some other
|
||||
clones e.g. pentagon do updates based on video_ram access, border updates,
|
||||
and full frame refresh (for attributes flashing). Such clones may define own
|
||||
*_interrupt config. */
|
||||
if (m_scanline_timer != nullptr)
|
||||
m_scanline_timer->adjust(m_screen->time_until_pos(get_screen_area().top() + 1));
|
||||
timer_set(m_screen->time_until_pos(0, get_screen_area().left()), TIMER_IRQ_ON, 0);
|
||||
}
|
||||
|
||||
void spectrum_state::spectrum_common(machine_config &config)
|
||||
@ -783,6 +792,7 @@ void spectrum_state::spectrum_common(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_OPCODES, &spectrum_state::spectrum_data);
|
||||
m_maincpu->set_addrmap(AS_IO, &spectrum_state::spectrum_io);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(spectrum_state::spec_interrupt));
|
||||
m_maincpu->nomreq_cb().set(FUNC(spectrum_state::spectrum_nomreq));
|
||||
|
||||
ADDRESS_MAP_BANK(config, m_specmem).set_map(&spectrum_state::spectrum_map).set_options(ENDIANNESS_LITTLE, 8, 16, 0x10000);
|
||||
|
||||
@ -911,8 +921,10 @@ ROM_START(spectrum)
|
||||
ROMX_LOAD("diagrom.v50",0x0000,0x4000, CRC(054a2d6a) SHA1(2fa6f3b31d7bb610df78be5c4c80537cf6e5911d), ROM_BIOS(26))
|
||||
ROM_SYSTEM_BIOS(27, "diagv51", "DiagROM v1.51")
|
||||
ROMX_LOAD("diagrom.v51",0x0000,0x4000, CRC(83034df6) SHA1(e57b2c8a8e3563ea02a20eecd1d4cb6be9f9c2df), ROM_BIOS(27))
|
||||
ROM_SYSTEM_BIOS(28, "alford37", "Brian Alford's Test ROM v0.37")
|
||||
ROMX_LOAD("testromv037.bin", 0x0000,0x4000, CRC(a7ea3d1c) SHA1(f699b73abfb1ab53c063ac02ac6283705864c734), ROM_BIOS(28))
|
||||
ROM_SYSTEM_BIOS(28, "diagv56", "DiagROM v1.56")
|
||||
ROMX_LOAD("diagrom.v56",0x0000,0x4000, CRC(0ed22f7a) SHA1(37caf0bbc2d023ca5afaa12b3856ac90dbc83c51), ROM_BIOS(28))
|
||||
ROM_SYSTEM_BIOS(29, "alford37", "Brian Alford's Test ROM v0.37")
|
||||
ROMX_LOAD("testromv037.bin", 0x0000,0x4000, CRC(a7ea3d1c) SHA1(f699b73abfb1ab53c063ac02ac6283705864c734), ROM_BIOS(29))
|
||||
ROM_END
|
||||
|
||||
ROM_START(specide)
|
||||
|
@ -349,86 +349,86 @@ static const u8 cc_op[0x100] = {
|
||||
4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 7*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 7*5+1*2, 4*5+1*2,
|
||||
4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 7*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 7*5+1*2, 4*5+1*2,
|
||||
4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 7*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 7*5+1*2, 4*5+1*2,
|
||||
5*5+1*2,10*5+1*2,10*5+3*2,10*5+3*2,10*5+3*2,11*5+1*2, 7*5+2*2,11*5+1*2, 5*5+1*2,10*5+1*2,10*5+3*2, 0*5 ,10*5+3*2,17*5+3*2, 7*5+2*2,11*5+1*2,
|
||||
5*5+1*2,10*5+1*2,10*5+3*2,11*5+2*2,10*5+3*2,11*5+1*2, 7*5+2*2,11*5+1*2, 5*5+1*2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*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2, 4*5+1*2,15*5+2*2, 4*5+1*2,
|
||||
5*5+1*2,10*5+1*2,10*5+3*2,10*5+3*2,10*5+3*2,11*5+1*2, 7*5+2*2,11*5+1*2, 5*5+1*2,10*5+1*2,10*5+3*2, 7*5+1*2,10*5+3*2,17*5+3*2, 7*5+2*2,11*5+1*2,
|
||||
5*5+1*2,10*5+1*2,10*5+3*2,11*5+2*2,10*5+3*2,11*5+1*2, 7*5+2*2,11*5+1*2, 5*5+1*2, 4*5+1*2,10*5+3*2,11*5+2*2,10*5+3*2, 4*5+1*2, 7*5+2*2,11*5+1*2,
|
||||
5*5+1*2,10*5+1*2,10*5+3*2,19*5+1*2,10*5+3*2,11*5+1*2, 7*5+2*2,11*5+1*2, 5*5+1*2, 4*5+1*2,10*5+3*2, 4*5+1*2,10*5+3*2, 4*5+1*2, 7*5+2*2,11*5+1*2,
|
||||
5*5+1*2,10*5+1*2,10*5+3*2, 4*5+1*2,10*5+3*2,11*5+1*2, 7*5+2*2,11*5+1*2, 5*5+1*2, 6*5+1*2,10*5+3*2, 4*5+1*2,10*5+3*2, 4*5+1*2, 7*5+2*2,11*5+1*2
|
||||
};
|
||||
|
||||
static const u8 cc_xycb[0x100] = {
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
|
||||
20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
|
||||
20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
|
||||
20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,20*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,
|
||||
23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2,23*5+4*2
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
|
||||
9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
|
||||
9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
|
||||
9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5, 9*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,
|
||||
12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5,12*5
|
||||
};
|
||||
|
||||
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
|
||||
@ -451,7 +451,6 @@ static const u8 cc_ex[0x100] = {
|
||||
6*5, 0*5, 0*5, 0*5, 7*5, 0*5, 0*5, 2*5, 6*5, 0*5, 0*5, 0*5, 7*5, 0*5, 0*5, 2*5
|
||||
};
|
||||
|
||||
|
||||
void system1_state::machine_start()
|
||||
{
|
||||
const u32 numbanks = (m_maincpu_region->bytes() - 0x10000) / 0x4000;
|
||||
|
@ -185,7 +185,7 @@ GFXDECODE_END
|
||||
void tsconf_state::video_start()
|
||||
{
|
||||
spectrum_128_state::video_start();
|
||||
m_scanline_timer->reset();
|
||||
m_contention_pattern = {}; // disable inherited contention
|
||||
|
||||
m_ts_tilemap[TM_TS_CHAR] = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(*this, FUNC(tsconf_state::get_tile_info_txt)), TILEMAP_SCAN_ROWS, 8, 8, 128, 64);
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "sound/spkrdev.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "cpu/z80/z80.h"
|
||||
|
||||
/* Spectrum crystals */
|
||||
|
||||
@ -98,8 +99,7 @@ protected:
|
||||
enum
|
||||
{
|
||||
TIMER_IRQ_ON,
|
||||
TIMER_IRQ_OFF,
|
||||
TIMER_SCANLINE // tsconf assumes it last know. if need more add above or fix references in clones
|
||||
TIMER_IRQ_OFF // tsconf assumes it last know. if need more add above or fix references in clones
|
||||
};
|
||||
|
||||
int m_port_fe_data;
|
||||
@ -114,11 +114,7 @@ protected:
|
||||
uint8_t *m_screen_location;
|
||||
|
||||
int m_ROMSelection;
|
||||
|
||||
// Build up the screen bitmap line-by-line as the z80 uses CPU cycles.
|
||||
// Eliminates sprite flicker on various games (E.g. Marauder and
|
||||
// Stormlord) and makes Firefly playable.
|
||||
emu_timer *m_scanline_timer;
|
||||
std::vector<u8> m_contention_pattern;
|
||||
|
||||
uint8_t m_ram_disabled_by_beta;
|
||||
uint8_t pre_opcode_fetch_r(offs_t offset);
|
||||
@ -126,7 +122,12 @@ protected:
|
||||
uint8_t spectrum_rom_r(offs_t offset);
|
||||
uint8_t spectrum_data_r(offs_t offset);
|
||||
void spectrum_data_w(offs_t offset, uint8_t data);
|
||||
virtual bool is_contended(offs_t offset);
|
||||
virtual bool is_vram_write(offs_t offset);
|
||||
void content_early(s8 shift = 0);
|
||||
void content_late();
|
||||
|
||||
void spectrum_nomreq(offs_t offset, uint8_t data);
|
||||
void spectrum_ula_w(offs_t offset, uint8_t data);
|
||||
uint8_t spectrum_ula_r(offs_t offset);
|
||||
void spectrum_port_w(offs_t offset, uint8_t data);
|
||||
@ -141,7 +142,7 @@ protected:
|
||||
DECLARE_SNAPSHOT_LOAD_MEMBER(snapshot_cb);
|
||||
DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
required_device<z80_device> m_maincpu;
|
||||
required_device<screen_device> m_screen;
|
||||
|
||||
void spectrum_io(address_map &map);
|
||||
@ -179,6 +180,7 @@ protected:
|
||||
optional_ioport m_io_joy1;
|
||||
optional_ioport m_io_joy2;
|
||||
|
||||
u64 m_irq_start_cycle;
|
||||
virtual u8 get_border_color(u16 hpos = ~0, u16 vpos = ~0);
|
||||
// Defines position of main screen excluding border
|
||||
virtual rectangle get_screen_area();
|
||||
@ -226,6 +228,9 @@ protected:
|
||||
virtual void spectrum_128_update_memory() override;
|
||||
virtual rectangle get_screen_area() override;
|
||||
|
||||
virtual bool is_contended(offs_t offset) override;
|
||||
virtual bool is_vram_write(offs_t offset) override;
|
||||
|
||||
private:
|
||||
uint8_t spectrum_128_pre_opcode_fetch_r(offs_t offset);
|
||||
void spectrum_128_bank1_w(offs_t offset, uint8_t data);
|
||||
|
@ -51,7 +51,7 @@ protected:
|
||||
private:
|
||||
enum timer_id : u8
|
||||
{
|
||||
TIMER_IRQ_FRAME = TIMER_SCANLINE + 1,
|
||||
TIMER_IRQ_FRAME = TIMER_IRQ_OFF + 1,
|
||||
TIMER_IRQ_SCANLINE
|
||||
};
|
||||
|
||||
|
@ -2787,122 +2787,121 @@ IRQ_CALLBACK_MEMBER(amstrad_state::amstrad_cpu_acknowledge_int)
|
||||
|
||||
/* the following timings have been measured! */
|
||||
static const uint8_t amstrad_cycle_table_op[256] = {
|
||||
4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4,
|
||||
4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4,
|
||||
12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4,
|
||||
8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4,
|
||||
8, 12, 16, 8, 12, 12, 12, 4, 8, 12, 16, 8, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
8, 8, 8, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16,
|
||||
8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16,
|
||||
8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16
|
||||
8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4,
|
||||
8, 12, 16, 8, 12, 12, 12, 4, 8, 12, 16, 8, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
8, 8, 8, 8, 8, 8, 4, 8, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 4, 4, 8, 4,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16,
|
||||
8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16,
|
||||
8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16
|
||||
};
|
||||
|
||||
static const uint8_t amstrad_cycle_table_cb[256]=
|
||||
{
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 8, 4, 4, 4, 4, 4, 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, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4,
|
||||
4, 4, 4, 4, 4, 4, 12, 4, 4, 4, 4, 4, 4, 4, 12, 4
|
||||
};
|
||||
|
||||
static const uint8_t amstrad_cycle_table_ed[256]=
|
||||
{
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
12, 12, 12, 20, 4, 12, 4, 8, 12, 12, 12, 20, 4, 12, 4, 8,
|
||||
12, 12, 12, 20, 4, 12, 4, 8, 12, 12, 12, 20, 4, 12, 4, 8,
|
||||
12, 12, 12, 20, 4, 12, 4, 16, 12, 12, 12, 20, 4, 12, 4, 16,
|
||||
12, 12, 12, 20, 4, 12, 4, 4, 12, 12, 12, 20, 4, 12, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
16, 12, 16, 16, 4, 4, 4, 4, 16, 12, 16, 16, 4, 4, 4, 4,
|
||||
16, 12, 16, 16, 4, 4, 4, 4, 16, 12, 16, 16, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
|
||||
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
|
||||
};
|
||||
|
||||
static const uint8_t amstrad_cycle_table_xy[256]=
|
||||
{
|
||||
4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4,
|
||||
4, 12, 8, 8, 4, 4, 8, 4, 4, 12, 8, 8, 4, 4, 8, 4,
|
||||
12, 12, 8, 8, 4, 4, 8, 4, 12, 12, 8, 8, 4, 4, 8, 4,
|
||||
8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4,
|
||||
8, 12, 16, 8, 20, 20, 20, 4, 8, 12, 16, 8, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
8, 12, 20, 8, 4, 4, 8, 4, 8, 12, 20, 8, 4, 4, 8, 4,
|
||||
8, 12, 16, 8, 20, 20, 20, 4, 8, 12, 16, 8, 4, 4, 8, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
16, 16, 16, 16, 16, 16, 4, 16, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 4, 12, 20, 8, 16,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16,
|
||||
8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16,
|
||||
8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
4, 4, 4, 4, 4, 4, 16, 4, 4, 4, 4, 4, 4, 4, 16, 4,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 12, 12, 8, 12, 20, 8, 16,
|
||||
8, 12, 12, 12, 12, 16, 8, 16, 8, 4, 12, 12, 12, 4, 8, 16,
|
||||
8, 12, 12, 24, 12, 16, 8, 16, 8, 4, 12, 4, 12, 4, 8, 16,
|
||||
8, 12, 12, 4, 12, 16, 8, 16, 8, 8, 12, 4, 12, 4, 8, 16
|
||||
};
|
||||
|
||||
static const uint8_t amstrad_cycle_table_xycb[256]=
|
||||
{
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20
|
||||
static const uint8_t amstrad_cycle_table_xycb[0x100] = {
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
|
||||
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
|
||||
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
|
||||
12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
|
||||
16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16
|
||||
};
|
||||
|
||||
static const uint8_t amstrad_cycle_table_ex[256]=
|
||||
{
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|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 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
4, 8, 4, 4, 0, 0, 0, 0, 4, 8, 4, 4, 0, 0, 0, 0,
|
||||
8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0,
|
||||
8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0,
|
||||
8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0,
|
||||
8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 8, 0, 0, 0
|
||||
};
|
||||
|
||||
#define NEXT_ROM_SLOT m_rom_count++; \
|
||||
|
@ -43,7 +43,9 @@ void msx2_state::machine_start()
|
||||
save_item(NAME(m_rtc_latch));
|
||||
}
|
||||
|
||||
|
||||
/* A hack to add 1 wait cycle in each opcode fetch.
|
||||
Possibly worth not to use custom table at all but adjust desired icount
|
||||
directly in m_opcodes.read_byte handler. */
|
||||
static const uint8_t cc_op[0x100] = {
|
||||
4+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1, 4+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,
|
||||
8+1,10+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,12+1,11+1, 7+1, 6+1, 4+1, 4+1, 7+1, 4+1,
|
||||
@ -57,86 +59,67 @@ static const uint8_t cc_op[0x100] = {
|
||||
4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1,
|
||||
4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1,
|
||||
4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 4+1, 7+1, 4+1,
|
||||
5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 0 ,10+1,17+1, 7+1,11+1,
|
||||
5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 0 , 7+1,11+1,
|
||||
5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 0 , 7+1,11+1,
|
||||
5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 0 , 7+1,11+1
|
||||
5+1,10+1,10+1,10+1,10+1,11+1, 7+1,11+1, 5+1,10+1,10+1, 4+1,10+1,17+1, 7+1,11+1,
|
||||
5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 4+1, 7+1,11+1,
|
||||
5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 4+1, 7+1,11+1,
|
||||
5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 4+1, 7+1,11+1
|
||||
};
|
||||
|
||||
static const uint8_t cc_cb[0x100] = {
|
||||
8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2, 8+2,15+2, 8+2,
|
||||
8+2, 8+2, 8+2, 8+2, 8+2, 8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+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2,
|
||||
4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2,
|
||||
4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2,
|
||||
4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2, 4+4+2,19 +2, 4+4+2,
|
||||
5+4+2,10+4+2,10+4+2,10+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2,10+4+2,10+4+2, 0 ,10+4+2,17+4+2, 7+4+2,11+4+2,
|
||||
5+4+2,10+4+2,10+4+2,11+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 4+4+2,10+4+2,11+4+2,10+4+2, 4 +1, 7+4+2,11+4+2,
|
||||
5+4+2,10+4+2,10+4+2,19+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 4+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2,
|
||||
5+4+2,10+4+2,10+4+2, 4+4+2,10+4+2,11+4+2, 7+4+2,11+4+2, 5+4+2, 6+4+2,10+4+2, 4+4+2,10+4+2, 4 +1, 7+4+2,11+4+2
|
||||
};
|
||||
|
||||
static const uint8_t cc_xycb[0x100] = {
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
|
||||
20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
|
||||
20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
|
||||
20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,20+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,
|
||||
23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2,23+2
|
||||
4+1,10+1, 7+1, 6+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1, 7+1,11+1,
|
||||
5+1,10+1,10+1,11+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1,11+1,10+1, 4+1, 7+1,11+1,
|
||||
5+1,10+1,10+1,19+1,10+1,11+1, 7+1,11+1, 5+1, 4+1,10+1, 4+1,10+1, 4+1, 7+1,11+1,
|
||||
5+1,10+1,10+1, 4+1,10+1,11+1, 7+1,11+1, 5+1, 6+1,10+1, 4+1,10+1, 4+1, 7+1,11+1
|
||||
};
|
||||
|
||||
/* extra cycles if jr/jp/call taken and 'interrupt latency' on rst 0-7 */
|
||||
@ -159,14 +142,13 @@ static const uint8_t cc_ex[0x100] = {
|
||||
6, 0, 0, 0, 7, 0, 0, 2, 6, 0, 0, 0, 7, 0, 0, 2+1
|
||||
};
|
||||
|
||||
|
||||
void msx_state::driver_start()
|
||||
{
|
||||
m_maincpu->set_input_line_vector(0, 0xff); // Z80
|
||||
|
||||
msx_memory_init();
|
||||
|
||||
m_maincpu->z80_set_cycle_tables( cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex );
|
||||
m_maincpu->z80_set_cycle_tables(cc_op, cc_cb, cc_ed, cc_xy, nullptr, cc_ex);
|
||||
|
||||
save_item(NAME(m_psg_b));
|
||||
save_item(NAME(m_mouse));
|
||||
|
@ -26,14 +26,7 @@ void spectrum_state::video_start()
|
||||
{
|
||||
m_frame_invert_count = 16;
|
||||
m_screen_location = m_video_ram;
|
||||
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
|
||||
}
|
||||
|
||||
void spectrum_128_state::video_start()
|
||||
{
|
||||
m_frame_invert_count = 16;
|
||||
m_screen_location = m_ram->pointer() + (5 << 14);
|
||||
m_scanline_timer = timer_alloc(TIMER_SCANLINE);
|
||||
m_contention_pattern = {6, 5, 4, 3, 2, 1, 0, 0};
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -124,11 +117,23 @@ u32 spectrum_state::screen_update_spectrum(screen_device &screen, bitmap_ind16 &
|
||||
|
||||
void spectrum_state::spectrum_update_border(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &border)
|
||||
{
|
||||
u8 mod = m_contention_pattern.empty() ? 1 : m_contention_pattern.size();
|
||||
for (auto y = border.top(); y <= border.bottom(); y++)
|
||||
{
|
||||
u16 *pix = &(bitmap.pix(y, border.left()));
|
||||
for (auto x = border.left(); x <= border.right(); x++)
|
||||
*pix++ = get_border_color(y, x);
|
||||
for (auto x = border.left(); x <= border.right(); )
|
||||
{
|
||||
if (x % mod == 0)
|
||||
{
|
||||
for (auto m = 0; m < mod; m++, x++)
|
||||
*pix++ = get_border_color(y, x);
|
||||
}
|
||||
else
|
||||
{
|
||||
pix++;
|
||||
x++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,6 +145,12 @@ void spectrum_state::spectrum_update_screen(screen_device &screen_d, bitmap_ind1
|
||||
{
|
||||
u16 hpos = screen.left();
|
||||
u16 x = hpos - get_screen_area().left();
|
||||
if (x % 8)
|
||||
{
|
||||
u8 shift = 8 - (x % 8);
|
||||
x += shift;
|
||||
hpos += shift;
|
||||
}
|
||||
u16 y = vpos - get_screen_area().top();
|
||||
u8 *scr = &m_screen_location[((y & 7) << 8) | ((y & 0x38) << 2) | ((y & 0xc0) << 5) | (x >> 3)];
|
||||
u8 *attr = &attrs_location[((y & 0xf8) << 2) | (x >> 3)];
|
||||
@ -150,10 +161,63 @@ void spectrum_state::spectrum_update_screen(screen_device &screen_d, bitmap_ind1
|
||||
u16 pap = (*attr >> 3) & 0x0f;
|
||||
u8 pix8 = (invert_attrs && (*attr & 0x80)) ? ~*scr : *scr;
|
||||
|
||||
for (u8 b = 0x80 >> (x & 0x07); b != 0 && hpos <= screen.right(); b >>= 1, x++, hpos++)
|
||||
for (u8 b = 0x80; b; b >>= 1, x++, hpos++)
|
||||
*pix++ = (pix8 & b) ? ink : pap;
|
||||
scr++;
|
||||
attr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool spectrum_state::is_vram_write(offs_t offset) {
|
||||
return offset >= 0x4000 && offset < 0x5b00;
|
||||
}
|
||||
|
||||
bool spectrum_state::is_contended(offs_t offset) {
|
||||
return offset >= 0x4000 && offset < 0x8000;
|
||||
}
|
||||
|
||||
void spectrum_state::content_early(s8 shift)
|
||||
{
|
||||
u64 vpos = m_screen->vpos();
|
||||
if (m_contention_pattern.empty() || vpos < get_screen_area().top() || vpos > get_screen_area().bottom())
|
||||
return;
|
||||
|
||||
u64 now = m_maincpu->total_cycles() - m_irq_start_cycle + shift;
|
||||
u64 cf = vpos * m_screen->width() * m_maincpu->clock() / m_screen->clock() - 1;
|
||||
u64 ct = cf + get_screen_area().width() * m_maincpu->clock() / m_screen->clock();
|
||||
|
||||
if(cf <= now && now < ct)
|
||||
{
|
||||
u64 clocks = now - cf;
|
||||
u8 c = m_contention_pattern[clocks % m_contention_pattern.size()];
|
||||
m_maincpu->adjust_icount(-c);
|
||||
}
|
||||
}
|
||||
|
||||
void spectrum_state::content_late()
|
||||
{
|
||||
u64 vpos = m_screen->vpos();
|
||||
if (m_contention_pattern.empty() || vpos < get_screen_area().top() || vpos > get_screen_area().bottom())
|
||||
return;
|
||||
|
||||
u64 now = m_maincpu->total_cycles() - m_irq_start_cycle + 1;
|
||||
u64 cf = vpos * m_screen->width() * m_maincpu->clock() / m_screen->clock() - 1;
|
||||
u64 ct = cf + get_screen_area().width() * m_maincpu->clock() / m_screen->clock();
|
||||
for(auto i = 0x04; i; i >>= 1)
|
||||
{
|
||||
if(cf <= now && now < ct)
|
||||
{
|
||||
u64 clocks = now - cf;
|
||||
u8 c = m_contention_pattern[clocks % m_contention_pattern.size()];
|
||||
m_maincpu->adjust_icount(-c);
|
||||
now += c;
|
||||
}
|
||||
now++;
|
||||
}
|
||||
}
|
||||
|
||||
void spectrum_state::spectrum_nomreq(offs_t offset, uint8_t data)
|
||||
{
|
||||
if (is_contended(offset)) content_early();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user