11// license:BSD-3-Clause
2- // copyright-holders:R. Belmont
2+ // copyright-holders:R. Belmont, Felipe Sanches
33/* **************************************************************************
44
55 acvirus.cpp - Access Virus series
6565#include " emu.h"
6666#include " cpu/mcs51/sab80c535.h"
6767#include " machine/intelfsh.h"
68+ #include " video/hd44780.h"
69+ #include " emupal.h"
6870#include " speaker.h"
71+ #include " screen.h"
72+ #include " virusb.lh"
6973
7074
7175namespace {
@@ -76,15 +80,18 @@ class acvirus_state : public driver_device
7680 acvirus_state (const machine_config &mconfig, device_type type, const char *tag)
7781 : driver_device(mconfig, type, tag),
7882 m_maincpu (*this , " maincpu" ),
83+ m_lcdc(*this , " lcdc" ),
7984 m_rombank(*this , " rombank" )
8085 { }
8186
8287 void virus (machine_config &config);
88+ void virusb (machine_config &config);
8389
8490 void init_virus ();
8591
8692private:
8793 required_device<sab80c535_device> m_maincpu;
94+ required_device<hd44780_device> m_lcdc;
8895 required_memory_bank m_rombank;
8996
9097 virtual void machine_start () override ATTR_COLD;
@@ -96,8 +103,11 @@ class acvirus_state : public driver_device
96103 void p5_w (u8 data);
97104
98105 u8 p402_r ();
106+
107+ void palette_init (palette_device &palette);
99108};
100109
110+
101111void acvirus_state::machine_start ()
102112{
103113 m_rombank->configure_entries (0 , 16 , memregion (" maincpu" )->base (), 0x8000 );
@@ -129,6 +139,11 @@ void acvirus_state::data_map(address_map &map)
129139 map (0x0402 , 0x0402 ).r (FUNC (acvirus_state::p402_r));
130140}
131141
142+ void acvirus_state::palette_init (palette_device &palette)
143+ {
144+ palette.set_pen_color (0 , rgb_t (142 , 241 , 0 ));
145+ palette.set_pen_color (1 , rgb_t (0 , 48 , 0 ));
146+ }
132147
133148void acvirus_state::virus (machine_config &config)
134149{
@@ -137,12 +152,40 @@ void acvirus_state::virus(machine_config &config)
137152 m_maincpu->set_addrmap (AS_DATA, &acvirus_state::data_map);
138153 m_maincpu->port_out_cb <5 >().set (FUNC (acvirus_state::p5_w));
139154
155+ /*
156+ This may be hooked either to memorymap or to some of the ports:
157+ map(0x?, 0x?).rw("lcdc", FUNC(hd44780_device::data_r), FUNC(hd44780_device::data_w)).umask16(0x00ff);
158+ map(0x?, 0x?).rw("lcdc", FUNC(hd44780_device::control_r), FUNC(hd44780_device::control_w)).umask16(0x00ff);
159+ */
160+ screen_device &screen (SCREEN (config, " screen" , SCREEN_TYPE_LCD));
161+ screen.set_refresh_hz (60 );
162+ screen.set_screen_update (" lcdc" , FUNC (hd44780_device::screen_update));
163+ screen.set_size (6 *16 , 8 *2 +1 );
164+ screen.set_visarea_full ();
165+ screen.set_palette (" palette" );
166+
167+ PALETTE (config, " palette" , FUNC (acvirus_state::palette_init), 2 );
168+
169+ /* Actual device is LM16255 */
170+ HD44780 (config, m_lcdc, 270'000 ); // TODO: clock not measured, datasheet typical clock used
171+ m_lcdc->set_lcd_size (2 , 16 );
172+
140173 SPEAKER (config, " speaker" , 2 ).front ();
141174}
142175
176+ void acvirus_state::virusb (machine_config &config)
177+ {
178+ virus (config);
179+
180+ config.set_default_layout (layout_virusb);
181+ }
182+
143183static INPUT_PORTS_START ( virus )
144184INPUT_PORTS_END
145185
186+ static INPUT_PORTS_START( virusb )
187+ INPUT_PORTS_END
188+
146189ROM_START( virusa )
147190 ROM_REGION(0x80000 , " maincpu" , 0 )
148191 ROM_LOAD( " virus_a_28.bin" , 0x000000 , 0x080000 , CRC(087cd808) SHA1(fe3310a165c208473822455c75ee5b2a6de34bc8) )
@@ -177,7 +220,7 @@ ROM_END
177220
178221
179222CONS ( 1997 , virusa, 0 , 0 , virus, virus, acvirus_state, empty_init, " Access" , " Virus A" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND )
180- CONS( 1999 , virusb, 0 , 0 , virus, virus , acvirus_state, empty_init, " Access" , " Virus B (Ver. T)" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND )
223+ CONS( 1999 , virusb, 0 , 0 , virusb, virusb , acvirus_state, empty_init, " Access" , " Virus B (Ver. T)" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND )
181224CONS( 2002 , virusc, 0 , 0 , virus, virus, acvirus_state, empty_init, " Access" , " Virus C" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND )
182225CONS( 2001 , virusrck, 0 , 0 , virus, virus, acvirus_state, empty_init, " Access" , " Virus Rack (Ver. T)" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND )
183226CONS( 2002 , virusrckxl, 0 , 0 , virus, virus, acvirus_state, empty_init, " Access" , " Virus Rack XL" , MACHINE_NOT_WORKING|MACHINE_NO_SOUND )
0 commit comments