summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2012-09-05 22:32:08 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2012-09-05 22:32:08 +0000
commit47c42009c7548eaeb50442c4588920eb5eef3f77 (patch)
treec6f66a6a8a0400b7947add067c38c676a35c5a7f
parent3adb0fd55c0c13306c7d61f3898979317eb9bf0f (diff)
Various changes, nw
-rw-r--r--src/mess/drivers/mz2000.c84
1 files changed, 66 insertions, 18 deletions
diff --git a/src/mess/drivers/mz2000.c b/src/mess/drivers/mz2000.c
index 13399452da8..d352f712b00 100644
--- a/src/mess/drivers/mz2000.c
+++ b/src/mess/drivers/mz2000.c
@@ -8,8 +8,10 @@
Basically a simpler version of Sharp MZ-2500
TODO:
- - cassette interface;
+ - cassette interface, basically any program that's bigger than 8kb fails to load;
- implement remaining video capabilities
+ - add 80b compatibility support;
+ - Vosque (color): keyboard doesn't work properly;
****************************************************************************/
@@ -29,6 +31,7 @@
#include "formats/basicdsk.h"
#include "formats/mz_cas.h"
+#define MASTER_CLOCK XTAL_17_73447MHz/5 /* TODO: was 4 MHz, but otherwise cassette won't work due of a bug with MZF support ... */
class mz2000_state : public driver_device
@@ -46,7 +49,7 @@ public:
UINT8 m_gvram_enable;
UINT8 m_gvram_bank;
- UINT8 m_key_mux,m_pio_latchb;
+ UINT8 m_key_mux;
UINT8 m_old_portc;
UINT8 m_width80;
@@ -56,6 +59,9 @@ public:
UINT8 m_color_mode;
UINT8 m_has_fdc;
UINT8 m_hi_mode;
+
+ UINT8 m_porta_latch;
+ UINT8 m_tape_ctrl;
DECLARE_READ8_MEMBER(mz2000_ipl_r);
DECLARE_READ8_MEMBER(mz2000_wram_r);
DECLARE_WRITE8_MEMBER(mz2000_wram_w);
@@ -577,12 +583,16 @@ static READ8_DEVICE_HANDLER( mz2000_portb_r )
*/
UINT8 res = 0x80;
- res |= (state->m_cass->input() > 0.0038) ? 0x40 : 0x00;
- res |= ((state->m_cass->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) ? 0x00 : 0x20;
- res |= (state->m_cass->get_position() >= state->m_cass->get_length()) ? 0x08 : 0x00;
- res |= (device->machine().primary_screen->vblank()) ? 0x00 : 0x01;
+ if(state->m_cass->get_image() != NULL)
+ {
+ res |= (state->m_cass->input() > 0.0038) ? 0x40 : 0x00;
+ res |= ((state->m_cass->get_state() & CASSETTE_MASK_UISTATE) == CASSETTE_PLAY) ? 0x00 : 0x20;
+ res |= (state->m_cass->get_position() >= state->m_cass->get_length()) ? 0x08 : 0x00;
+ }
+ else
+ res |= 0x20;
-// popmessage("%02x",res);
+ res |= (device->machine().primary_screen->vblank()) ? 0x00 : 0x01;
return res;
}
@@ -596,7 +606,7 @@ static READ8_DEVICE_HANDLER( mz2000_portc_r )
static WRITE8_DEVICE_HANDLER( mz2000_porta_w )
{
/*
- TODO: it's likely to be a 0->1 transition
+ These are enabled thru a 0->1 transition
x--- ---- tape "APSS"
-x-- ---- tape "APLAY"
--x- ---- tape "AREW"
@@ -608,16 +618,49 @@ static WRITE8_DEVICE_HANDLER( mz2000_porta_w )
*/
mz2000_state *state = device->machine().driver_data<mz2000_state>();
- if((data & 8) == 0) // stop
+ if((state->m_tape_ctrl & 0x80) == 0 && data & 0x80)
+ {
+ //printf("Tape APSS control\n");
+ }
+
+ if((state->m_tape_ctrl & 0x40) == 0 && data & 0x40)
+ {
+ //printf("Tape APLAY control\n");
+ }
+
+ if((state->m_tape_ctrl & 0x20) == 0 && data & 0x20)
+ {
+ //printf("Tape AREW control\n");
+ }
+
+ if((state->m_tape_ctrl & 0x10) == 0 && data & 0x10)
+ {
+ //printf("reverse video control\n");
+ }
+
+ if((state->m_tape_ctrl & 0x08) == 0 && data & 0x08) // stop
{
state->m_cass->change_state(CASSETTE_MOTOR_DISABLED,CASSETTE_MASK_MOTOR);
state->m_cass->change_state(CASSETTE_STOPPED,CASSETTE_MASK_UISTATE);
}
- if((data & 4) == 0) // play
+
+ if((state->m_tape_ctrl & 0x04) == 0 && data & 0x04) // play
{
state->m_cass->change_state(CASSETTE_MOTOR_ENABLED,CASSETTE_MASK_MOTOR);
state->m_cass->change_state(CASSETTE_PLAY,CASSETTE_MASK_UISTATE);
}
+
+ if((state->m_tape_ctrl & 0x02) == 0 && data & 0x02)
+ {
+ //printf("Tape FF control\n");
+ }
+
+ if((state->m_tape_ctrl & 0x01) == 0 && data & 0x01)
+ {
+ //printf("Tape Rewind control\n");
+ }
+
+ state->m_tape_ctrl = data;
}
static WRITE8_DEVICE_HANDLER( mz2000_portb_w )
@@ -673,9 +716,11 @@ static WRITE8_DEVICE_HANDLER( mz2000_pio1_porta_w )
state->m_gvram_enable = ((data & 0xc0) == 0x80);
state->m_width80 = ((data & 0x20) >> 5);
state->m_key_mux = data & 0x1f;
+
+ state->m_porta_latch = data;
}
-static READ8_DEVICE_HANDLER( mz2000_pio1_porta_r )
+static READ8_DEVICE_HANDLER( mz2000_pio1_portb_r )
{
mz2000_state *state = device->machine().driver_data<mz2000_state>();
static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3",
@@ -691,23 +736,26 @@ static READ8_DEVICE_HANDLER( mz2000_pio1_porta_r )
for(i=0;i<0xe;i++)
res &= device->machine().root_device().ioport(keynames[i])->read();
- state->m_pio_latchb = res;
-
return res;
}
- state->m_pio_latchb = device->machine().root_device().ioport(keynames[state->m_key_mux & 0xf])->read();
-
return device->machine().root_device().ioport(keynames[state->m_key_mux & 0xf])->read();
}
+static READ8_DEVICE_HANDLER( mz2000_pio1_porta_r )
+{
+ mz2000_state *state = device->machine().driver_data<mz2000_state>();
+
+ return state->m_porta_latch;
+}
+
static Z80PIO_INTERFACE( mz2000_pio1_intf )
{
DEVCB_NULL,
DEVCB_HANDLER( mz2000_pio1_porta_r ),
DEVCB_HANDLER( mz2000_pio1_porta_w ),
DEVCB_NULL,
- DEVCB_HANDLER( mz2000_pio1_porta_r ),
+ DEVCB_HANDLER( mz2000_pio1_portb_r ),
DEVCB_NULL,
DEVCB_NULL
};
@@ -778,14 +826,14 @@ static const cassette_interface mz2000_cassette_interface =
static MACHINE_CONFIG_START( mz2000, mz2000_state )
/* basic machine hardware */
- MCFG_CPU_ADD("maincpu",Z80, XTAL_17_73447MHz/5) /* TODO: was 4 MHz, but otherwise cassette won't work */
+ MCFG_CPU_ADD("maincpu",Z80, MASTER_CLOCK)
MCFG_CPU_PROGRAM_MAP(mz2000_map)
MCFG_CPU_IO_MAP(mz2000_io)
MCFG_MACHINE_RESET(mz2000)
MCFG_I8255_ADD( "i8255_0", ppi8255_intf )
- MCFG_Z80PIO_ADD( "z80pio_1", 4000000, mz2000_pio1_intf )
+ MCFG_Z80PIO_ADD( "z80pio_1", MASTER_CLOCK, mz2000_pio1_intf )
MCFG_PIT8253_ADD("pit", mz2000_pit8253_intf)
MCFG_MB8877_ADD("mb8877a",mz2000_mb8877a_interface)