mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
eurit30: Add LCD screen
This commit is contained in:
parent
b686ad854c
commit
45b9a3fcf1
@ -9,6 +9,9 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/m37710/m37710.h"
|
||||
#include "machine/am79c30.h"
|
||||
#include "video/hd44780.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
|
||||
class eurit_state : public driver_device
|
||||
{
|
||||
@ -22,25 +25,19 @@ public:
|
||||
void eurit30(machine_config &mconfig);
|
||||
|
||||
private:
|
||||
void p4_w(u8 data);
|
||||
void p6_w(u8 data);
|
||||
HD44780_PIXEL_UPDATE(lcd_pixel_update);
|
||||
|
||||
void mem_map(address_map &map);
|
||||
|
||||
required_device<m37730s2_device> m_maincpu;
|
||||
void palette_init(palette_device &palette);
|
||||
|
||||
u8 m_p4 = 0;
|
||||
required_device<m37730s2_device> m_maincpu;
|
||||
};
|
||||
|
||||
void eurit_state::p4_w(u8 data)
|
||||
HD44780_PIXEL_UPDATE(eurit_state::lcd_pixel_update)
|
||||
{
|
||||
m_p4 = data;
|
||||
}
|
||||
|
||||
void eurit_state::p6_w(u8 data)
|
||||
{
|
||||
if (BIT(data, 6))
|
||||
logerror("%s: Writing $%X to LCDC %s register\n", machine().describe_context(), (m_p4 & 0xf0) >> 4, BIT(data, 4) ? "data" : "instruction");
|
||||
if (x < 5 && y < 8 && line < 2 && pos < 20)
|
||||
bitmap.pix16(line * 8 + y, pos * 6 + x) = state;
|
||||
}
|
||||
|
||||
|
||||
@ -56,15 +53,38 @@ void eurit_state::mem_map(address_map &map)
|
||||
static INPUT_PORTS_START(eurit30)
|
||||
INPUT_PORTS_END
|
||||
|
||||
void eurit_state::palette_init(palette_device &palette)
|
||||
{
|
||||
palette.set_pen_color(0, rgb_t(131, 136, 139));
|
||||
palette.set_pen_color(1, rgb_t( 92, 83, 88));
|
||||
}
|
||||
|
||||
void eurit_state::eurit30(machine_config &config)
|
||||
{
|
||||
M37730S2(config, m_maincpu, 8'000'000); // type and clock unknown
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &eurit_state::mem_map);
|
||||
m_maincpu->p4_out_cb().set(FUNC(eurit_state::p4_w));
|
||||
m_maincpu->p6_out_cb().set(FUNC(eurit_state::p6_w));
|
||||
m_maincpu->p4_out_cb().set("lcdc", FUNC(hd44780_device::db_w));
|
||||
m_maincpu->p6_out_cb().set("lcdc", FUNC(hd44780_device::e_w)).bit(6);
|
||||
m_maincpu->p6_out_cb().append("lcdc", FUNC(hd44780_device::rw_w)).bit(5);
|
||||
m_maincpu->p6_out_cb().append("lcdc", FUNC(hd44780_device::rs_w)).bit(4);
|
||||
|
||||
am79c30a_device &dsc(AM79C30A(config, "dsc", 12'288'000));
|
||||
dsc.int_callback().set_inputline(m_maincpu, M37710_LINE_IRQ0);
|
||||
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
|
||||
screen.set_refresh_hz(60);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
|
||||
screen.set_screen_update("lcdc", FUNC(hd44780_device::screen_update));
|
||||
screen.set_size(6*20, 8*2);
|
||||
screen.set_visarea_full();
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", FUNC(eurit_state::palette_init), 2);
|
||||
|
||||
hd44780_device &lcdc(HD44780(config, "lcdc", 0));
|
||||
lcdc.set_lcd_size(2, 20);
|
||||
lcdc.set_pixel_update_cb(FUNC(eurit_state::lcd_pixel_update));
|
||||
lcdc.set_busy_factor(0.01);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user