From 1fb2bc3b7915ffd03e554749c58a8babcc6515f3 Mon Sep 17 00:00:00 2001 From: Robbbert Date: Mon, 27 Jan 2014 09:21:38 +0000 Subject: [PATCH] (MESS) phc25 : added cursor and wave sound. --- src/mess/drivers/phc25.c | 46 +++++++++++++++++++++++++++------------ src/mess/includes/phc25.h | 31 +++++++++++++------------- 2 files changed, 47 insertions(+), 30 deletions(-) diff --git a/src/mess/drivers/phc25.c b/src/mess/drivers/phc25.c index d1962cf0a40..8e9a1d47a4a 100644 --- a/src/mess/drivers/phc25.c +++ b/src/mess/drivers/phc25.c @@ -29,17 +29,22 @@ - tune cassette trigger level - accurate video timing - 10 SCREEN 2,1,1:CLS - 20 FOR X=0 TO 8 - 30 LINE(X*24,0)-(X*24+16,191),X,BF - 40 NEXT + - sound isn't working (should be a keyclick) + - backspace and return are very slow, while other keys are way too fast + - Basic and screen drawing are sluggish + - Screen attribute bits need to be found out - 10 SCREEN3,1,1:COLOR,,1:CLS - 20 X1=INT(RND(1)*256):Y1=INT(RND(1)*192):X2=INT(RND(1)*256):Y2=INT(RND(1)*192):C=INT(RND(1)*4)+1:LINE(X1,Y1)-(X2,Y2),C:GOTO 20 - RUN +10 SCREEN 2,1,1:CLS +20 FOR X=0 TO 8 +30 LINE(X*24,0)-(X*24+16,191),X,BF +40 NEXT + +10 SCREEN3,1,1:COLOR,,1:CLS +20 X1=INT(RND(1)*256):Y1=INT(RND(1)*192):X2=INT(RND(1)*256):Y2=INT(RND(1)*192):C=INT(RND(1)*4)+1:LINE(X1,Y1)-(X2,Y2),C:GOTO 20 +RUN - 10 SCREEN2,1,1:CLS:FORX=0TO8:LINE(X*24,0)-(X*24+16,191),X,BF:NEXT +10 SCREEN2,1,1:CLS:FORX=0TO8:LINE(X*24,0)-(X*24+16,191),X,BF:NEXT */ @@ -108,10 +113,11 @@ WRITE8_MEMBER( phc25_state::port40_w ) m_centronics->strobe_w(BIT(data, 3)); /* MC6847 */ + m_ag = BIT(data, 7); m_vdg->intext_w(BIT(data, 2)); m_vdg->gm0_w(BIT(data, 5)); m_vdg->gm1_w(BIT(data, 6)); - m_vdg->ag_w(BIT(data, 7)); + m_vdg->ag_w(m_ag); } /* Memory Maps */ @@ -263,7 +269,17 @@ INPUT_PORTS_END READ8_MEMBER( phc25_state::video_ram_r ) { - return m_video_ram[offset & 0x17ff]; + if (m_ag) // graphics (to be checked) + { + return m_video_ram[offset & 0x17ff]; + } + else // text + { + offset &= 0x7ff; + m_vdg->inv_w(BIT(m_video_ram[offset | 0x800], 0)); // cursor attribute + //m_vdg->css_w(BIT(m_video_ram[offset | 0x800], 7)); // unknown attribute + return m_video_ram[offset]; + } } UINT8 phc25_state::pal_char_rom_r(running_machine &machine, UINT8 ch, int line) @@ -354,7 +370,7 @@ static const cassette_interface phc25_cassette_interface = static MACHINE_CONFIG_START( phc25, phc25_state ) /* basic machine hardware */ - MCFG_CPU_ADD(Z80_TAG, Z80, 4000000) + MCFG_CPU_ADD(Z80_TAG, Z80, 4000000 ) // divide by 3 to make keyboard usable MCFG_CPU_PROGRAM_MAP(phc25_mem) MCFG_CPU_IO_MAP(phc25_io) @@ -363,6 +379,8 @@ static MACHINE_CONFIG_START( phc25, phc25_state ) MCFG_SOUND_ADD(AY8910_TAG, AY8910, 1996750) MCFG_SOUND_CONFIG(ay8910_intf) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) + MCFG_SOUND_WAVE_ADD(WAVE_TAG, "cassette") + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15) /* devices */ MCFG_CASSETTE_ADD("cassette", phc25_cassette_interface) @@ -408,6 +426,6 @@ ROM_END /* Driver */ -/* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME FLAGS */ -COMP( 1983, phc25, 0, 0, pal, phc25, driver_device, 0, "Sanyo", "PHC-25 (Europe)", GAME_NOT_WORKING ) -COMP( 1983, phc25j, phc25, 0, ntsc, phc25j, driver_device, 0, "Sanyo", "PHC-25 (Japan)", GAME_NOT_WORKING ) +/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */ +COMP( 1983, phc25, 0, 0, pal, phc25, driver_device, 0, "Sanyo", "PHC-25 (Europe)", GAME_NOT_WORKING ) +COMP( 1983, phc25j, phc25, 0, ntsc, phc25j, driver_device, 0, "Sanyo", "PHC-25 (Japan)", GAME_NOT_WORKING ) diff --git a/src/mess/includes/phc25.h b/src/mess/includes/phc25.h index d8aa4fd6734..a36a1bb3477 100644 --- a/src/mess/includes/phc25.h +++ b/src/mess/includes/phc25.h @@ -9,6 +9,7 @@ #include "emu.h" #include "cpu/z80/z80.h" #include "imagedev/cassette.h" +#include "sound/wave.h" #include "machine/ram.h" #include "bus/centronics/ctronics.h" #include "video/mc6847.h" @@ -26,31 +27,29 @@ class phc25_state : public driver_device { public: phc25_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), - m_maincpu(*this, Z80_TAG), - m_vdg(*this, MC6847_TAG), - m_centronics(*this, CENTRONICS_TAG), - m_cassette(*this, "cassette"), - m_video_ram(*this, "video_ram") + : driver_device(mconfig, type, tag) + , m_video_ram(*this, "video_ram") + , m_maincpu(*this, Z80_TAG) + , m_vdg(*this, MC6847_TAG) + , m_centronics(*this, CENTRONICS_TAG) + , m_cassette(*this, "cassette") { } - required_device m_maincpu; - required_device m_vdg; - required_device m_centronics; - required_device m_cassette; - - virtual void video_start(); - DECLARE_READ8_MEMBER( port40_r ); DECLARE_WRITE8_MEMBER( port40_w ); DECLARE_READ8_MEMBER( video_ram_r ); - static UINT8 ntsc_char_rom_r(running_machine &machine, UINT8 ch, int line); static UINT8 pal_char_rom_r(running_machine &machine, UINT8 ch, int line); - /* video state */ - required_shared_ptr m_video_ram; +private: + virtual void video_start(); UINT8 *m_char_rom; + bool m_ag; + required_shared_ptr m_video_ram; + required_device m_maincpu; + required_device m_vdg; + required_device m_centronics; + required_device m_cassette; }; #endif