mirror of
https://github.com/holub/mame
synced 2025-05-15 18:32:02 +03:00
ussr/bk.cpp: Added DAC, QBus and unmapped read/write traps. (#12238)
Also fixed cassette motor control and improved video output.
This commit is contained in:
parent
0fd858173b
commit
c0e8399c43
@ -41,19 +41,20 @@ TODO:
|
||||
/* Address maps */
|
||||
void bk_state::bk0010_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0xffff).rw(FUNC(bk_state::trap_r), FUNC(bk_state::trap_w));
|
||||
map(0x0000, 0x3fff).ram();
|
||||
map(0x4000, 0x7fff).ram().share("videoram");
|
||||
map(0x8000, 0xfeff).rom().region("maincpu",0);
|
||||
map(0xffb0, 0xffb1).rw(FUNC(bk_state::key_state_r), FUNC(bk_state::key_state_w));
|
||||
map(0xffb2, 0xffb3).r(FUNC(bk_state::key_code_r));
|
||||
map(0xffb4, 0xffb5).rw(FUNC(bk_state::vid_scroll_r), FUNC(bk_state::vid_scroll_w));
|
||||
map(0xffcc, 0xffcd).noprw();
|
||||
map(0xffce, 0xffcf).rw(FUNC(bk_state::key_press_r), FUNC(bk_state::key_press_w));
|
||||
}
|
||||
|
||||
void bk_state::bk0010fd_mem(address_map &map)
|
||||
{
|
||||
map.unmap_value_high();
|
||||
map(0x0000, 0xffff).rw(FUNC(bk_state::trap_r), FUNC(bk_state::trap_w));
|
||||
map(0x0000, 0x3fff).ram();
|
||||
map(0x4000, 0x7fff).ram().share("videoram");
|
||||
map(0x8000, 0x9fff).rom().region("maincpu",0);
|
||||
@ -64,6 +65,7 @@ void bk_state::bk0010fd_mem(address_map &map)
|
||||
map(0xffb0, 0xffb1).rw(FUNC(bk_state::key_state_r), FUNC(bk_state::key_state_w));
|
||||
map(0xffb2, 0xffb3).r(FUNC(bk_state::key_code_r));
|
||||
map(0xffb4, 0xffb5).rw(FUNC(bk_state::vid_scroll_r), FUNC(bk_state::vid_scroll_w));
|
||||
map(0xffcc, 0xffcd).noprw();
|
||||
map(0xffce, 0xffcf).rw(FUNC(bk_state::key_press_r), FUNC(bk_state::key_press_w));
|
||||
}
|
||||
|
||||
@ -186,6 +188,11 @@ void bk_state::bk0010(machine_config &config)
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &bk_state::bk0010_mem);
|
||||
m_maincpu->in_iack().set(FUNC(bk_state::irq_callback));
|
||||
|
||||
QBUS(config, m_qbus, 0);
|
||||
m_qbus->set_space(m_maincpu, AS_PROGRAM);
|
||||
m_qbus->birq4().set_inputline(m_maincpu, t11_device::VEC_LINE);
|
||||
QBUS_SLOT(config, "qbus" ":1", qbus_cards, nullptr);
|
||||
|
||||
/* video hardware */
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
screen.set_refresh_hz(50);
|
||||
@ -198,9 +205,10 @@ void bk_state::bk0010(machine_config &config)
|
||||
PALETTE(config, "palette", palette_device::MONOCHROME);
|
||||
|
||||
SPEAKER(config, "mono").front_center();
|
||||
DAC_1BIT(config, m_dac, 0).add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
|
||||
CASSETTE(config, m_cassette);
|
||||
m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED);
|
||||
m_cassette->set_default_state(CASSETTE_PLAY | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_DISABLED);
|
||||
m_cassette->add_route(ALL_OUTPUTS, "mono", 0.05);
|
||||
m_cassette->set_interface("bk0010_cass");
|
||||
|
||||
|
@ -10,8 +10,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "bus/qbus/qbus.h"
|
||||
#include "cpu/t11/t11.h"
|
||||
#include "imagedev/cassette.h"
|
||||
#include "sound/dac.h"
|
||||
|
||||
class bk_state : public driver_device
|
||||
{
|
||||
@ -21,6 +23,8 @@ public:
|
||||
, m_vram(*this, "videoram")
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_cassette(*this, "cassette")
|
||||
, m_dac(*this, "dac")
|
||||
, m_qbus(*this, "qbus")
|
||||
, m_io_keyboard(*this, "LINE%u", 0U)
|
||||
{ }
|
||||
|
||||
@ -39,9 +43,11 @@ private:
|
||||
uint16_t key_code_r();
|
||||
uint16_t vid_scroll_r();
|
||||
uint16_t key_press_r();
|
||||
uint16_t trap_r();
|
||||
void key_state_w(uint16_t data);
|
||||
void vid_scroll_w(uint16_t data);
|
||||
void key_press_w(uint16_t data);
|
||||
void trap_w(uint16_t data);
|
||||
uint16_t floppy_cmd_r();
|
||||
void floppy_cmd_w(uint16_t data);
|
||||
uint16_t floppy_data_r();
|
||||
@ -54,6 +60,8 @@ private:
|
||||
required_shared_ptr<uint16_t> m_vram;
|
||||
required_device<t11_device> m_maincpu;
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
required_device<dac_bit_interface> m_dac;
|
||||
required_device<qbus_device> m_qbus;
|
||||
required_ioport_array<12> m_io_keyboard;
|
||||
void bk0010_mem(address_map &map);
|
||||
void bk0010fd_mem(address_map &map);
|
||||
|
@ -102,6 +102,13 @@ uint16_t bk_state::key_press_r()
|
||||
return 0x8080 | m_key_pressed | cas;
|
||||
}
|
||||
|
||||
uint16_t bk_state::trap_r()
|
||||
{
|
||||
if (!machine().side_effects_disabled())
|
||||
m_maincpu->pulse_input_line(t11_device::BUS_ERROR, attotime::zero);
|
||||
return ~0;
|
||||
}
|
||||
|
||||
void bk_state::key_state_w(uint16_t data)
|
||||
{
|
||||
m_kbd_state = (m_kbd_state & ~0x40) | (data & 0x40);
|
||||
@ -114,7 +121,14 @@ void bk_state::vid_scroll_w(uint16_t data)
|
||||
|
||||
void bk_state::key_press_w(uint16_t data)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
void bk_state::trap_w(uint16_t data)
|
||||
{
|
||||
m_maincpu->pulse_input_line(t11_device::BUS_ERROR, attotime::zero);
|
||||
}
|
||||
|
||||
uint16_t bk_state::floppy_cmd_r()
|
||||
@ -151,13 +165,14 @@ void bk_state::floppy_data_w(uint16_t data)
|
||||
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user