mirror of
https://github.com/holub/mame
synced 2025-06-06 12:53:46 +03:00
b2m: cleanup
This commit is contained in:
parent
f7dd9f4090
commit
3df9450726
@ -1889,7 +1889,6 @@ files {
|
|||||||
MAME_DIR .. "src/mame/drivers/b2m.cpp",
|
MAME_DIR .. "src/mame/drivers/b2m.cpp",
|
||||||
MAME_DIR .. "src/mame/includes/b2m.h",
|
MAME_DIR .. "src/mame/includes/b2m.h",
|
||||||
MAME_DIR .. "src/mame/machine/b2m.cpp",
|
MAME_DIR .. "src/mame/machine/b2m.cpp",
|
||||||
MAME_DIR .. "src/mame/video/b2m.cpp",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
createMESSProjects(_target, _subtarget, "bondwell")
|
createMESSProjects(_target, _subtarget, "bondwell")
|
||||||
|
@ -2,24 +2,40 @@
|
|||||||
// copyright-holders:Miodrag Milanovic
|
// copyright-holders:Miodrag Milanovic
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
|
||||||
Bashkiria-2M driver by Miodrag Milanovic
|
Bashkiria-2M driver by Miodrag Milanovic
|
||||||
|
|
||||||
28/03/2008 Preliminary driver.
|
2008-03-28 Preliminary driver.
|
||||||
|
|
||||||
|
To get numbers, you have to hold down Shift.
|
||||||
|
|
||||||
|
B2M:
|
||||||
|
- Hit enter while the square block is showing - it will attempt to boot
|
||||||
|
a disk. But, it is loaded corruptly, and it runs into the weeds.
|
||||||
|
- Or, just wait and a menu appears with choices S,L,W,R,G. It's all in
|
||||||
|
Russian, and choosing any of them produces an error.
|
||||||
|
|
||||||
|
B2MROM:
|
||||||
|
- At start you are in an empty ramdisk called A:
|
||||||
|
- You can use SAVE to create an empty file in the CP/M fashion, and you can
|
||||||
|
TYPE it.
|
||||||
|
- You can go to Basic by typing BAS. This is corrupted and only a few
|
||||||
|
commands are accepted: REM, LIST. The commands RUN and NEW cause a disk
|
||||||
|
error and the machine freezes. SYSTEM quits back to A:
|
||||||
|
- There's nothing else on the romdisk.
|
||||||
|
|
||||||
|
So, in the end, nothing useful works.
|
||||||
|
|
||||||
|
Need a schematic so that the fdc could be repaired.
|
||||||
|
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "cpu/i8085/i8085.h"
|
#include "cpu/i8085/i8085.h"
|
||||||
#include "machine/i8255.h"
|
|
||||||
#include "machine/pic8259.h"
|
|
||||||
#include "machine/i8251.h"
|
#include "machine/i8251.h"
|
||||||
#include "machine/wd_fdc.h"
|
|
||||||
#include "machine/ram.h"
|
|
||||||
#include "includes/b2m.h"
|
#include "includes/b2m.h"
|
||||||
#include "formats/smx_dsk.h"
|
#include "formats/smx_dsk.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "softlist.h"
|
|
||||||
#include "speaker.h"
|
#include "speaker.h"
|
||||||
|
|
||||||
/* Address maps */
|
/* Address maps */
|
||||||
@ -36,10 +52,10 @@ void b2m_state::b2m_io(address_map &map)
|
|||||||
{
|
{
|
||||||
map.global_mask(0x1f);
|
map.global_mask(0x1f);
|
||||||
map(0x00, 0x03).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
map(0x00, 0x03).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
||||||
map(0x04, 0x07).rw("ppi8255_2", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
map(0x04, 0x07).rw("ppi2", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||||
map(0x08, 0x0b).rw("ppi8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
map(0x08, 0x0b).rw("ppi1", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||||
map(0x0c, 0x0c).rw(FUNC(b2m_state::b2m_localmachine_r), FUNC(b2m_state::b2m_localmachine_w));
|
map(0x0c, 0x0c).rw(FUNC(b2m_state::localmachine_r), FUNC(b2m_state::localmachine_w));
|
||||||
map(0x10, 0x13).rw(FUNC(b2m_state::b2m_palette_r), FUNC(b2m_state::b2m_palette_w));
|
map(0x10, 0x13).rw(FUNC(b2m_state::palette_r), FUNC(b2m_state::palette_w));
|
||||||
map(0x14, 0x15).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write));
|
map(0x14, 0x15).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write));
|
||||||
map(0x18, 0x19).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
map(0x18, 0x19).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
||||||
map(0x1c, 0x1f).rw(m_fdc, FUNC(fd1793_device::read), FUNC(fd1793_device::write));
|
map(0x1c, 0x1f).rw(m_fdc, FUNC(fd1793_device::read), FUNC(fd1793_device::write));
|
||||||
@ -49,10 +65,10 @@ void b2m_state::b2m_rom_io(address_map &map)
|
|||||||
{
|
{
|
||||||
map.global_mask(0x1f);
|
map.global_mask(0x1f);
|
||||||
map(0x00, 0x03).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
map(0x00, 0x03).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
||||||
map(0x04, 0x07).rw("ppi8255_3", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
map(0x04, 0x07).rw("ppi3", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||||
map(0x08, 0x0b).rw("ppi8255_1", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
map(0x08, 0x0b).rw("ppi1", FUNC(i8255_device::read), FUNC(i8255_device::write));
|
||||||
map(0x0c, 0x0c).rw(FUNC(b2m_state::b2m_localmachine_r), FUNC(b2m_state::b2m_localmachine_w));
|
map(0x0c, 0x0c).rw(FUNC(b2m_state::localmachine_r), FUNC(b2m_state::localmachine_w));
|
||||||
map(0x10, 0x13).rw(FUNC(b2m_state::b2m_palette_r), FUNC(b2m_state::b2m_palette_w));
|
map(0x10, 0x13).rw(FUNC(b2m_state::palette_r), FUNC(b2m_state::palette_w));
|
||||||
map(0x14, 0x15).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write));
|
map(0x14, 0x15).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write));
|
||||||
map(0x18, 0x19).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
map(0x18, 0x19).rw("uart", FUNC(i8251_device::read), FUNC(i8251_device::write));
|
||||||
}
|
}
|
||||||
@ -192,8 +208,8 @@ void b2m_state::b2m(machine_config &config)
|
|||||||
i8080_cpu_device &maincpu(I8080(config, m_maincpu, 2000000));
|
i8080_cpu_device &maincpu(I8080(config, m_maincpu, 2000000));
|
||||||
maincpu.set_addrmap(AS_PROGRAM, &b2m_state::b2m_mem);
|
maincpu.set_addrmap(AS_PROGRAM, &b2m_state::b2m_mem);
|
||||||
maincpu.set_addrmap(AS_IO, &b2m_state::b2m_io);
|
maincpu.set_addrmap(AS_IO, &b2m_state::b2m_io);
|
||||||
maincpu.set_vblank_int("screen", FUNC(b2m_state::b2m_vblank_interrupt));
|
maincpu.set_vblank_int("screen", FUNC(b2m_state::vblank_interrupt));
|
||||||
maincpu.in_inta_func().set("pic8259", FUNC(pic8259_device::acknowledge));
|
maincpu.in_inta_func().set("pic", FUNC(pic8259_device::acknowledge));
|
||||||
|
|
||||||
/* video hardware */
|
/* video hardware */
|
||||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||||
@ -201,7 +217,7 @@ void b2m_state::b2m(machine_config &config)
|
|||||||
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
|
screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); /* not accurate */
|
||||||
screen.set_size(384, 256);
|
screen.set_size(384, 256);
|
||||||
screen.set_visarea_full();
|
screen.set_visarea_full();
|
||||||
screen.set_screen_update(FUNC(b2m_state::screen_update_b2m));
|
screen.set_screen_update(FUNC(b2m_state::screen_update));
|
||||||
screen.set_palette(m_palette);
|
screen.set_palette(m_palette);
|
||||||
|
|
||||||
PALETTE(config, m_palette, FUNC(b2m_state::b2m_palette), 4);
|
PALETTE(config, m_palette, FUNC(b2m_state::b2m_palette), 4);
|
||||||
@ -210,23 +226,23 @@ void b2m_state::b2m(machine_config &config)
|
|||||||
m_pit->set_clk<0>(0);
|
m_pit->set_clk<0>(0);
|
||||||
m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir1_w));
|
m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir1_w));
|
||||||
m_pit->set_clk<1>(2000000);
|
m_pit->set_clk<1>(2000000);
|
||||||
m_pit->out_handler<1>().set(FUNC(b2m_state::bm2_pit_out1));
|
m_pit->out_handler<1>().set(FUNC(b2m_state::pit_out1));
|
||||||
m_pit->set_clk<2>(2000000);
|
m_pit->set_clk<2>(2000000);
|
||||||
m_pit->out_handler<2>().set(m_pit, FUNC(pit8253_device::write_clk0));
|
m_pit->out_handler<2>().set(m_pit, FUNC(pit8253_device::write_clk0));
|
||||||
|
|
||||||
i8255_device &ppi1(I8255(config, "ppi8255_1"));
|
i8255_device &ppi1(I8255(config, "ppi1"));
|
||||||
ppi1.out_pa_callback().set(FUNC(b2m_state::b2m_8255_porta_w));
|
ppi1.out_pa_callback().set(FUNC(b2m_state::ppi1_porta_w));
|
||||||
ppi1.in_pb_callback().set(FUNC(b2m_state::b2m_8255_portb_r));
|
ppi1.in_pb_callback().set(FUNC(b2m_state::ppi1_portb_r));
|
||||||
ppi1.out_pb_callback().set(FUNC(b2m_state::b2m_8255_portb_w));
|
ppi1.out_pb_callback().set(FUNC(b2m_state::ppi1_portb_w));
|
||||||
ppi1.out_pc_callback().set(FUNC(b2m_state::b2m_8255_portc_w));
|
ppi1.out_pc_callback().set(FUNC(b2m_state::ppi1_portc_w));
|
||||||
|
|
||||||
i8255_device &ppi2(I8255(config, "ppi8255_2"));
|
i8255_device &ppi2(I8255(config, "ppi2"));
|
||||||
ppi2.out_pc_callback().set(FUNC(b2m_state::b2m_ext_8255_portc_w));
|
ppi2.out_pc_callback().set(FUNC(b2m_state::ppi2_portc_w));
|
||||||
|
|
||||||
i8255_device &ppi3(I8255(config, "ppi8255_3"));
|
i8255_device &ppi3(I8255(config, "ppi3"));
|
||||||
ppi3.in_pa_callback().set(FUNC(b2m_state::b2m_romdisk_porta_r));
|
ppi3.in_pa_callback().set(FUNC(b2m_state::romdisk_porta_r));
|
||||||
ppi3.out_pb_callback().set(FUNC(b2m_state::b2m_romdisk_portb_w));
|
ppi3.out_pb_callback().set(FUNC(b2m_state::romdisk_portb_w));
|
||||||
ppi3.out_pc_callback().set(FUNC(b2m_state::b2m_romdisk_portc_w));
|
ppi3.out_pc_callback().set(FUNC(b2m_state::romdisk_portc_w));
|
||||||
|
|
||||||
PIC8259(config, m_pic, 0);
|
PIC8259(config, m_pic, 0);
|
||||||
m_pic->out_int_callback().set_inputline(m_maincpu, 0);
|
m_pic->out_int_callback().set_inputline(m_maincpu, 0);
|
||||||
@ -239,7 +255,7 @@ void b2m_state::b2m(machine_config &config)
|
|||||||
I8251(config, "uart", 0);
|
I8251(config, "uart", 0);
|
||||||
|
|
||||||
FD1793(config, m_fdc, 8_MHz_XTAL / 8);
|
FD1793(config, m_fdc, 8_MHz_XTAL / 8);
|
||||||
m_fdc->drq_wr_callback().set(FUNC(b2m_state::b2m_fdc_drq));
|
m_fdc->drq_wr_callback().set(FUNC(b2m_state::fdc_drq));
|
||||||
|
|
||||||
FLOPPY_CONNECTOR(config, "fd0", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats);
|
FLOPPY_CONNECTOR(config, "fd0", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats);
|
||||||
FLOPPY_CONNECTOR(config, "fd1", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats);
|
FLOPPY_CONNECTOR(config, "fd1", b2m_floppies, "525qd", b2m_state::b2m_floppy_formats);
|
||||||
@ -258,19 +274,19 @@ void b2m_state::b2mrom(machine_config &config)
|
|||||||
/* ROM definition */
|
/* ROM definition */
|
||||||
|
|
||||||
ROM_START( b2m )
|
ROM_START( b2m )
|
||||||
ROM_REGION( 0x12000, "maincpu", ROMREGION_ERASEFF )
|
ROM_REGION( 0x2000, "maincpu", 0 )
|
||||||
ROM_LOAD( "b2m.rom", 0x10000, 0x2000, CRC(3f3214d6) SHA1(dd93e7fbabf14d1aed6777fe1ccfe0a3ca8fcaf2) )
|
ROM_LOAD( "b2m.rom", 0x0000, 0x2000, CRC(3f3214d6) SHA1(dd93e7fbabf14d1aed6777fe1ccfe0a3ca8fcaf2) )
|
||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
ROM_START( b2mrom )
|
ROM_START( b2mrom )
|
||||||
ROM_REGION( 0x22000, "maincpu", ROMREGION_ERASEFF )
|
ROM_REGION( 0x12000, "maincpu", ROMREGION_ERASEFF )
|
||||||
ROM_LOAD( "bios2.rom", 0x10000, 0x2000, CRC(c22a98b7) SHA1(7de91e653bf4b191ded62cf21532578268e4a2c1) )
|
ROM_LOAD( "bios2.rom", 0x00000, 0x2000, CRC(c22a98b7) SHA1(7de91e653bf4b191ded62cf21532578268e4a2c1) )
|
||||||
ROM_LOAD( "ramdos.sys", 0x12000, 0x60c0, CRC(91ed6df0) SHA1(4fd040f2647a6b7930c330c75560a035027d0606) )
|
ROM_LOAD( "ramdos.sys", 0x02000, 0x60c0, CRC(91ed6df0) SHA1(4fd040f2647a6b7930c330c75560a035027d0606) )
|
||||||
ROM_END
|
ROM_END
|
||||||
|
|
||||||
|
|
||||||
/* Driver */
|
/* Driver */
|
||||||
|
|
||||||
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
|
/* YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS */
|
||||||
COMP( 1989, b2m, 0, 0, b2m, b2m, b2m_state, empty_init, "BNPO", "Bashkiria-2M", MACHINE_SUPPORTS_SAVE)
|
COMP( 1989, b2m, 0, 0, b2m, b2m, b2m_state, empty_init, "BNPO", "Bashkiria-2M", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE)
|
||||||
COMP( 1989, b2mrom, b2m, 0, b2mrom, b2m, b2m_state, empty_init, "BNPO", "Bashkiria-2M ROM-disk", MACHINE_SUPPORTS_SAVE)
|
COMP( 1989, b2mrom, b2m, 0, b2mrom, b2m, b2m_state, empty_init, "BNPO", "Bashkiria-2M ROM-disk", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE)
|
||||||
|
@ -27,62 +27,59 @@ public:
|
|||||||
: driver_device(mconfig, type, tag)
|
: driver_device(mconfig, type, tag)
|
||||||
, m_maincpu(*this, "maincpu")
|
, m_maincpu(*this, "maincpu")
|
||||||
, m_speaker(*this, "speaker")
|
, m_speaker(*this, "speaker")
|
||||||
, m_pit(*this, "pit8253")
|
, m_pit(*this, "pit")
|
||||||
, m_ram(*this, RAM_TAG)
|
, m_ram(*this, RAM_TAG)
|
||||||
, m_palette(*this, "palette")
|
, m_palette(*this, "palette")
|
||||||
, m_fdc(*this, "fd1793")
|
, m_fdc(*this, "fdc")
|
||||||
, m_fd(*this, "fd%u", 0U)
|
, m_fd(*this, "fdc:%u", 0U)
|
||||||
, m_pic(*this, "pic8259")
|
, m_pic(*this, "pic")
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
uint8_t b2m_keyboard_r(offs_t offset);
|
|
||||||
void b2m_palette_w(offs_t offset, uint8_t data);
|
|
||||||
uint8_t b2m_palette_r(offs_t offset);
|
|
||||||
void b2m_localmachine_w(uint8_t data);
|
|
||||||
uint8_t b2m_localmachine_r();
|
|
||||||
void init_b2m();
|
|
||||||
|
|
||||||
void b2m_palette(palette_device &palette) const;
|
|
||||||
uint32_t screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
|
||||||
INTERRUPT_GEN_MEMBER(b2m_vblank_interrupt);
|
|
||||||
DECLARE_WRITE_LINE_MEMBER(bm2_pit_out1);
|
|
||||||
void b2m_8255_porta_w(uint8_t data);
|
|
||||||
void b2m_8255_portb_w(uint8_t data);
|
|
||||||
void b2m_8255_portc_w(uint8_t data);
|
|
||||||
uint8_t b2m_8255_portb_r();
|
|
||||||
void b2m_ext_8255_portc_w(uint8_t data);
|
|
||||||
uint8_t b2m_romdisk_porta_r();
|
|
||||||
void b2m_romdisk_portb_w(uint8_t data);
|
|
||||||
void b2m_romdisk_portc_w(uint8_t data);
|
|
||||||
DECLARE_WRITE_LINE_MEMBER(b2m_fdc_drq);
|
|
||||||
DECLARE_FLOPPY_FORMATS( b2m_floppy_formats );
|
|
||||||
|
|
||||||
void b2mrom(machine_config &config);
|
void b2mrom(machine_config &config);
|
||||||
void b2m(machine_config &config);
|
void b2m(machine_config &config);
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint8_t keyboard_r(offs_t offset);
|
||||||
|
void palette_w(offs_t offset, uint8_t data);
|
||||||
|
uint8_t palette_r(offs_t offset);
|
||||||
|
void localmachine_w(uint8_t data);
|
||||||
|
uint8_t localmachine_r();
|
||||||
|
|
||||||
|
void b2m_palette(palette_device &palette) const;
|
||||||
|
uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
|
INTERRUPT_GEN_MEMBER(vblank_interrupt);
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(pit_out1);
|
||||||
|
void ppi1_porta_w(uint8_t data);
|
||||||
|
void ppi1_portb_w(uint8_t data);
|
||||||
|
void ppi1_portc_w(uint8_t data);
|
||||||
|
uint8_t ppi1_portb_r();
|
||||||
|
void ppi2_portc_w(uint8_t data);
|
||||||
|
uint8_t romdisk_porta_r();
|
||||||
|
void romdisk_portb_w(uint8_t data);
|
||||||
|
void romdisk_portc_w(uint8_t data);
|
||||||
|
DECLARE_WRITE_LINE_MEMBER(fdc_drq);
|
||||||
|
DECLARE_FLOPPY_FORMATS( b2m_floppy_formats );
|
||||||
|
|
||||||
void b2m_io(address_map &map);
|
void b2m_io(address_map &map);
|
||||||
void b2m_mem(address_map &map);
|
void b2m_mem(address_map &map);
|
||||||
void b2m_rom_io(address_map &map);
|
void b2m_rom_io(address_map &map);
|
||||||
protected:
|
void machine_start() override;
|
||||||
virtual void machine_start() override;
|
void machine_reset() override;
|
||||||
virtual void machine_reset() override;
|
|
||||||
virtual void video_start() override;
|
|
||||||
|
|
||||||
void b2m_postload();
|
void postload();
|
||||||
void b2m_set_bank(int bank);
|
void set_bank(int bank);
|
||||||
|
|
||||||
uint8_t m_b2m_8255_porta;
|
uint8_t m_porta;
|
||||||
uint8_t m_b2m_video_scroll;
|
uint8_t m_video_scroll;
|
||||||
uint8_t m_b2m_8255_portc;
|
uint8_t m_portc;
|
||||||
|
|
||||||
uint8_t m_b2m_video_page;
|
uint8_t m_video_page;
|
||||||
uint8_t m_b2m_drive;
|
|
||||||
uint8_t m_b2m_side;
|
|
||||||
|
|
||||||
uint8_t m_b2m_romdisk_lsb;
|
uint8_t m_romdisk_lsb;
|
||||||
uint8_t m_b2m_romdisk_msb;
|
uint8_t m_romdisk_msb;
|
||||||
|
|
||||||
uint8_t m_b2m_color[4];
|
uint8_t m_color[4];
|
||||||
uint8_t m_b2m_localmachine;
|
uint8_t m_localmachine;
|
||||||
uint8_t m_vblank_state;
|
uint8_t m_vblank_state;
|
||||||
required_device<cpu_device> m_maincpu;
|
required_device<cpu_device> m_maincpu;
|
||||||
required_device<speaker_sound_device> m_speaker;
|
required_device<speaker_sound_device> m_speaker;
|
||||||
|
@ -11,14 +11,9 @@
|
|||||||
|
|
||||||
#include "emu.h"
|
#include "emu.h"
|
||||||
#include "cpu/i8085/i8085.h"
|
#include "cpu/i8085/i8085.h"
|
||||||
#include "imagedev/cassette.h"
|
|
||||||
#include "machine/wd_fdc.h"
|
|
||||||
#include "machine/pic8259.h"
|
|
||||||
#include "machine/i8251.h"
|
|
||||||
#include "includes/b2m.h"
|
#include "includes/b2m.h"
|
||||||
#include "machine/ram.h"
|
|
||||||
|
|
||||||
uint8_t b2m_state::b2m_keyboard_r(offs_t offset)
|
uint8_t b2m_state::keyboard_r(offs_t offset)
|
||||||
{
|
{
|
||||||
uint8_t key = 0x00;
|
uint8_t key = 0x00;
|
||||||
if (offset < 0x100) {
|
if (offset < 0x100) {
|
||||||
@ -39,7 +34,7 @@ uint8_t b2m_state::b2m_keyboard_r(offs_t offset)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void b2m_state::b2m_set_bank(int bank)
|
void b2m_state::set_bank(int bank)
|
||||||
{
|
{
|
||||||
uint8_t *rom;
|
uint8_t *rom;
|
||||||
address_space &space = m_maincpu->space(AS_PROGRAM);
|
address_space &space = m_maincpu->space(AS_PROGRAM);
|
||||||
@ -61,7 +56,7 @@ void b2m_state::b2m_set_bank(int bank)
|
|||||||
membank("bank2")->set_base(ram + 0x2800);
|
membank("bank2")->set_base(ram + 0x2800);
|
||||||
membank("bank3")->set_base(ram + 0x3000);
|
membank("bank3")->set_base(ram + 0x3000);
|
||||||
membank("bank4")->set_base(ram + 0x7000);
|
membank("bank4")->set_base(ram + 0x7000);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
break;
|
break;
|
||||||
#if 0
|
#if 0
|
||||||
case 1 :
|
case 1 :
|
||||||
@ -70,9 +65,9 @@ void b2m_state::b2m_set_bank(int bank)
|
|||||||
|
|
||||||
membank("bank1")->set_base(ram);
|
membank("bank1")->set_base(ram);
|
||||||
membank("bank2")->set_base(ram + 0x2800);
|
membank("bank2")->set_base(ram + 0x2800);
|
||||||
membank("bank3")->set_base(rom + 0x12000);
|
membank("bank3")->set_base(rom + 0x2000);
|
||||||
membank("bank4")->set_base(rom + 0x16000);
|
membank("bank4")->set_base(rom + 0x6000);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 2 :
|
case 2 :
|
||||||
@ -80,30 +75,30 @@ void b2m_state::b2m_set_bank(int bank)
|
|||||||
space.unmap_write(0xe000, 0xffff);
|
space.unmap_write(0xe000, 0xffff);
|
||||||
|
|
||||||
membank("bank1")->set_base(ram);
|
membank("bank1")->set_base(ram);
|
||||||
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::b2m_keyboard_r)));
|
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::keyboard_r)));
|
||||||
membank("bank3")->set_base(ram + 0x10000);
|
membank("bank3")->set_base(ram + 0x10000);
|
||||||
membank("bank4")->set_base(ram + 0x7000);
|
membank("bank4")->set_base(ram + 0x7000);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
break;
|
break;
|
||||||
case 3 :
|
case 3 :
|
||||||
space.unmap_write(0x2800, 0x2fff);
|
space.unmap_write(0x2800, 0x2fff);
|
||||||
space.unmap_write(0xe000, 0xffff);
|
space.unmap_write(0xe000, 0xffff);
|
||||||
|
|
||||||
membank("bank1")->set_base(ram);
|
membank("bank1")->set_base(ram);
|
||||||
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::b2m_keyboard_r)));
|
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::keyboard_r)));
|
||||||
membank("bank3")->set_base(ram + 0x14000);
|
membank("bank3")->set_base(ram + 0x14000);
|
||||||
membank("bank4")->set_base(ram + 0x7000);
|
membank("bank4")->set_base(ram + 0x7000);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
break;
|
break;
|
||||||
case 4 :
|
case 4 :
|
||||||
space.unmap_write(0x2800, 0x2fff);
|
space.unmap_write(0x2800, 0x2fff);
|
||||||
space.unmap_write(0xe000, 0xffff);
|
space.unmap_write(0xe000, 0xffff);
|
||||||
|
|
||||||
membank("bank1")->set_base(ram);
|
membank("bank1")->set_base(ram);
|
||||||
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::b2m_keyboard_r)));
|
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::keyboard_r)));
|
||||||
membank("bank3")->set_base(ram + 0x18000);
|
membank("bank3")->set_base(ram + 0x18000);
|
||||||
membank("bank4")->set_base(ram + 0x7000);
|
membank("bank4")->set_base(ram + 0x7000);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 5 :
|
case 5 :
|
||||||
@ -111,10 +106,10 @@ void b2m_state::b2m_set_bank(int bank)
|
|||||||
space.unmap_write(0xe000, 0xffff);
|
space.unmap_write(0xe000, 0xffff);
|
||||||
|
|
||||||
membank("bank1")->set_base(ram);
|
membank("bank1")->set_base(ram);
|
||||||
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::b2m_keyboard_r)));
|
space.install_read_handler(0x2800, 0x2fff, read8sm_delegate(*this, FUNC(b2m_state::keyboard_r)));
|
||||||
membank("bank3")->set_base(ram + 0x1c000);
|
membank("bank3")->set_base(ram + 0x1c000);
|
||||||
membank("bank4")->set_base(ram + 0x7000);
|
membank("bank4")->set_base(ram + 0x7000);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 6 :
|
case 6 :
|
||||||
@ -131,44 +126,44 @@ void b2m_state::b2m_set_bank(int bank)
|
|||||||
space.unmap_write(0x7000, 0xdfff);
|
space.unmap_write(0x7000, 0xdfff);
|
||||||
space.unmap_write(0xe000, 0xffff);
|
space.unmap_write(0xe000, 0xffff);
|
||||||
|
|
||||||
membank("bank1")->set_base(rom + 0x10000);
|
membank("bank1")->set_base(rom);
|
||||||
membank("bank2")->set_base(rom + 0x10000);
|
membank("bank2")->set_base(rom);
|
||||||
membank("bank3")->set_base(rom + 0x10000);
|
membank("bank3")->set_base(rom);
|
||||||
membank("bank4")->set_base(rom + 0x10000);
|
membank("bank4")->set_base(rom);
|
||||||
membank("bank5")->set_base(rom + 0x10000);
|
membank("bank5")->set_base(rom);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(b2m_state::bm2_pit_out1)
|
WRITE_LINE_MEMBER(b2m_state::pit_out1)
|
||||||
{
|
{
|
||||||
m_speaker->level_w(state);
|
m_speaker->level_w(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_8255_porta_w(uint8_t data)
|
void b2m_state::ppi1_porta_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_b2m_8255_porta = data;
|
m_porta = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_8255_portb_w(uint8_t data)
|
void b2m_state::ppi1_portb_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_b2m_video_scroll = data;
|
m_video_scroll = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_8255_portc_w(uint8_t data)
|
void b2m_state::ppi1_portc_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_b2m_8255_portc = data;
|
m_portc = data;
|
||||||
b2m_set_bank(m_b2m_8255_portc & 7);
|
set_bank(m_portc & 7);
|
||||||
m_b2m_video_page = (m_b2m_8255_portc >> 7) & 1;
|
m_video_page = BIT(m_portc, 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t b2m_state::b2m_8255_portb_r()
|
uint8_t b2m_state::ppi1_portb_r()
|
||||||
{
|
{
|
||||||
return m_b2m_video_scroll;
|
return m_video_scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
WRITE_LINE_MEMBER( b2m_state::b2m_fdc_drq )
|
WRITE_LINE_MEMBER( b2m_state::fdc_drq )
|
||||||
{
|
{
|
||||||
/* Clears HALT state of CPU when data is ready to read */
|
/* Clears HALT state of CPU when data is ready to read */
|
||||||
if (state)
|
if (state)
|
||||||
@ -176,27 +171,22 @@ WRITE_LINE_MEMBER( b2m_state::b2m_fdc_drq )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void b2m_state::b2m_ext_8255_portc_w(uint8_t data)
|
void b2m_state::ppi2_portc_w(uint8_t data)
|
||||||
{
|
{
|
||||||
uint8_t drive = ((data >> 1) & 1) ^ 1;
|
uint8_t drive = BIT(~data, 1);
|
||||||
uint8_t side = (data & 1) ^ 1;
|
uint8_t side = BIT(~data, 0);
|
||||||
|
|
||||||
floppy_image_device *floppy = nullptr;
|
floppy_image_device *floppy = nullptr;
|
||||||
if (m_fd[drive].found())
|
if (m_fd[drive].found())
|
||||||
floppy = m_fd[drive]->get_device();
|
floppy = m_fd[drive]->get_device();
|
||||||
|
|
||||||
if (floppy != nullptr)
|
if (floppy)
|
||||||
floppy->mon_w(0);
|
floppy->mon_w(0);
|
||||||
m_fdc->set_floppy(floppy);
|
m_fdc->set_floppy(floppy);
|
||||||
if (m_b2m_drive!=drive) {
|
|
||||||
m_b2m_drive = drive;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_b2m_side!=side) {
|
if (floppy)
|
||||||
m_b2m_side = side;
|
floppy->ss_w(side);
|
||||||
if (floppy != nullptr)
|
|
||||||
floppy->ss_w(side);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
When bit 5 is set CPU is in HALT state and stay there until
|
When bit 5 is set CPU is in HALT state and stay there until
|
||||||
DRQ is triggered from floppy side
|
DRQ is triggered from floppy side
|
||||||
@ -207,84 +197,75 @@ void b2m_state::b2m_ext_8255_portc_w(uint8_t data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t b2m_state::b2m_romdisk_porta_r()
|
uint8_t b2m_state::romdisk_porta_r()
|
||||||
{
|
{
|
||||||
uint8_t *romdisk = memregion("maincpu")->base() + 0x12000;
|
uint8_t *romdisk = memregion("maincpu")->base() + 0x2000;
|
||||||
return romdisk[m_b2m_romdisk_msb*256+m_b2m_romdisk_lsb];
|
return romdisk[m_romdisk_msb*256+m_romdisk_lsb];
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_romdisk_portb_w(uint8_t data)
|
void b2m_state::romdisk_portb_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_b2m_romdisk_lsb = data;
|
m_romdisk_lsb = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_romdisk_portc_w(uint8_t data)
|
void b2m_state::romdisk_portc_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_b2m_romdisk_msb = data & 0x7f;
|
m_romdisk_msb = data & 0x7f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Driver initialization */
|
void b2m_state::palette_w(offs_t offset, uint8_t data)
|
||||||
void b2m_state::init_b2m()
|
|
||||||
{
|
{
|
||||||
m_vblank_state = 0;
|
uint8_t b = BIT(~data, 6, 2) * 0x55;
|
||||||
}
|
uint8_t g = BIT(~data, 4, 2) * 0x55;
|
||||||
|
uint8_t r = BIT(~data, 2, 2) * 0x55;
|
||||||
|
|
||||||
void b2m_state::b2m_palette_w(offs_t offset, uint8_t data)
|
uint8_t bw = BIT(~data, 0, 2) * 0x55;
|
||||||
{
|
|
||||||
uint8_t b = (3 - ((data >> 6) & 3)) * 0x55;
|
|
||||||
uint8_t g = (3 - ((data >> 4) & 3)) * 0x55;
|
|
||||||
uint8_t r = (3 - ((data >> 2) & 3)) * 0x55;
|
|
||||||
|
|
||||||
uint8_t bw = (3 - (data & 3)) * 0x55;
|
m_color[offset & 3] = data;
|
||||||
|
|
||||||
m_b2m_color[offset & 3] = data;
|
if (ioport("MONITOR")->read()==1)
|
||||||
|
|
||||||
if (ioport("MONITOR")->read()==1) {
|
|
||||||
m_palette->set_pen_color(offset, r, g, b);
|
m_palette->set_pen_color(offset, r, g, b);
|
||||||
} else {
|
else
|
||||||
m_palette->set_pen_color(offset, bw, bw, bw);
|
m_palette->set_pen_color(offset, bw, bw, bw);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t b2m_state::b2m_palette_r(offs_t offset)
|
uint8_t b2m_state::palette_r(offs_t offset)
|
||||||
{
|
{
|
||||||
return m_b2m_color[offset];
|
return m_color[offset];
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_localmachine_w(uint8_t data)
|
void b2m_state::localmachine_w(uint8_t data)
|
||||||
{
|
{
|
||||||
m_b2m_localmachine = data;
|
m_localmachine = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t b2m_state::b2m_localmachine_r()
|
uint8_t b2m_state::localmachine_r()
|
||||||
{
|
{
|
||||||
return m_b2m_localmachine;
|
return m_localmachine;
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::b2m_postload()
|
void b2m_state::postload()
|
||||||
{
|
{
|
||||||
b2m_set_bank(m_b2m_8255_portc & 7);
|
set_bank(m_portc & 7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void b2m_state::machine_start()
|
void b2m_state::machine_start()
|
||||||
{
|
{
|
||||||
/* register for state saving */
|
/* register for state saving */
|
||||||
save_item(NAME(m_b2m_8255_porta));
|
save_item(NAME(m_porta));
|
||||||
save_item(NAME(m_b2m_video_scroll));
|
save_item(NAME(m_video_scroll));
|
||||||
save_item(NAME(m_b2m_8255_portc));
|
save_item(NAME(m_portc));
|
||||||
save_item(NAME(m_b2m_video_page));
|
save_item(NAME(m_video_page));
|
||||||
save_item(NAME(m_b2m_drive));
|
save_item(NAME(m_romdisk_lsb));
|
||||||
save_item(NAME(m_b2m_side));
|
save_item(NAME(m_romdisk_msb));
|
||||||
save_item(NAME(m_b2m_romdisk_lsb));
|
save_pointer(NAME(m_color), 4);
|
||||||
save_item(NAME(m_b2m_romdisk_msb));
|
save_item(NAME(m_localmachine));
|
||||||
save_pointer(NAME(m_b2m_color), 4);
|
|
||||||
save_item(NAME(m_b2m_localmachine));
|
|
||||||
save_item(NAME(m_vblank_state));
|
save_item(NAME(m_vblank_state));
|
||||||
|
|
||||||
machine().save().register_postload(save_prepost_delegate(FUNC(b2m_state::b2m_postload), this));
|
machine().save().register_postload(save_prepost_delegate(FUNC(b2m_state::postload), this));
|
||||||
}
|
}
|
||||||
|
|
||||||
INTERRUPT_GEN_MEMBER(b2m_state::b2m_vblank_interrupt)
|
INTERRUPT_GEN_MEMBER(b2m_state::vblank_interrupt)
|
||||||
{
|
{
|
||||||
m_vblank_state++;
|
m_vblank_state++;
|
||||||
if (m_vblank_state>1) m_vblank_state=0;
|
if (m_vblank_state>1) m_vblank_state=0;
|
||||||
@ -293,8 +274,52 @@ INTERRUPT_GEN_MEMBER(b2m_state::b2m_vblank_interrupt)
|
|||||||
|
|
||||||
void b2m_state::machine_reset()
|
void b2m_state::machine_reset()
|
||||||
{
|
{
|
||||||
m_b2m_side = 0;
|
m_vblank_state = 0;
|
||||||
m_b2m_drive = 0;
|
set_bank(7);
|
||||||
|
}
|
||||||
b2m_set_bank(7);
|
|
||||||
|
uint32_t b2m_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
||||||
|
{
|
||||||
|
uint8_t code1;
|
||||||
|
uint8_t code2;
|
||||||
|
uint8_t col;
|
||||||
|
int y, x, b;
|
||||||
|
uint8_t *ram = m_ram->pointer();
|
||||||
|
|
||||||
|
for (x = 0; x < 48; x++)
|
||||||
|
{
|
||||||
|
for (y = 0; y < 256; y++)
|
||||||
|
{
|
||||||
|
u16 t = x*256 + ((y + m_video_scroll) & 0xff);
|
||||||
|
if (m_video_page==0)
|
||||||
|
{
|
||||||
|
code1 = ram[0x11000 + t];
|
||||||
|
code2 = ram[0x15000 + t];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
code1 = ram[0x19000 + t];
|
||||||
|
code2 = ram[0x1d000 + t];
|
||||||
|
}
|
||||||
|
for (b = 7; b >= 0; b--)
|
||||||
|
{
|
||||||
|
col = (BIT(code2, b)<<1) + BIT(code1, b);
|
||||||
|
bitmap.pix16(y, x*8+b) = col;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void b2m_state::b2m_palette(palette_device &palette) const
|
||||||
|
{
|
||||||
|
static constexpr rgb_t b2m_pens[4] = {
|
||||||
|
{ 0x00, 0x00, 0x00 }, // 0
|
||||||
|
{ 0x00, 0x00, 0x00 }, // 1
|
||||||
|
{ 0x00, 0x00, 0x00 }, // 2
|
||||||
|
{ 0x00, 0x00, 0x00 }, // 3
|
||||||
|
};
|
||||||
|
|
||||||
|
palette.set_pen_colors(0, b2m_pens);
|
||||||
}
|
}
|
||||||
|
@ -1,60 +0,0 @@
|
|||||||
// license:BSD-3-Clause
|
|
||||||
// copyright-holders:Miodrag Milanovic
|
|
||||||
/***************************************************************************
|
|
||||||
|
|
||||||
Bashkiria-2M video driver by Miodrag Milanovic
|
|
||||||
|
|
||||||
28/03/2008 Preliminary driver.
|
|
||||||
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
#include "emu.h"
|
|
||||||
#include "includes/b2m.h"
|
|
||||||
#include "machine/ram.h"
|
|
||||||
|
|
||||||
void b2m_state::video_start()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t b2m_state::screen_update_b2m(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
|
|
||||||
{
|
|
||||||
uint8_t code1;
|
|
||||||
uint8_t code2;
|
|
||||||
uint8_t col;
|
|
||||||
int y, x, b;
|
|
||||||
uint8_t *ram = m_ram->pointer();
|
|
||||||
|
|
||||||
for (x = 0; x < 48; x++)
|
|
||||||
{
|
|
||||||
for (y = 0; y < 256; y++)
|
|
||||||
{
|
|
||||||
if (m_b2m_video_page==0) {
|
|
||||||
code1 = ram[0x11000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)];
|
|
||||||
code2 = ram[0x15000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)];
|
|
||||||
} else {
|
|
||||||
code1 = ram[0x19000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)];
|
|
||||||
code2 = ram[0x1d000 + x*256 + ((y + m_b2m_video_scroll) & 0xff)];
|
|
||||||
}
|
|
||||||
for (b = 7; b >= 0; b--)
|
|
||||||
{
|
|
||||||
col = (((code2 >> b) & 0x01)<<1) + ((code1 >> b) & 0x01);
|
|
||||||
bitmap.pix16(y, x*8+b) = col;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void b2m_state::b2m_palette(palette_device &palette) const
|
|
||||||
{
|
|
||||||
static constexpr rgb_t b2m_pens[4] = {
|
|
||||||
{ 0x00, 0x00, 0x00 }, // 0
|
|
||||||
{ 0x00, 0x00, 0x00 }, // 1
|
|
||||||
{ 0x00, 0x00, 0x00 }, // 2
|
|
||||||
{ 0x00, 0x00, 0x00 }, // 3
|
|
||||||
};
|
|
||||||
|
|
||||||
palette.set_pen_colors(0, b2m_pens);
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user