diff options
Diffstat (limited to 'src/mame/ussr/bk_m.cpp')
-rw-r--r-- | src/mame/ussr/bk_m.cpp | 146 |
1 files changed, 44 insertions, 102 deletions
diff --git a/src/mame/ussr/bk_m.cpp b/src/mame/ussr/bk_m.cpp index d0566302510..50a98d5d977 100644 --- a/src/mame/ussr/bk_m.cpp +++ b/src/mame/ussr/bk_m.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Miodrag Milanovic +// copyright-holders:Miodrag Milanovic, Sergey Svishchev /*************************************************************************** BK machine driver by Miodrag Milanovic @@ -13,151 +13,93 @@ #include "bk.h" -TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) -{ - uint8_t code, i, j; - - for(i = 1; i < 12; i++) - { - code = m_io_keyboard[i]->read(); - if (code != 0) - { - for(j = 0; j < 8; j++) - { - if (code == (1 << j)) - { - m_key_code = j + i*8; - break; - } - } - if (BIT(m_io_keyboard[0]->read(), 2)) - { - if (i==6 || i==7) - m_key_code -= 16; - else - if (i>=8 && i<=11) - m_key_code += 32; - } - m_key_pressed = 0x40; - - if (!BIT(m_io_keyboard[0]->read(), 1)) - m_key_irq_vector = 0x30; - else - m_key_irq_vector = 0xBC; - - m_maincpu->set_input_line(0, ASSERT_LINE); - break; - } - } -} - - void bk_state::machine_start() { save_item(NAME(m_scroll)); - save_item(NAME(m_kbd_state)); - save_item(NAME(m_key_code)); - save_item(NAME(m_key_pressed)); - save_item(NAME(m_key_irq_vector)); + save_item(NAME(m_sel1)); save_item(NAME(m_drive)); - - m_maincpu->set_input_line(t11_device::VEC_LINE, ASSERT_LINE); - - m_kbd_timer = timer_alloc(FUNC(bk_state::keyboard_callback), this); - m_kbd_timer->adjust(attotime::from_hz(2400), 0, attotime::from_hz(2400)); -} - -uint8_t bk_state::irq_callback(offs_t offset) -{ - m_maincpu->set_input_line(0, CLEAR_LINE); - return m_key_irq_vector; } void bk_state::machine_reset() { - m_kbd_state = 0; + m_sel1 = SEL1_KEYDOWN | SEL1_MOTOR; m_scroll = 01330; } -uint16_t bk_state::key_state_r() +void bk_state::reset_w(int state) { - return m_kbd_state; -} -uint16_t bk_state::key_code_r() -{ - m_kbd_state &= ~0x80; // mark reading done - m_key_pressed = 0; - return m_key_code; + if (state == ASSERT_LINE) + { + m_kbd->reset(); + m_qbus->init_w(); + } } + uint16_t bk_state::vid_scroll_r() { return m_scroll; } -uint16_t bk_state::key_press_r() +// SEL1 register (0010 and 0010.01) +// +// 15-8 R high byte of cpu start address +// 7 R bitbanger cts in +// 7 W cassette motor control, 1: off 0: on +// 6 R keyboard any key down, 1: no 0: yes +// 6 W cassette data and speaker out +// 5 R cassette data in +// 5 W cassette data and bitbanger rts out +// 4 R bitbanger rx +// 4 W bitbanger tx +// 2 R updated +// +// only original 0010 has bitbanger wired to UP connector + +uint16_t bk_state::sel1_r() { double level = m_cassette->input(); - uint16_t cas = (level < 0) ? 0 : 0x20; + uint16_t data = 0100000 | m_sel1 | ((level < 0) ? 0 : SEL1_RX_CAS); + if (!machine().side_effects_disabled()) + m_sel1 &= ~SEL1_UPDATED; - return 0x8080 | m_key_pressed | cas; + return data; } -void bk_state::key_state_w(uint16_t data) +uint16_t bk_state::trap_r() { - m_kbd_state = (m_kbd_state & ~0x40) | (data & 0x40); + if (!machine().side_effects_disabled()) + m_maincpu->pulse_input_line(t11_device::BUS_ERROR, attotime::zero); + return ~0; } void bk_state::vid_scroll_w(uint16_t data) { - m_scroll = data; + m_scroll = data & 01377; } -void bk_state::key_press_w(uint16_t data) +void bk_state::sel1_w(uint16_t data) { + m_sel1 |= SEL1_UPDATED; + m_dac->write(BIT(data, 6)); m_cassette->output(BIT(data, 6) ? 1.0 : -1.0); + m_cassette->change_state((BIT(data, 7)) ? CASSETTE_MOTOR_DISABLED : CASSETTE_MOTOR_ENABLED, CASSETTE_MASK_MOTOR); } -uint16_t bk_state::floppy_cmd_r() -{ - return 0; -} - -void bk_state::floppy_cmd_w(uint16_t data) -{ - if (BIT(data, 0)) - m_drive = 0; - - if (BIT(data, 1)) - m_drive = 1; - - if (BIT(data, 2)) - m_drive = 2; - - if (BIT(data, 3)) - m_drive = 3; - - if (data == 0) - m_drive = -1; -} - -uint16_t bk_state::floppy_data_r() -{ - return 0; -} - -void bk_state::floppy_data_w(uint16_t data) +void bk_state::trap_w(uint16_t data) { + m_maincpu->pulse_input_line(t11_device::BUS_ERROR, attotime::zero); } u32 bk_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - u16 const nOfs = (m_scroll - 728) % 256; + u16 const mini = !BIT(m_scroll, 9); + u16 const nOfs = (m_scroll & 255) + (mini ? 40 : -216); for (u16 y = 0; y < 256; y++) { for (u16 x = 0; x < 32; x++) { - u16 const code = m_vram[((y+nOfs) %256)*32 + x]; + u16 const code = (y > 63 && mini) ? 0 : m_vram[((y+nOfs) %256)*32 + x]; for (u8 b = 0; b < 16; b++) bitmap.pix(y, x*16 + b) = BIT(code, b); } |