mirror of
https://github.com/holub/mame
synced 2025-04-22 16:31:49 +03:00
bus/bbc/userport: Added the Sprow LCD Display.
This commit is contained in:
parent
4c96792f1c
commit
471781f99a
@ -595,6 +595,8 @@ if (BUSES["BBC_USERPORT"]~=null) then
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/userport.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/beebspch.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/beebspch.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/lcd.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/lcd.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/palext.cpp",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/palext.h",
|
||||
MAME_DIR .. "src/devices/bus/bbc/userport/pointer.cpp",
|
||||
|
112
src/devices/bus/bbc/userport/lcd.cpp
Normal file
112
src/devices/bus/bbc/userport/lcd.cpp
Normal file
@ -0,0 +1,112 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Sprow LCD Display
|
||||
|
||||
http://www.sprow.co.uk/bbc/buildit.htm#Lcddisplay
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
|
||||
#include "emu.h"
|
||||
#include "lcd.h"
|
||||
#include "screen.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// DEVICE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(BBC_LCD, bbc_lcd_device, "bbc_lcd", "Sprow LCD Display")
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_lcd_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
auto &screen = SCREEN(config, "screen", SCREEN_TYPE_LCD);
|
||||
screen.set_refresh_hz(50);
|
||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500));
|
||||
screen.set_size(120, 36);
|
||||
screen.set_visarea_full();
|
||||
screen.set_screen_update(m_lcdc, FUNC(hd44780_device::screen_update));
|
||||
screen.set_palette("palette");
|
||||
|
||||
PALETTE(config, "palette", FUNC(bbc_lcd_device::lcd_palette), 3);
|
||||
|
||||
HD44780(config, m_lcdc);
|
||||
m_lcdc->set_lcd_size(4, 20);
|
||||
m_lcdc->set_pixel_update_cb(FUNC(bbc_lcd_device::lcd_pixel_update));
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// bbc_lcd_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
bbc_lcd_device::bbc_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, BBC_LCD, tag, owner, clock)
|
||||
, device_bbc_userport_interface(mconfig, *this)
|
||||
, m_lcdc(*this, "lcdc")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void bbc_lcd_device::device_start()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
HD44780_PIXEL_UPDATE(bbc_lcd_device::lcd_pixel_update)
|
||||
{
|
||||
// char size is 5x8
|
||||
if (x > 4 || y > 7)
|
||||
return;
|
||||
|
||||
if (pos < 40)
|
||||
{
|
||||
if (pos >= 20)
|
||||
{
|
||||
line += 2;
|
||||
pos -= 20;
|
||||
}
|
||||
|
||||
if (line < 4)
|
||||
bitmap.pix16(line * (8 + 1) + y, pos * 6 + x) = state ? 1 : 2;
|
||||
}
|
||||
}
|
||||
|
||||
void bbc_lcd_device::lcd_palette(palette_device &palette) const
|
||||
{
|
||||
palette.set_pen_color(0, rgb_t(138, 146, 148)); // background
|
||||
palette.set_pen_color(1, rgb_t( 92, 83, 88)); // lcd pixel on
|
||||
palette.set_pen_color(2, rgb_t(131, 136, 139)); // lcd pixel off
|
||||
}
|
||||
|
||||
uint8_t bbc_lcd_device::pb_r()
|
||||
{
|
||||
return m_lcdc->db_r() >> 1;
|
||||
}
|
||||
|
||||
void bbc_lcd_device::pb_w(uint8_t data)
|
||||
{
|
||||
m_lcdc->rs_w(BIT(data, 0));
|
||||
m_lcdc->rw_w(BIT(data, 1));
|
||||
m_lcdc->e_w(BIT(data, 2));
|
||||
m_lcdc->db_w(data << 1);
|
||||
}
|
56
src/devices/bus/bbc/userport/lcd.h
Normal file
56
src/devices/bus/bbc/userport/lcd.h
Normal file
@ -0,0 +1,56 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Nigel Barnes
|
||||
/**********************************************************************
|
||||
|
||||
Sprow LCD Display
|
||||
|
||||
**********************************************************************/
|
||||
|
||||
#ifndef MAME_BUS_BBC_USERPORT_LCD_H
|
||||
#define MAME_BUS_BBC_USERPORT_LCD_H
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "userport.h"
|
||||
#include "video/hd44780.h"
|
||||
#include "emupal.h"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
|
||||
// ======================> bbc_lcd_device
|
||||
|
||||
class bbc_lcd_device :
|
||||
public device_t,
|
||||
public device_bbc_userport_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
bbc_lcd_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
virtual uint8_t pb_r() override;
|
||||
virtual void pb_w(uint8_t data) override;
|
||||
|
||||
private:
|
||||
required_device<hd44780_device> m_lcdc;
|
||||
|
||||
HD44780_PIXEL_UPDATE(lcd_pixel_update);
|
||||
|
||||
void lcd_palette(palette_device &palette) const;
|
||||
};
|
||||
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(BBC_LCD, bbc_lcd_device)
|
||||
|
||||
|
||||
#endif // MAME_BUS_BBC_USERPORT_LCD_H
|
@ -109,6 +109,7 @@ void bbc_userport_slot_device::pb_w(uint8_t data)
|
||||
#include "beebspch.h"
|
||||
//#include "digitiser.h"
|
||||
//#include "ev1.h"
|
||||
#include "lcd.h"
|
||||
#include "palext.h"
|
||||
#include "pointer.h"
|
||||
#include "usersplit.h"
|
||||
@ -127,6 +128,7 @@ void bbc_userport_devices(device_slot_interface &device)
|
||||
device.option_add("cpalette", BBC_CPALETTE); /* Clwyd Technics Colour Palette */
|
||||
//device.option_add("ev1", BBC_EV1); /* Micro-Robotics EV1 */
|
||||
//device.option_add("hobbit", BBC_HOBBIT); /* Hobbit Floppy Tape System (Ikon) */
|
||||
device.option_add("lcd", BBC_LCD); /* Sprow LCD Display */
|
||||
device.option_add("m512mouse", BBC_M512MOUSE); /* Acorn Mouse (provided with Master 512) */
|
||||
device.option_add("tracker", BBC_TRACKER); /* Marconi RB2 Tracker Ball / Acorn Tracker Ball */
|
||||
device.option_add("usersplit", BBC_USERSPLIT); /*User Port Splitter (Watford Electronics) */
|
||||
|
Loading…
Reference in New Issue
Block a user