mirror of
https://github.com/holub/mame
synced 2025-04-21 16:01:56 +03:00
ms6102: add EAROM device + minor keyboard fix (nw)
This commit is contained in:
parent
cd8809b960
commit
05631edc1a
@ -1950,6 +1950,8 @@ files {
|
||||
MAME_DIR .. "src/mame/drivers/mk85.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/mk90.cpp",
|
||||
MAME_DIR .. "src/mame/drivers/ms6102.cpp",
|
||||
MAME_DIR .. "src/mame/machine/kr1601rr1.cpp",
|
||||
MAME_DIR .. "src/mame/machine/kr1601rr1.h",
|
||||
}
|
||||
|
||||
createMESSProjects(_target, _subtarget, "elektor")
|
||||
|
@ -11,14 +11,13 @@
|
||||
Photos
|
||||
|
||||
To do:
|
||||
- why DMA stops after 2nd char on each row?
|
||||
- what does second 8275 do?
|
||||
- character attributes
|
||||
- keyboard (MS7002)
|
||||
|
||||
Chips:
|
||||
- DD5 - KR580WM80A (8080 clone) - CPU
|
||||
- DD7 - KR580WT57 (8257 clone) - DMAC
|
||||
- DD9 - KR1601RR1 (ER2401 clone) - NVRAM
|
||||
- DD9 - KR1601RR1 (1024x4 bit NVRAM)
|
||||
- DD21 - KR581WA1A (TR6402 clone) - UART
|
||||
- DD55, DD56 - KR580WG75 (8275 clone) - CRTC
|
||||
- DD59 - KR556RT5 - alternate chargen ROM
|
||||
@ -40,7 +39,7 @@
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/i8257.h"
|
||||
#include "machine/keyboard.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "machine/kr1601rr1.h"
|
||||
#include "machine/pit8253.h"
|
||||
#include "video/i8275.h"
|
||||
|
||||
@ -48,7 +47,7 @@
|
||||
|
||||
#define LOG_GENERAL (1U << 0)
|
||||
|
||||
//#define VERBOSE (LOG_GENERAL)
|
||||
#define VERBOSE (LOG_GENERAL)
|
||||
//#define LOG_OUTPUT_FUNC printf
|
||||
#include "logmacro.h"
|
||||
|
||||
@ -60,7 +59,7 @@ public:
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_p_videoram(*this, "videoram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_nvram(*this, "nvram")
|
||||
, m_earom(*this, "earom")
|
||||
, m_pic(*this, "i8214")
|
||||
, m_dma8257(*this, "dma8257")
|
||||
, m_i8251(*this, "i8251")
|
||||
@ -76,9 +75,11 @@ public:
|
||||
void ms6102(machine_config &config);
|
||||
void ms6102_io(address_map &map);
|
||||
void ms6102_mem(address_map &map);
|
||||
|
||||
protected:
|
||||
virtual void machine_reset() override;
|
||||
virtual void machine_start() override;
|
||||
|
||||
private:
|
||||
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
@ -99,6 +100,8 @@ private:
|
||||
DECLARE_READ8_MEMBER(crtc_r);
|
||||
DECLARE_WRITE8_MEMBER(crtc_w);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER(write_line_clock);
|
||||
|
||||
DECLARE_READ8_MEMBER(misc_r);
|
||||
DECLARE_READ8_MEMBER(kbd_get);
|
||||
void kbd_put(u8 data);
|
||||
@ -108,7 +111,7 @@ private:
|
||||
|
||||
required_shared_ptr<uint8_t> m_p_videoram;
|
||||
required_device<i8080_cpu_device> m_maincpu;
|
||||
required_device<nvram_device> m_nvram;
|
||||
required_device<kr1601rr1_device> m_earom;
|
||||
required_device<i8214_device> m_pic;
|
||||
required_device<i8257_device> m_dma8257;
|
||||
required_device<i8251_device> m_i8251;
|
||||
@ -125,7 +128,7 @@ void ms6102_state::ms6102_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0x2fff).rom();
|
||||
map(0x3800, 0x3bff).ram().share("nvram");
|
||||
map(0x3800, 0x3bff).rw(m_earom, FUNC(kr1601rr1_device::read), FUNC(kr1601rr1_device::write));
|
||||
map(0xc000, 0xffff).ram().share("videoram");
|
||||
}
|
||||
|
||||
@ -137,7 +140,7 @@ void ms6102_state::ms6102_io(address_map &map)
|
||||
map(0x10, 0x18).rw(m_dma8257, FUNC(i8257_device::read), FUNC(i8257_device::write));
|
||||
map(0x20, 0x23).rw("pit8253", FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
||||
//AM_RANGE(0x30, 0x3f) AM_DEVREADWRITE("589wa1", ay31015_device, receive, transmit)
|
||||
map(0x30, 0x3f).r(this, FUNC(ms6102_state::kbd_get));
|
||||
map(0x30, 0x3f).r(this, FUNC(ms6102_state::kbd_get)).nopw();
|
||||
map(0x40, 0x41).rw(this, FUNC(ms6102_state::crtc_r), FUNC(ms6102_state::crtc_w));
|
||||
map(0x50, 0x5f).noprw(); // video disable?
|
||||
map(0x60, 0x6f).w(this, FUNC(ms6102_state::pic_w));
|
||||
@ -218,11 +221,15 @@ READ8_MEMBER(ms6102_state::misc_r)
|
||||
|
||||
READ8_MEMBER(ms6102_state::kbd_get)
|
||||
{
|
||||
m_kbd_ready = false;
|
||||
LOG("kbd_get %02x\n", m_kbd_data);
|
||||
m_pic->r_w(1, 1);
|
||||
return m_kbd_data;
|
||||
}
|
||||
|
||||
void ms6102_state::kbd_put(u8 data)
|
||||
{
|
||||
LOG("kbd_put %02x\n", data);
|
||||
m_kbd_ready = true;
|
||||
m_kbd_data = data;
|
||||
m_pic->r_w(1, 0);
|
||||
@ -250,6 +257,13 @@ IRQ_CALLBACK_MEMBER(ms6102_state::ms6102_int_ack)
|
||||
}
|
||||
|
||||
|
||||
WRITE_LINE_MEMBER(ms6102_state::write_line_clock)
|
||||
{
|
||||
m_i8251->write_txc(state);
|
||||
m_i8251->write_rxc(state);
|
||||
}
|
||||
|
||||
|
||||
void ms6102_state::machine_reset()
|
||||
{
|
||||
m_kbd_ready = false;
|
||||
@ -307,17 +321,15 @@ MACHINE_CONFIG_START(ms6102_state::ms6102)
|
||||
MCFG_I8085A_INTE(DEVWRITELINE("i8214", i8214_device, inte_w))
|
||||
MCFG_CPU_IRQ_ACKNOWLEDGE_DRIVER(ms6102_state, ms6102_int_ack)
|
||||
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
MCFG_DEVICE_ADD("i8214", I8214, XTAL(18'432'000) / 9)
|
||||
MCFG_I8214_INT_CALLBACK(WRITELINE(ms6102_state, irq_w))
|
||||
|
||||
MCFG_DEVICE_ADD("earom", KR1601RR1, 0)
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
MCFG_SCREEN_UPDATE_DEVICE("i8275_1", i8275_device, screen_update)
|
||||
MCFG_SCREEN_REFRESH_RATE(50)
|
||||
MCFG_SCREEN_SIZE(784, 375)
|
||||
MCFG_SCREEN_VISIBLE_AREA(100, 100+80*8-1, 7, 7+24*15-1)
|
||||
MCFG_SCREEN_RAW_PARAMS(XTAL(16'400'000), 784, 0, 80*8, 375, 0, 25*12)
|
||||
MCFG_GFXDECODE_ADD("gfxdecode", "palette", ms6102)
|
||||
MCFG_PALETTE_ADD_MONOCHROME_HIGHLIGHT("palette")
|
||||
|
||||
|
163
src/mame/machine/kr1601rr1.cpp
Normal file
163
src/mame/machine/kr1601rr1.cpp
Normal file
@ -0,0 +1,163 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Sergey Svishchev
|
||||
/***************************************************************************
|
||||
|
||||
KR1601RR1 1024x4 bit EAROM
|
||||
|
||||
Same geometry as GI ER2401, but not pin-compatible.
|
||||
|
||||
To do:
|
||||
- realistic timing esp. for ERASE_ALL
|
||||
- alternate wirings
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "emu.h"
|
||||
#include "kr1601rr1.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#define LOG_GENERAL (1U << 0)
|
||||
|
||||
#define VERBOSE (LOG_GENERAL)
|
||||
//#define LOG_OUTPUT_FUNC printf
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
DEFINE_DEVICE_TYPE(KR1601RR1, kr1601rr1_device, "kr1601rr1", "KR1601RR1 EAROM")
|
||||
|
||||
//-------------------------------------------------
|
||||
// ctor
|
||||
//-------------------------------------------------
|
||||
|
||||
kr1601rr1_device::kr1601rr1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, KR1601RR1, tag, owner, clock)
|
||||
, device_nvram_interface(mconfig, *this)
|
||||
{
|
||||
}
|
||||
|
||||
uint8_t kr1601rr1_device::read(int offset)
|
||||
{
|
||||
assert(EAROM_SIZE > offset);
|
||||
if (m_earom_mode == EAROM_READ)
|
||||
{
|
||||
LOG("earom R %03x == %x\n", offset, m_earom[offset] & 15);
|
||||
return m_earom[offset] & 15;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* wiring hardcoded for ms6102:
|
||||
*
|
||||
* b7..b4 = CS _PR _ER RD
|
||||
* b3..b0 = data
|
||||
*/
|
||||
void kr1601rr1_device::write(int offset, uint8_t data)
|
||||
{
|
||||
assert(EAROM_SIZE > offset);
|
||||
|
||||
switch (data >> 4)
|
||||
{
|
||||
case 0x0: case 0x1: case 0x2: case 0x3:
|
||||
case 0x4: case 0x5: case 0x6: case 0x7:
|
||||
m_earom_mode = EAROM_IDLE;
|
||||
break;
|
||||
|
||||
case 0x8:
|
||||
m_earom_mode = EAROM_ERASE;
|
||||
break;
|
||||
|
||||
case 0xa:
|
||||
m_earom_mode = EAROM_WRITE;
|
||||
break;
|
||||
|
||||
case 0xc:
|
||||
m_earom_mode = EAROM_ERASE_ALL;
|
||||
break;
|
||||
|
||||
case 0xf:
|
||||
m_earom_mode = EAROM_READ;
|
||||
break;
|
||||
}
|
||||
LOG("earom new mode = %u (from %02X)\n", m_earom_mode, data);
|
||||
|
||||
switch (m_earom_mode)
|
||||
{
|
||||
case EAROM_WRITE:
|
||||
LOG("earom W %03x <- %x\n", offset, data & 15);
|
||||
m_earom[offset] |= (data & 15);
|
||||
break;
|
||||
|
||||
case EAROM_ERASE:
|
||||
LOG("earom erase %03x\n", offset);
|
||||
m_earom[offset] = 0;
|
||||
break;
|
||||
|
||||
case EAROM_ERASE_ALL:
|
||||
LOG("earom erase all\n");
|
||||
std::fill(std::begin(m_earom), std::end(m_earom), 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
READ8_MEMBER( kr1601rr1_device::read )
|
||||
{
|
||||
return read(offset);
|
||||
}
|
||||
|
||||
WRITE8_MEMBER( kr1601rr1_device::write )
|
||||
{
|
||||
write(offset, data);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// nvram_default - called to initialize NVRAM to
|
||||
// its default state
|
||||
//-------------------------------------------------
|
||||
|
||||
void kr1601rr1_device::nvram_default()
|
||||
{
|
||||
std::fill(std::begin(m_earom), std::end(m_earom), 0);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// nvram_read - called to read NVRAM from the
|
||||
// .nv file
|
||||
//-------------------------------------------------
|
||||
|
||||
void kr1601rr1_device::nvram_read(emu_file &file)
|
||||
{
|
||||
file.read(m_earom, EAROM_SIZE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// nvram_write - called to write NVRAM to the
|
||||
// .nv file
|
||||
//-------------------------------------------------
|
||||
|
||||
void kr1601rr1_device::nvram_write(emu_file &file)
|
||||
{
|
||||
file.write(m_earom, EAROM_SIZE);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
void kr1601rr1_device::device_start()
|
||||
{
|
||||
/* register for save states */
|
||||
save_item(NAME(m_earom));
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void kr1601rr1_device::device_reset()
|
||||
{
|
||||
m_earom_mode = EAROM_IDLE;
|
||||
}
|
80
src/mame/machine/kr1601rr1.h
Normal file
80
src/mame/machine/kr1601rr1.h
Normal file
@ -0,0 +1,80 @@
|
||||
// license:BSD-3-Clause
|
||||
// copyright-holders:Sergey Svishchev
|
||||
/***************************************************************************
|
||||
|
||||
KR1601RR1 1024x4 bit EAROM
|
||||
|
||||
Same geometry as GI ER2401, but not pin-compatible.
|
||||
|
||||
CS ER PR RD Ax
|
||||
-- -- -- -- --
|
||||
0 x x x x idle
|
||||
1 0 1 0 x erase all
|
||||
1 0 0 0 A erase single
|
||||
1 1 0 0 A write
|
||||
1 1 1 1 A read
|
||||
|
||||
****************************************************************************
|
||||
_____ _____
|
||||
A9 1 |* \_/ | 24
|
||||
CS 2 | | 23 A8
|
||||
D0 3 | | 22 A7
|
||||
_OV 4 | | 21 A6
|
||||
D1 5 | | 20 A5
|
||||
A0 6 | | 19 A4
|
||||
A3 7 | KR1601RR1 | 18 _ER
|
||||
A1 8 | | 17
|
||||
A2 9 | | 16
|
||||
D2 10 | | 15 _UPR
|
||||
D3 11 | | 14 _PR
|
||||
_U1 12 |_____________| 13 RD
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAME_MACHINE_KR1601RR1_H
|
||||
#define MAME_MACHINE_KR1601RR1_H
|
||||
|
||||
#pragma once
|
||||
|
||||
|
||||
// ======================> kr1601rr1_device
|
||||
|
||||
class kr1601rr1_device : public device_t, public device_nvram_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
kr1601rr1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
uint8_t read(int offset);
|
||||
void write(int offset, uint8_t data);
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// device_nvram_interface overrides
|
||||
virtual void nvram_default() override;
|
||||
virtual void nvram_read(emu_file &file) override;
|
||||
virtual void nvram_write(emu_file &file) override;
|
||||
|
||||
private:
|
||||
enum { EAROM_SIZE = 1024 };
|
||||
enum {
|
||||
EAROM_IDLE,
|
||||
EAROM_READ,
|
||||
EAROM_WRITE,
|
||||
EAROM_ERASE,
|
||||
EAROM_ERASE_ALL
|
||||
} m_earom_mode = EAROM_IDLE;
|
||||
|
||||
uint8_t m_earom[EAROM_SIZE];
|
||||
};
|
||||
|
||||
// device type definition
|
||||
DECLARE_DEVICE_TYPE(KR1601RR1, kr1601rr1_device)
|
||||
|
||||
#endif // MAME_MACHINE_KR1601RR1_H
|
Loading…
Reference in New Issue
Block a user