diff --git a/src/devices/machine/mc146818.c b/src/devices/machine/mc146818.c index 6639710cec6..5b74badcea5 100644 --- a/src/devices/machine/mc146818.c +++ b/src/devices/machine/mc146818.c @@ -37,7 +37,9 @@ mc146818_device::mc146818_device(const machine_config &mconfig, const char *tag, m_last_refresh(attotime::zero), m_write_irq(*this), m_century_index(-1), - m_use_utc(false) + m_epoch(0), + m_use_utc(false), + m_binary(false) { } @@ -48,7 +50,9 @@ mc146818_device::mc146818_device(const machine_config &mconfig, device_type type m_last_refresh(attotime::zero), m_write_irq(*this), m_century_index(-1), - m_use_utc(false) + m_epoch(0), + m_use_utc(false), + m_binary(false) { } @@ -199,6 +203,9 @@ void mc146818_device::nvram_default() memset(&m_data[0], 0, data_size()); } + if(m_binary) + m_data[0x0b] |= REG_B_DM; + set_base_datetime(); update_timer(); update_irq(); @@ -391,7 +398,7 @@ void mc146818_device::set_base_datetime() set_dayofweek(current_time.weekday + 1); set_dayofmonth(current_time.mday); set_month(current_time.month + 1); - set_year(current_time.year % 100); + set_year((current_time.year - m_epoch) % (m_data[0x0b] & REG_B_DM ? 0x100 : 100)); if (m_century_index >= 0) m_data[m_century_index] = to_ram(current_time.year / 100); diff --git a/src/devices/machine/mc146818.h b/src/devices/machine/mc146818.h index 3db19ec533e..daee386d000 100644 --- a/src/devices/machine/mc146818.h +++ b/src/devices/machine/mc146818.h @@ -34,6 +34,12 @@ #define MCFG_MC146818_UTC(_utc) \ downcast(device)->set_use_utc(_utc); +#define MCFG_MC146818_BINARY(_bin) \ + downcast(device)->set_binary(_bin); + +#define MCFG_MC146818_EPOCH(_epoch) \ + downcast(device)->set_epoch(_epoch); + //************************************************************************** // TYPE DEFINITIONS //************************************************************************** @@ -52,6 +58,8 @@ public: template void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); } void set_century_index(int century_index) { m_century_index = century_index; } void set_use_utc(bool use_utc) { m_use_utc = use_utc; } + void set_binary(bool binary) { m_binary = binary; } + void set_epoch(int epoch) { m_epoch = epoch; } // read/write access DECLARE_READ8_MEMBER( read ); @@ -165,8 +173,8 @@ private: emu_timer *m_periodic_timer; devcb_write_line m_write_irq; - int m_century_index; - bool m_use_utc; + int m_century_index, m_epoch; + bool m_use_utc, m_binary; }; diff --git a/src/mess/drivers/pcd.c b/src/mess/drivers/pcd.c index bedb0adf87e..649a824e7b5 100644 --- a/src/mess/drivers/pcd.c +++ b/src/mess/drivers/pcd.c @@ -537,6 +537,8 @@ static MACHINE_CONFIG_START( pcd, pcd_state ) // rtc MCFG_MC146818_ADD("rtc", XTAL_32_768kHz) MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic1", pic8259_device, ir7_w)) + MCFG_MC146818_BINARY(true) + MCFG_MC146818_EPOCH(1900) MCFG_DEVICE_ADD("keyboard", PCD_KEYBOARD, 0) MCFG_PCD_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE("usart2", mc2661_device, rx_w)) diff --git a/src/mess/video/pcd.c b/src/mess/video/pcd.c index 2ae4029c14a..26e3809dc4c 100644 --- a/src/mess/video/pcd.c +++ b/src/mess/video/pcd.c @@ -88,7 +88,8 @@ static MACHINE_CONFIG_FRAGMENT( pcd_video ) MCFG_SCREEN_UPDATE_DEVICE("crtc", scn2674_device, screen_update) MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) - MCFG_PALETTE_ADD_BLACK_AND_WHITE("palette") + MCFG_PALETTE_ADD("palette", 3) + MCFG_PALETTE_INIT_OWNER(pcdx_video_device, pcdx) MCFG_SCN2674_VIDEO_ADD("crtc", 0, NULL); MCFG_SCN2674_TEXT_CHARACTER_WIDTH(8) @@ -158,12 +159,20 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcd_video_device::display_pixels) } else { - UINT8 data; + UINT8 data, attr; + int bgnd = 0; data = m_charram[m_vram[address] * 16 + linecount]; + attr = m_vram[address + 1]; if(cursor && blink) data = 0xff; + if((linecount > 11) && (attr & 0x20)) + data = 0xff; + if(attr & 8) + bgnd = 2; + if(attr & 0x10) + data = ~data; for(int i = 0; i < 8; i++) - bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : 0); + bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : bgnd); } } @@ -180,6 +189,13 @@ SCN2674_DRAW_CHARACTER_MEMBER(pcx_video_device::display_pixels) bitmap.pix32(y, x + i) = m_palette->pen((data & (1 << (7 - i))) ? 1 : 0); } +PALETTE_INIT_MEMBER(pcdx_video_device, pcdx) +{ + palette.set_pen_color(0,rgb_t::black); + palette.set_pen_color(1,rgb_t::white); + palette.set_pen_color(2,rgb_t(128,128,128)); +} + WRITE8_MEMBER(pcd_video_device::vram_w) { if(m_vram_sw) diff --git a/src/mess/video/pcd.h b/src/mess/video/pcd.h index 817e23d0b1a..39312232631 100644 --- a/src/mess/video/pcd.h +++ b/src/mess/video/pcd.h @@ -19,6 +19,8 @@ public: virtual DECLARE_ADDRESS_MAP(map, 16) = 0; DECLARE_READ8_MEMBER(detect_r); DECLARE_WRITE8_MEMBER(detect_w); + DECLARE_PALETTE_INIT(pcdx); + protected: required_device m_maincpu; required_device m_mcu;