(nw) babbage: added pwm device

This commit is contained in:
Robbbert 2020-05-15 13:20:42 +10:00
parent c7434c5e46
commit 8c7eee4ccc
2 changed files with 21 additions and 25 deletions

View File

@ -17,8 +17,6 @@
Copy the text and Paste into the emulator.
=3E^=0F^=D3^=13^=3E^=07^=D3^=13^=3E^=00^=D3^=12^=76^-1000X
ToDo:
- Blank the display if digits aren't being refreshed
***************************************************************************/
@ -28,6 +26,7 @@
#include "machine/z80ctc.h"
#include "machine/z80pio.h"
#include "machine/z80daisy.h"
#include "video/pwm.h"
#include "babbage.lh"
#define MAIN_CLOCK 25e5
@ -41,13 +40,13 @@ public:
, m_pio_1(*this, "z80pio_1")
, m_pio_2(*this, "z80pio_2")
, m_ctc(*this, "z80ctc")
, m_keyboard(*this, "X%u", 0)
, m_digits(*this, "digit%u", 0U)
, m_display(*this, "display")
, m_io_keyboard(*this, "X%u", 0U)
{ }
void babbage(machine_config &config);
protected:
private:
DECLARE_READ8_MEMBER(pio2_a_r);
DECLARE_WRITE8_MEMBER(pio1_b_w);
DECLARE_WRITE8_MEMBER(pio2_b_w);
@ -59,18 +58,16 @@ protected:
void babbage_io(address_map &map);
void babbage_map(address_map &map);
private:
uint8_t m_segment;
uint8_t m_seg;
uint8_t m_key;
uint8_t m_prev_key;
bool m_step;
virtual void machine_start() override { m_digits.resolve(); }
required_device<z80_device> m_maincpu;
required_device<z80pio_device> m_pio_1;
required_device<z80pio_device> m_pio_2;
required_device<z80ctc_device> m_ctc;
required_ioport_array<4> m_keyboard;
output_finder<33> m_digits;
required_device<pwm_display_device> m_display;
required_ioport_array<4> m_io_keyboard;
};
@ -172,18 +169,15 @@ READ8_MEMBER( babbage_state::pio2_a_r )
WRITE8_MEMBER( babbage_state::pio2_b_w )
{
if (BIT(data, 7))
{
m_step = false;
}
else if (!m_step)
else
if (!m_step)
{
m_segment = data;
m_seg = data;
m_step = true;
}
else
{
m_digits[data] = m_segment;
}
m_display->matrix(data, m_seg);
}
static const z80_daisy_config babbage_daisy_chain[] =
@ -200,7 +194,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback)
for (u8 i = 0; i < 4; i++)
{
inp = m_keyboard[i]->read();
inp = m_io_keyboard[i]->read();
for (u8 j = 0; j < 5; j++)
if (BIT(inp, j))
@ -240,6 +234,8 @@ void babbage_state::babbage(machine_config &config)
/* video hardware */
config.set_default_layout(layout_babbage);
PWM_DISPLAY(config, m_display).set_size(6, 8);
m_display->set_segmask(0x3f, 0xff);
/* Devices */
Z80CTC(config, m_ctc, MAIN_CLOCK);
@ -268,7 +264,7 @@ void babbage_state::babbage(machine_config &config)
***************************************************************************/
ROM_START(babbage)
ROM_REGION(0x10000, "maincpu", ROMREGION_ERASEFF)
ROM_REGION(0x0800, "maincpu", ROMREGION_ERASEFF)
ROM_LOAD("mon.rom", 0x0000, 0x0200, CRC(469bd607) SHA1(8f3489a0f96de6a03b05c1ee01b89d9848f4b152) )
ROM_END

View File

@ -25,22 +25,22 @@ license:CC0
<bezel element="background">
<bounds left="97" top="90" right="453" bottom="235" />
</bezel>
<bezel name="digit32" element="digit">
<bezel name="digit5" element="digit">
<bounds left="107" top="105" right="155" bottom="185" />
</bezel>
<bezel name="digit16" element="digit">
<bezel name="digit4" element="digit">
<bounds left="155" top="105" right="203" bottom="185" />
</bezel>
<bezel name="digit8" element="digit">
<bezel name="digit3" element="digit">
<bounds left="203" top="105" right="251" bottom="185" />
</bezel>
<bezel name="digit4" element="digit">
<bezel name="digit2" element="digit">
<bounds left="251" top="105" right="299" bottom="185" />
</bezel>
<bezel name="digit2" element="digit">
<bezel name="digit1" element="digit">
<bounds left="347" top="105" right="395" bottom="185" />
</bezel>
<bezel name="digit1" element="digit">
<bezel name="digit0" element="digit">
<bounds left="395" top="105" right="443" bottom="185" />
</bezel>
<bezel name="led7" element="red_led">