mirror of
https://github.com/holub/mame
synced 2025-04-26 18:23:08 +03:00
juku: Major updates
- Improve timers to make interrupts work - Emulate keyboard You can now use the system with the builtin monitor.
This commit is contained in:
parent
4914ff2a7c
commit
4bcb09b29c
@ -19,6 +19,7 @@
|
||||
|
||||
#include "emu.h"
|
||||
#include "cpu/i8085/i8085.h"
|
||||
#include "machine/74148.h"
|
||||
#include "machine/bankdev.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/i8255.h"
|
||||
@ -41,7 +42,10 @@ public:
|
||||
m_pic(*this, "pic"),
|
||||
m_pit(*this, "pit%u", 0U),
|
||||
m_pio(*this, "pio%u", 0U),
|
||||
m_sio(*this, "sio%u", 0U)
|
||||
m_sio(*this, "sio%u", 0U),
|
||||
m_key_encoder(*this, "keyenc"),
|
||||
m_keys(*this, "COL.%u", 0U),
|
||||
m_key_special(*this, "SPECIAL")
|
||||
{ }
|
||||
|
||||
void juku(machine_config &config);
|
||||
@ -57,11 +61,16 @@ private:
|
||||
required_device_array<pit8253_device, 3> m_pit;
|
||||
required_device_array<i8255_device, 2> m_pio;
|
||||
required_device_array<i8251_device, 2> m_sio;
|
||||
required_device<ttl74148_device> m_key_encoder;
|
||||
required_ioport_array<16> m_keys;
|
||||
required_ioport m_key_special;
|
||||
|
||||
void mem_map(address_map &map);
|
||||
void bank_map(address_map &map);
|
||||
void io_map(address_map &map);
|
||||
|
||||
void pio0_porta_w(uint8_t data);
|
||||
uint8_t pio0_portb_r();
|
||||
void pio0_portc_w(uint8_t data);
|
||||
|
||||
uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
|
||||
@ -114,6 +123,148 @@ void juku_state::io_map(address_map &map)
|
||||
//**************************************************************************
|
||||
|
||||
static INPUT_PORTS_START( juku )
|
||||
PORT_START("COL.0")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_N) // n N
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y) // y Y
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_6) // 6 &
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_H) // h H
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.1")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_X) // x X
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_W) // w W
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_2) // 2 "
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_S) // s S
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.2")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_V) // v V
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_R) // r R
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_4) // 4 $
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F) // f F
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.3")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB)
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ESC)
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CAPSLOCK)
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.4")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_B) // b B
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_T) // t T
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_5) // 5 %
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_G) // g G
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.5")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z) // z Z
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q) // q Q
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_1) // 1 !
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_A) // a A
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.6")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_C) // c C
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_E) // e E
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_3) // 3 #
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_D) // d D
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.7")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_M) // m M
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_U) // u U
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_7) // 7 '
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_J) // j J
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.8")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DEL)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE) // ] õ
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) // ERASE
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER)
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.9")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE) // [ ö
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH) // Ä Ü
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.10")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F9) // õ Õ
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F10) // ö Õ
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F11) // : *
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.11")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F12) // ; +
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS) // ü Ü
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS) // - =
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE) // ä Ä
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.12")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_SLASH) // / ?
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_P) // p P
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_0) // 0 _
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON) // ö Ö
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.13")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP) // . >
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT)
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_O) // o O
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_9) // 9 )
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_L) // l L
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("COL.14")
|
||||
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8)
|
||||
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA) // , <
|
||||
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_TILDE) // LAT/RUS
|
||||
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_I) // i I
|
||||
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_8) // 8 (
|
||||
PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_K) // k K
|
||||
PORT_BIT(0xc0, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
// CONTRDAT?
|
||||
PORT_START("COL.15")
|
||||
PORT_BIT(0xff, IP_ACTIVE_LOW, IPT_UNUSED)
|
||||
|
||||
PORT_START("SPECIAL")
|
||||
PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)
|
||||
PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)
|
||||
INPUT_PORTS_END
|
||||
|
||||
|
||||
@ -135,8 +286,50 @@ uint32_t juku_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap,
|
||||
// MACHINE EMULATION
|
||||
//**************************************************************************
|
||||
|
||||
void juku_state::pio0_porta_w(uint8_t data)
|
||||
{
|
||||
// 7------- stb
|
||||
// -6------ pren
|
||||
// --5----- not used?
|
||||
// ---4---- audc
|
||||
// ----3210 keyboard column
|
||||
|
||||
for (int i = 0; i < 6; i++)
|
||||
m_key_encoder->input_line_w(i, BIT(m_keys[data & 0x0f]->read(), i));
|
||||
|
||||
m_key_encoder->update();
|
||||
|
||||
// logerror("porta_w %02x\n", data);
|
||||
}
|
||||
|
||||
uint8_t juku_state::pio0_portb_r()
|
||||
{
|
||||
// 7------- ctrl
|
||||
// -6------ shift
|
||||
// --54---- not used
|
||||
// ----321- keyboard data
|
||||
// -------0 key pressed
|
||||
|
||||
uint8_t data = 0;
|
||||
|
||||
data |= m_key_special->read();
|
||||
data |= 0x30;
|
||||
data |= m_key_encoder->output_r() << 1;
|
||||
data |= m_key_encoder->output_valid_r();
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void juku_state::pio0_portc_w(uint8_t data)
|
||||
{
|
||||
// 7------- (cas?) pof
|
||||
// -6------ (cas?) stop
|
||||
// --5----- (cas?) rn
|
||||
// ---4---- (cas?) ff
|
||||
// ----3--- (cas?) play
|
||||
// -----2-- (cas?) rec
|
||||
// ------10 memory mode
|
||||
|
||||
m_bank->set_bank(data & 0x03);
|
||||
}
|
||||
|
||||
@ -149,11 +342,15 @@ void juku_state::machine_start()
|
||||
membank("ram_0000")->set_base(&m_ram[0x0000]);
|
||||
membank("ram_4000")->set_base(&m_ram[0x4000]);
|
||||
membank("ram_c000")->set_base(&m_ram[0xc000]);
|
||||
|
||||
// register for save states
|
||||
save_pointer(NAME(m_ram), 0x10000);
|
||||
}
|
||||
|
||||
void juku_state::machine_reset()
|
||||
{
|
||||
m_bank->set_bank(0);
|
||||
m_key_encoder->enable_input_w(0);
|
||||
}
|
||||
|
||||
|
||||
@ -183,6 +380,8 @@ void juku_state::juku(machine_config &config)
|
||||
PIT8253(config, m_pit[0], 0);
|
||||
m_pit[0]->set_clk<0>(16_MHz_XTAL/16);
|
||||
m_pit[0]->out_handler<0>().set(m_pit[1], FUNC(pit8253_device::write_clk0));
|
||||
m_pit[0]->out_handler<0>().append(m_pit[0], FUNC(pit8253_device::write_gate1));
|
||||
m_pit[0]->out_handler<0>().append(m_pit[0], FUNC(pit8253_device::write_gate2));
|
||||
m_pit[0]->set_clk<1>(16_MHz_XTAL/16);
|
||||
m_pit[0]->set_clk<2>(16_MHz_XTAL/16);
|
||||
m_pit[0]->out_handler<2>().set(m_pit[1], FUNC(pit8253_device::write_clk1));
|
||||
@ -190,6 +389,8 @@ void juku_state::juku(machine_config &config)
|
||||
|
||||
// КР580ВИ53
|
||||
PIT8253(config, m_pit[1], 0);
|
||||
m_pit[1]->out_handler<0>().set(m_pit[1], FUNC(pit8253_device::write_gate1));
|
||||
m_pit[1]->out_handler<0>().append(m_pit[1], FUNC(pit8253_device::write_gate2));
|
||||
m_pit[1]->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir5_w));
|
||||
|
||||
// КР580ВИ53
|
||||
@ -197,6 +398,8 @@ void juku_state::juku(machine_config &config)
|
||||
|
||||
// КР580ВВ55A
|
||||
I8255A(config, m_pio[0]);
|
||||
m_pio[0]->out_pa_callback().set(FUNC(juku_state::pio0_porta_w));
|
||||
m_pio[0]->in_pb_callback().set(FUNC(juku_state::pio0_portb_r));
|
||||
m_pio[0]->out_pc_callback().set(FUNC(juku_state::pio0_portc_w));
|
||||
|
||||
// КР580ВВ55A
|
||||
@ -218,6 +421,8 @@ void juku_state::juku(machine_config &config)
|
||||
screen.set_size(320, 240);
|
||||
screen.set_visarea(0, 319, 0, 239);
|
||||
screen.set_screen_update(FUNC(juku_state::screen_update));
|
||||
|
||||
TTL74148(config, m_key_encoder, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -243,4 +448,4 @@ ROM_END
|
||||
//**************************************************************************
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
|
||||
COMP( 1988, juku, 0, 0, juku, juku, juku_state, empty_init, "Estron", "Juku E5101", MACHINE_NOT_WORKING | MACHINE_NO_SOUND )
|
||||
COMP( 1988, juku, 0, 0, juku, juku, juku_state, empty_init, "Estron", "Juku E5101", MACHINE_NOT_WORKING | MACHINE_NO_SOUND | MACHINE_SUPPORTS_SAVE)
|
||||
|
Loading…
Reference in New Issue
Block a user