a1010: Preliminary SED1330 hookup (nw)

sed1330: Emulate CSRR command (nw)
This commit is contained in:
AJR 2019-09-29 20:54:54 -04:00
parent d158b0c2a5
commit eae6c23949
2 changed files with 66 additions and 11 deletions

View File

@ -33,9 +33,9 @@
#define INSTRUCTION_HDOT_SCR 0x5a
#define INSTRUCTION_OVLAY 0x5b
#define INSTRUCTION_CSRW 0x46
#define INSTRUCTION_CSRR 0x47 // unimplemented
#define INSTRUCTION_CSRR 0x47
#define INSTRUCTION_MWRITE 0x42
#define INSTRUCTION_MREAD 0x43 // unimplemented
#define INSTRUCTION_MREAD 0x43
#define CSRDIR_RIGHT 0x00
@ -235,7 +235,8 @@ device_memory_interface::space_config_vector sed1330_device::memory_space_config
READ8_MEMBER( sed1330_device::status_r )
{
LOG("SED1330 Status Read: %s\n", m_bf ? "busy" : "ready");
if (!machine().side_effects_disabled())
LOG("SED1330 Status Read: %s\n", m_bf ? "busy" : "ready");
return m_bf << 6;
}
@ -280,11 +281,44 @@ WRITE8_MEMBER( sed1330_device::command_w )
READ8_MEMBER( sed1330_device::data_r )
{
uint8_t data = readbyte(m_csr);
uint8_t data = 0;
LOG("SED1330 Memory Read %02x from %04x\n", data, m_csr);
switch (m_ir)
{
case INSTRUCTION_MREAD:
data = readbyte(m_csr);
if (!machine().side_effects_disabled())
{
LOG("SED1330 Memory Read %02x from %04x\n", data, m_csr);
increment_csr();
}
break;
increment_csr();
case INSTRUCTION_CSRR:
switch (m_pbc)
{
case 0:
data = m_csr & 0xff;
break;
case 1:
data = (m_csr & 0xff00) >> 8;
break;
default:
logerror("SED1330 Invalid parameter byte %02x\n", data);
}
if (!machine().side_effects_disabled())
{
LOG("SED1330 Cursor Byte %d Read %02x\n", m_pbc, data);
m_pbc++;
}
break;
default:
logerror("SED1330 Unsupported instruction %02x\n", m_ir);
break;
}
return data;
}

View File

@ -12,7 +12,9 @@
#include "machine/6522via.h"
#include "machine/mos6551.h"
#include "machine/msm58321.h"
//#include "video/sed1330.h"
#include "video/sed1330.h"
#include "emupal.h"
#include "screen.h"
class textelcomp_state : public driver_device
@ -32,6 +34,8 @@ private:
void rtc_w(u8 data);
void mem_map(address_map &map);
void lcdc_map(address_map &map);
required_device<cpu_device> m_maincpu;
required_device<msm58321_device> m_rtc;
required_region_ptr<u8> m_chargen;
@ -76,13 +80,19 @@ void textelcomp_state::mem_map(address_map &map)
map(0x1f20, 0x1f2f).m("via2", FUNC(via6522_device::map));
map(0x1f30, 0x1f3f).m("via3", FUNC(via6522_device::map));
map(0x1f40, 0x1f43).rw("acia", FUNC(mos6551_device::read), FUNC(mos6551_device::write));
map(0x1f70, 0x1f70).noprw();//rw("lcdc", FUNC(sed1330_device::status_r), FUNC(sed1330_device::data_w));
map(0x1f71, 0x1f71).noprw();//rw("lcdc", FUNC(sed1330_device::data_r), FUNC(sed1330_device::command_w));
map(0x4000, 0x7fff).ram(); // HY65226ALP-10 (battery backed?)
map(0x1f70, 0x1f70).rw("lcdc", FUNC(sed1330_device::status_r), FUNC(sed1330_device::data_w));
map(0x1f71, 0x1f71).rw("lcdc", FUNC(sed1330_device::data_r), FUNC(sed1330_device::command_w));
map(0x4000, 0x7fff).ram(); // HY62256ALP-10 (battery backed?)
map(0x8000, 0x9fff).ram(); // MB8464A-10L (battery backed?)
map(0xa000, 0xffff).rom().region("maincpu", 0x2000);
}
void textelcomp_state::lcdc_map(address_map &map)
{
map(0x0000, 0x1fff).ram();
map(0xf000, 0xffff).rom().region("chargen", 0x1000);
}
static INPUT_PORTS_START(textelcomp)
INPUT_PORTS_END
@ -116,7 +126,18 @@ void textelcomp_state::textelcomp(machine_config &config)
acia.set_xtal(3.6864_MHz_XTAL / 2);
acia.irq_handler().set("mainirq", FUNC(input_merger_device::in_w<1>));
//SED1330(config, "lcdc", 6.4_MHz_XTAL); // SED1330F + B&W LCD
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD));
screen.set_refresh_hz(50);
screen.set_size(480, 128);
screen.set_visarea(0, 480-1, 0, 128-1);
screen.set_palette("palette");
screen.set_screen_update("lcdc", FUNC(sed1330_device::screen_update));
PALETTE(config, "palette", palette_device::MONOCHROME);
sed1330_device &lcdc(SED1330(config, "lcdc", 6.4_MHz_XTAL)); // SED1330F + B&W LCD
lcdc.set_addrmap(0, &textelcomp_state::lcdc_map);
lcdc.set_screen("screen");
MSM58321(config, m_rtc, 32.768_kHz_XTAL); // RTC58321A
m_rtc->d0_handler().set("via3", FUNC(via6522_device::write_pa0));