summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Nigel Barnes <Pernod70@users.noreply.github.com>2020-08-27 19:46:01 +0100
committer Nigel Barnes <Pernod70@users.noreply.github.com>2020-08-27 19:47:53 +0100
commit471781f99ae8242319beb474649dd4afefa5e3f7 (patch)
treecb1ed4bc632c977e34c871913f57f2b5d260a826
parent4c96792f1c53b1f1ad3f13c5c69d3878b6468e9f (diff)
bus/bbc/userport: Added the Sprow LCD Display.
-rw-r--r--scripts/src/bus.lua2
-rw-r--r--src/devices/bus/bbc/userport/lcd.cpp112
-rw-r--r--src/devices/bus/bbc/userport/lcd.h56
-rw-r--r--src/devices/bus/bbc/userport/userport.cpp2
4 files changed, 172 insertions, 0 deletions
diff --git a/scripts/src/bus.lua b/scripts/src/bus.lua
index 8dfc690cbf1..4dc6609e9ed 100644
--- a/scripts/src/bus.lua
+++ b/scripts/src/bus.lua
@@ -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",
diff --git a/src/devices/bus/bbc/userport/lcd.cpp b/src/devices/bus/bbc/userport/lcd.cpp
new file mode 100644
index 00000000000..cdc70bc35fe
--- /dev/null
+++ b/src/devices/bus/bbc/userport/lcd.cpp
@@ -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);
+}
diff --git a/src/devices/bus/bbc/userport/lcd.h b/src/devices/bus/bbc/userport/lcd.h
new file mode 100644
index 00000000000..c4aecfbd00e
--- /dev/null
+++ b/src/devices/bus/bbc/userport/lcd.h
@@ -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
diff --git a/src/devices/bus/bbc/userport/userport.cpp b/src/devices/bus/bbc/userport/userport.cpp
index b16b6433f9f..d312cc10d50 100644
--- a/src/devices/bus/bbc/userport/userport.cpp
+++ b/src/devices/bus/bbc/userport/userport.cpp
@@ -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) */