mbc55x: Various additions and refinements

- Correct all clocks and derive them from the master XTAL
- Correct I/O address decoding
- Enable speaker output from 8251 USART
- Add ISA expansion slot, Centronics printer and RS232 "line" ports
- Add backspace key to HLE keyboard and note undumped MCU
This commit is contained in:
AJR 2018-11-04 23:51:52 -05:00
parent 781bbdf1dc
commit 53b63cef9d
4 changed files with 160 additions and 168 deletions

View File

@ -18,6 +18,13 @@ ToDo:
#include "emu.h" #include "emu.h"
#include "includes/mbc55x.h" #include "includes/mbc55x.h"
#include "bus/isa/isa.h"
#include "bus/isa/isa_cards.h"
//#include "bus/pc_joy/pc_joy.h"
#include "bus/rs232/rs232.h"
#include "cpu/mcs48/mcs48.h"
#include "machine/clock.h"
#include "machine/input_merger.h"
#include "screen.h" #include "screen.h"
#include "softlist.h" #include "softlist.h"
#include "speaker.h" #include "speaker.h"
@ -61,16 +68,20 @@ void mbc55x_state::mbc55x_mem(address_map &map)
void mbc55x_state::mbc55x_io(address_map &map) void mbc55x_state::mbc55x_io(address_map &map)
{ {
map.global_mask(0xff); map(0x0000, 0x0000).select(0x003e).rw(FUNC(mbc55x_state::iodecode_r), FUNC(mbc55x_state::iodecode_w));
map(0x0000, 0x0003).rw(FUNC(mbc55x_state::mbcpic8259_r), FUNC(mbc55x_state::mbcpic8259_w)); }
map(0x0008, 0x000F).rw(FUNC(mbc55x_state::mbc55x_disk_r), FUNC(mbc55x_state::mbc55x_disk_w));
map(0x0010, 0x0010).rw(FUNC(mbc55x_state::vram_page_r), FUNC(mbc55x_state::vram_page_w)); void mbc55x_state::mbc55x_iodecode(address_map &map)
map(0x0018, 0x001F).rw(FUNC(mbc55x_state::ppi8255_r), FUNC(mbc55x_state::ppi8255_w)); {
map(0x0020, 0x0027).rw(FUNC(mbc55x_state::mbcpit8253_r), FUNC(mbc55x_state::mbcpit8253_w)); map(0x00, 0x01).mirror(0x02).rw(m_pic, FUNC(pic8259_device::read), FUNC(pic8259_device::write));
map(0x0028, 0x002B).rw(FUNC(mbc55x_state::mbc55x_usart_r), FUNC(mbc55x_state::mbc55x_usart_w)); map(0x04, 0x07).rw(m_fdc, FUNC(fd1793_device::read), FUNC(fd1793_device::write));
map(0x0030, 0x0031).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w)); map(0x08, 0x08).mirror(0x03).rw(FUNC(mbc55x_state::vram_page_r), FUNC(mbc55x_state::vram_page_w));
map(0x0032, 0x0033).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w)); map(0x0c, 0x0f).rw(m_ppi, FUNC(i8255_device::read), FUNC(i8255_device::write));
map(0x0038, 0x003B).rw(FUNC(mbc55x_state::mbc55x_kb_usart_r), FUNC(mbc55x_state::mbc55x_kb_usart_w)); map(0x10, 0x13).rw(m_pit, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
map(0x14, 0x15).mirror(0x02).rw("sio", FUNC(i8251_device::read), FUNC(i8251_device::write));
map(0x18, 0x18).mirror(0x02).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w));
map(0x19, 0x19).mirror(0x02).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
map(0x1c, 0x1d).mirror(0x02).r(FUNC(mbc55x_state::mbc55x_kb_usart_r)).w(m_kb_uart, FUNC(i8251_device::write));
} }
static INPUT_PORTS_START( mbc55x ) static INPUT_PORTS_START( mbc55x )
@ -138,7 +149,7 @@ static INPUT_PORTS_START( mbc55x )
PORT_START("KEY6") /* Key row 6 scancodes 30..37 */ PORT_START("KEY6") /* Key row 6 scancodes 30..37 */
PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ') PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("SPACE") PORT_CODE(KEYCODE_SPACE) PORT_CHAR(' ')
PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x02, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSPACE) PORT_CHAR(0x08)
PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x04, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x08, IP_ACTIVE_LOW, IPT_UNUSED)
PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED) PORT_BIT(0x10, IP_ACTIVE_LOW, IPT_UNUSED)
@ -243,21 +254,26 @@ static void mbc55x_floppies(device_slot_interface &device)
MACHINE_CONFIG_START(mbc55x_state::mbc55x) MACHINE_CONFIG_START(mbc55x_state::mbc55x)
/* basic machine hardware */ /* basic machine hardware */
I8088(config, m_maincpu, 3600000); I8088(config, m_maincpu, 14.318181_MHz_XTAL / 4);
m_maincpu->set_addrmap(AS_PROGRAM, &mbc55x_state::mbc55x_mem); m_maincpu->set_addrmap(AS_PROGRAM, &mbc55x_state::mbc55x_mem);
m_maincpu->set_addrmap(AS_IO, &mbc55x_state::mbc55x_io); m_maincpu->set_addrmap(AS_IO, &mbc55x_state::mbc55x_io);
m_maincpu->set_irq_acknowledge_callback(PIC8259_TAG, FUNC(pic8259_device::inta_cb)); m_maincpu->set_irq_acknowledge_callback(PIC8259_TAG, FUNC(pic8259_device::inta_cb));
ADDRESS_MAP_BANK(config, m_iodecode);
m_iodecode->endianness(ENDIANNESS_LITTLE);
m_iodecode->data_width(8);
m_iodecode->addr_width(5);
m_iodecode->set_addrmap(0, &mbc55x_state::mbc55x_iodecode);
I8049(config, "kbdc", 6_MHz_XTAL).set_disable();
/* video hardware */ /* video hardware */
MCFG_SCREEN_ADD(SCREEN_TAG, RASTER) screen_device &screen(SCREEN(config, SCREEN_TAG, SCREEN_TYPE_RASTER));
MCFG_SCREEN_RAW_PARAMS(14.318181_MHz_XTAL, 896, 0, 300, 262, 0, 200) screen.set_raw(14.318181_MHz_XTAL, 896, 0, 640, 262, 0, 200);
MCFG_SCREEN_UPDATE_DEVICE(VID_MC6845_NAME, mc6845_device, screen_update) screen.set_screen_update(VID_MC6845_NAME, FUNC(mc6845_device::screen_update));
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, mbc55x_state, screen_vblank_mbc55x))
MCFG_PALETTE_ADD("palette", SCREEN_NO_COLOURS * 3) MCFG_PALETTE_ADD("palette", SCREEN_NO_COLOURS * 3)
MCFG_PALETTE_INIT_OWNER(mbc55x_state, mbc55x) MCFG_PALETTE_INIT_OWNER(mbc55x_state, mbc55x)
// MCFG_SCREEN_SIZE(650, 260)
// MCFG_SCREEN_VISIBLE_AREA(0, 639, 0, 249)
RAM(config, RAM_TAG).set_default_size("128K").set_extra_options("128K,192K,256K,320K,384K,448K,512K,576K,640K"); RAM(config, RAM_TAG).set_default_size("128K").set_extra_options("128K,192K,256K,320K,384K,448K,512K,576K,640K");
@ -266,29 +282,36 @@ MACHINE_CONFIG_START(mbc55x_state::mbc55x)
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, MONO_TAG, 0.75); SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, MONO_TAG, 0.75);
/* Devices */ /* Devices */
I8251(config, m_kb_uart, 0); I8251(config, m_kb_uart, 14.318181_MHz_XTAL / 8);
m_kb_uart->txd_handler().set("speaker", FUNC(speaker_sound_device::level_w)).invert();
m_kb_uart->rts_handler().set(m_printer, FUNC(centronics_device::write_init)).invert();
m_kb_uart->rxrdy_handler().set(m_pic, FUNC(pic8259_device::ir3_w)); m_kb_uart->rxrdy_handler().set(m_pic, FUNC(pic8259_device::ir3_w));
PIT8253(config, m_pit, 0); PIT8253(config, m_pit, 0);
m_pit->set_clk<0>(PIT_C0_CLOCK);
m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w)); m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w));
m_pit->set_clk<1>(PIT_C1_CLOCK); m_pit->out_handler<0>().append(m_pit, FUNC(pit8253_device::write_clk1));
m_pit->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir1_w)); m_pit->out_handler<1>().set(m_pic, FUNC(pic8259_device::ir1_w));
m_pit->set_clk<2>(PIT_C2_CLOCK); m_pit->set_clk<2>(14.318181_MHz_XTAL / 8);
m_pit->out_handler<2>().set(FUNC(mbc55x_state::pit8253_t2)); m_pit->out_handler<2>().set("sio", FUNC(i8251_device::write_txc));
m_pit->out_handler<2>().append("sio", FUNC(i8251_device::write_rxc));
m_pit->out_handler<2>().append("line", FUNC(rs232_port_device::write_etc));
clock_device &clk_78_6khz(CLOCK(config, "clk_78.6khz", 14.318181_MHz_XTAL / 14 / 13));
clk_78_6khz.signal_handler().set(m_pit, FUNC(pit8253_device::write_clk0));
clk_78_6khz.signal_handler().append(m_kb_uart, FUNC(i8251_device::write_txc));
clk_78_6khz.signal_handler().append(m_kb_uart, FUNC(i8251_device::write_rxc));
PIC8259(config, m_pic, 0); PIC8259(config, m_pic, 0);
m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0); m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
I8255(config, m_ppi); I8255(config, m_ppi);
m_ppi->in_pa_callback().set(FUNC(mbc55x_state::mbc55x_ppi_porta_r)); m_ppi->in_pa_callback().set(FUNC(mbc55x_state::game_io_r));
m_ppi->out_pa_callback().set(FUNC(mbc55x_state::mbc55x_ppi_porta_w)); m_ppi->out_pa_callback().set(FUNC(mbc55x_state::game_io_w));
m_ppi->in_pb_callback().set(FUNC(mbc55x_state::mbc55x_ppi_portb_r)); m_ppi->out_pb_callback().set(FUNC(mbc55x_state::printer_data_w));
m_ppi->out_pb_callback().set(FUNC(mbc55x_state::mbc55x_ppi_portb_w)); m_ppi->in_pc_callback().set(FUNC(mbc55x_state::printer_status_r));
m_ppi->in_pc_callback().set(FUNC(mbc55x_state::mbc55x_ppi_portc_r)); m_ppi->out_pc_callback().set(FUNC(mbc55x_state::disk_select_w));
m_ppi->out_pc_callback().set(FUNC(mbc55x_state::mbc55x_ppi_portc_w));
MCFG_MC6845_ADD(VID_MC6845_NAME, MC6845, SCREEN_TAG, 14.318181_MHz_XTAL / 8) MCFG_MC6845_ADD(VID_MC6845_NAME, HD6845, SCREEN_TAG, 14.318181_MHz_XTAL / 8) // HD46505SP-1
MCFG_MC6845_SHOW_BORDER_AREA(false) MCFG_MC6845_SHOW_BORDER_AREA(false)
MCFG_MC6845_CHAR_WIDTH(8) MCFG_MC6845_CHAR_WIDTH(8)
MCFG_MC6845_UPDATE_ROW_CB(mbc55x_state, crtc_update_row) MCFG_MC6845_UPDATE_ROW_CB(mbc55x_state, crtc_update_row)
@ -296,25 +319,56 @@ MACHINE_CONFIG_START(mbc55x_state::mbc55x)
MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(*this, mbc55x_state, vid_vsync_changed)) MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(*this, mbc55x_state, vid_vsync_changed))
/* Backing storage */ /* Backing storage */
FD1793(config, m_fdc, 1_MHz_XTAL); FD1793(config, m_fdc, 14.318181_MHz_XTAL / 14); // M5W1793-02P (clock is nominally 1 MHz)
m_fdc->intrq_wr_callback().set(m_pic, FUNC(pic8259_device::ir5_w));
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":0", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(m_floppy[0], mbc55x_floppies, "qd", mbc55x_state::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":1", mbc55x_floppies, "qd", mbc55x_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(m_floppy[1], mbc55x_floppies, "qd", mbc55x_state::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":2", mbc55x_floppies, "", mbc55x_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(m_floppy[2], mbc55x_floppies, "", mbc55x_state::floppy_formats)
MCFG_FLOPPY_DRIVE_ADD(FDC_TAG ":3", mbc55x_floppies, "", mbc55x_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(m_floppy[3], mbc55x_floppies, "", mbc55x_state::floppy_formats)
/* Software list */ /* Software list */
MCFG_SOFTWARE_LIST_ADD("disk_list","mbc55x") MCFG_SOFTWARE_LIST_ADD("disk_list","mbc55x")
MCFG_DEVICE_ADD("isa", ISA8, 0)
MCFG_ISA8_CPU(m_maincpu)
MCFG_ISA_OUT_IRQ7_CB(WRITELINE(m_pic, pic8259_device, ir7_w)) // all other IRQ and DRQ lines are NC
//MCFG_ISA_BUS_IOCHCK(INPUTLINE(m_maincpu, INPUT_LINE_NMI))
ISA8_SLOT(config, "external", 0, "isa", pc_isa8_cards, nullptr, false);
i8251_device &sio(I8251(config, "sio", 14.318181_MHz_XTAL / 8)); // on separate board, through 20-pin header
sio.dtr_handler().set("line", FUNC(rs232_port_device::write_dtr));
sio.txd_handler().set("line", FUNC(rs232_port_device::write_txd));
sio.rts_handler().set("line", FUNC(rs232_port_device::write_rts));
sio.rxrdy_handler().set("sioint", FUNC(input_merger_device::in_w<0>));
sio.txrdy_handler().set("sioint", FUNC(input_merger_device::in_w<1>));
rs232_port_device &serial(RS232_PORT(config, "line", default_rs232_devices, nullptr));
serial.rxd_handler().set("sio", FUNC(i8251_device::write_rxd));
serial.dsr_handler().set("sio", FUNC(i8251_device::write_dsr));
serial.cts_handler().set("sio", FUNC(i8251_device::write_cts));
INPUT_MERGER_ANY_HIGH(config, "sioint").output_handler().set(m_pic, FUNC(pic8259_device::ir2_w));
CENTRONICS(config, m_printer, centronics_devices, nullptr);
m_printer->busy_handler().set(FUNC(mbc55x_state::printer_busy_w)).invert(); // LS14 Schmitt trigger
m_printer->busy_handler().append(m_pic, FUNC(pic8259_device::ir4_w)).invert();
m_printer->perror_handler().set(FUNC(mbc55x_state::printer_paper_end_w));
m_printer->select_handler().set(FUNC(mbc55x_state::printer_select_w));
MACHINE_CONFIG_END MACHINE_CONFIG_END
ROM_START( mbc55x ) ROM_START( mbc55x )
ROM_REGION( 0x4000, MAINCPU_TAG, 0 ) ROM_REGION(0x4000, MAINCPU_TAG, 0)
ROM_SYSTEM_BIOS(0, "v120", "mbc55x BIOS v1.20 (1983)") ROM_SYSTEM_BIOS(0, "v120", "mbc55x BIOS v1.20 (1983)")
ROMX_LOAD("mbc55x-v120.rom", 0x0000, 0x2000, CRC(b439b4b8) SHA1(6e8df0f3868e3fd0229a5c2720d6c01e46815cab), ROM_BIOS(0) ) ROMX_LOAD("mbc55x-v120.rom", 0x0000, 0x2000, CRC(b439b4b8) SHA1(6e8df0f3868e3fd0229a5c2720d6c01e46815cab), ROM_BIOS(0))
ROM_REGION(0x0800, "kbdc", 0)
ROM_LOAD("d8049hc.m1", 0x0000, 0x0800, NO_DUMP)
ROM_END ROM_END
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
COMP( 1983, mbc55x, 0, 0, mbc55x, mbc55x, mbc55x_state, empty_init, "Sanyo", "MBC-55x", 0 /*MACHINE_NO_SOUND*/) COMP( 1983, mbc55x, 0, 0, mbc55x, mbc55x, mbc55x_state, empty_init, "Sanyo", "MBC-55x", 0 )

View File

@ -15,6 +15,7 @@
#include "bus/centronics/ctronics.h" #include "bus/centronics/ctronics.h"
#include "cpu/i86/i86.h" #include "cpu/i86/i86.h"
#include "imagedev/flopdrv.h" #include "imagedev/flopdrv.h"
#include "machine/bankdev.h"
#include "machine/i8251.h" #include "machine/i8251.h"
#include "machine/i8255.h" #include "machine/i8255.h"
#include "machine/pic8259.h" #include "machine/pic8259.h"
@ -72,12 +73,7 @@
#define PPI8255_TAG "ppi8255" #define PPI8255_TAG "ppi8255"
#define PIC8259_TAG "pic8259" #define PIC8259_TAG "pic8259"
// From tech manual clock c1 is fed from c0, but it approx 100Hz
#define PIT8253_TAG "pit8253" #define PIT8253_TAG "pit8253"
#define PIT_C0_CLOCK 78600
#define PIT_C1_CLOCK 100
#define PIT_C2_CLOCK 1789770
#define MONO_TAG "mono" #define MONO_TAG "mono"
#define I8251A_KB_TAG "i8251a_kb" #define I8251A_KB_TAG "i8251a_kb"
@ -99,16 +95,15 @@ public:
mbc55x_state(const machine_config &mconfig, device_type type, const char *tag) mbc55x_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag), : driver_device(mconfig, type, tag),
m_maincpu(*this, MAINCPU_TAG), m_maincpu(*this, MAINCPU_TAG),
m_iodecode(*this, "iodecode"),
m_crtc(*this, VID_MC6845_NAME), m_crtc(*this, VID_MC6845_NAME),
m_kb_uart(*this, I8251A_KB_TAG), m_kb_uart(*this, I8251A_KB_TAG),
m_pit(*this, PIT8253_TAG), m_pit(*this, PIT8253_TAG),
m_ppi(*this, PPI8255_TAG), m_ppi(*this, PPI8255_TAG),
m_pic(*this, PIC8259_TAG), m_pic(*this, PIC8259_TAG),
m_fdc(*this, FDC_TAG), m_fdc(*this, FDC_TAG),
m_floppy0(*this, FDC_TAG ":0"), m_floppy(*this, FDC_TAG ":%u", 0U),
m_floppy1(*this, FDC_TAG ":1"), m_printer(*this, "printer"),
m_floppy2(*this, FDC_TAG ":2"),
m_floppy3(*this, FDC_TAG ":3"),
m_speaker(*this, "speaker"), m_speaker(*this, "speaker"),
m_ram(*this, RAM_TAG), m_ram(*this, RAM_TAG),
m_palette(*this, "palette") m_palette(*this, "palette")
@ -120,51 +115,37 @@ public:
void init_mbc55x(); void init_mbc55x();
required_device<cpu_device> m_maincpu; required_device<cpu_device> m_maincpu;
required_device<address_map_bank_device> m_iodecode;
uint32_t m_debug_machine; uint32_t m_debug_machine;
private: private:
DECLARE_FLOPPY_FORMATS(floppy_formats); DECLARE_FLOPPY_FORMATS(floppy_formats);
//DECLARE_READ8_MEMBER(pic8259_r); DECLARE_READ8_MEMBER(iodecode_r);
//DECLARE_WRITE8_MEMBER(pic8259_w); DECLARE_WRITE8_MEMBER(iodecode_w);
//DECLARE_READ8_MEMBER(mbc55x_disk_r);
//DECLARE_WRITE8_MEMBER(mbc55x_disk_w); DECLARE_READ8_MEMBER(mbc55x_kb_usart_r);
DECLARE_READ8_MEMBER(mbc55x_usart_r);
DECLARE_WRITE8_MEMBER(mbc55x_usart_w);
//DECLARE_READ8_MEMBER(mbc55x_kb_usart_r);
//DECLARE_WRITE8_MEMBER(mbc55x_kb_usart_w);
DECLARE_READ8_MEMBER(vram_page_r); DECLARE_READ8_MEMBER(vram_page_r);
DECLARE_WRITE8_MEMBER(vram_page_w); DECLARE_WRITE8_MEMBER(vram_page_w);
DECLARE_READ8_MEMBER(ppi8255_r); DECLARE_READ8_MEMBER(game_io_r);
DECLARE_WRITE8_MEMBER(ppi8255_w); DECLARE_WRITE8_MEMBER(game_io_w);
//DECLARE_READ8_MEMBER(pit8253_r); DECLARE_READ8_MEMBER(printer_status_r);
//DECLARE_WRITE8_MEMBER(pit8253_w); DECLARE_WRITE8_MEMBER(printer_data_w);
DECLARE_READ8_MEMBER(mbc55x_ppi_porta_r); DECLARE_WRITE8_MEMBER(disk_select_w);
DECLARE_READ8_MEMBER(mbc55x_ppi_portb_r); DECLARE_WRITE_LINE_MEMBER(printer_busy_w);
DECLARE_READ8_MEMBER(mbc55x_ppi_portc_r); DECLARE_WRITE_LINE_MEMBER(printer_paper_end_w);
DECLARE_WRITE8_MEMBER(mbc55x_ppi_porta_w); DECLARE_WRITE_LINE_MEMBER(printer_select_w);
DECLARE_WRITE8_MEMBER(mbc55x_ppi_portb_w);
DECLARE_WRITE8_MEMBER(mbc55x_ppi_portc_w);
DECLARE_WRITE_LINE_MEMBER(vid_hsync_changed); DECLARE_WRITE_LINE_MEMBER(vid_hsync_changed);
DECLARE_WRITE_LINE_MEMBER(vid_vsync_changed); DECLARE_WRITE_LINE_MEMBER(vid_vsync_changed);
DECLARE_WRITE_LINE_MEMBER(pit8253_t2);
DECLARE_READ8_MEMBER(mbcpic8259_r);
DECLARE_WRITE8_MEMBER(mbcpic8259_w);
DECLARE_READ8_MEMBER(mbcpit8253_r);
DECLARE_WRITE8_MEMBER(mbcpit8253_w);
DECLARE_READ8_MEMBER(mbc55x_disk_r);
DECLARE_WRITE8_MEMBER(mbc55x_disk_w);
DECLARE_READ8_MEMBER(mbc55x_kb_usart_r);
DECLARE_WRITE8_MEMBER(mbc55x_kb_usart_w);
MC6845_UPDATE_ROW(crtc_update_row); MC6845_UPDATE_ROW(crtc_update_row);
DECLARE_PALETTE_INIT(mbc55x); DECLARE_PALETTE_INIT(mbc55x);
DECLARE_WRITE_LINE_MEMBER(screen_vblank_mbc55x);
TIMER_CALLBACK_MEMBER(keyscan_callback); TIMER_CALLBACK_MEMBER(keyscan_callback);
void mbc55x_io(address_map &map); void mbc55x_io(address_map &map);
void mbc55x_mem(address_map &map); void mbc55x_mem(address_map &map);
void mbc55x_iodecode(address_map &map);
virtual void machine_start() override; virtual void machine_start() override;
virtual void machine_reset() override; virtual void machine_reset() override;
@ -181,10 +162,8 @@ private:
required_device<i8255_device> m_ppi; required_device<i8255_device> m_ppi;
required_device<pic8259_device> m_pic; required_device<pic8259_device> m_pic;
required_device<fd1793_device> m_fdc; required_device<fd1793_device> m_fdc;
required_device<floppy_connector> m_floppy0; required_device_array<floppy_connector, 4> m_floppy;
required_device<floppy_connector> m_floppy1; required_device<centronics_device> m_printer;
required_device<floppy_connector> m_floppy2;
required_device<floppy_connector> m_floppy3;
required_device<speaker_sound_device> m_speaker; required_device<speaker_sound_device> m_speaker;
required_device<ram_device> m_ram; required_device<ram_device> m_ram;
required_device<palette_device> m_palette; required_device<palette_device> m_palette;
@ -192,6 +171,7 @@ private:
uint32_t m_debug_video; uint32_t m_debug_video;
uint8_t m_video_mem[VIDEO_MEM_SIZE]; uint8_t m_video_mem[VIDEO_MEM_SIZE];
uint8_t m_vram_page; uint8_t m_vram_page;
uint8_t m_printer_status;
keyboard_t m_keyboard; keyboard_t m_keyboard;

View File

@ -38,51 +38,54 @@ static int instruction_hook(device_t &device, offs_t curpc);
//static void fdc_reset(running_machine &machine); //static void fdc_reset(running_machine &machine);
//static void set_disk_int(running_machine &machine, int state); //static void set_disk_int(running_machine &machine, int state);
READ8_MEMBER(mbc55x_state::iodecode_r)
{
return m_iodecode->read8(space, offset >> 1);
}
WRITE8_MEMBER(mbc55x_state::iodecode_w)
{
m_iodecode->write8(space, offset >> 1, data);
}
/* 8255 Configuration */ /* 8255 Configuration */
READ8_MEMBER( mbc55x_state::ppi8255_r ) READ8_MEMBER(mbc55x_state::game_io_r)
{
return m_ppi->read(offset>>1);
}
WRITE8_MEMBER( mbc55x_state::ppi8255_w )
{
m_ppi->write(offset>>1, data);
}
READ8_MEMBER( mbc55x_state::mbc55x_ppi_porta_r )
{ {
return 0xff; return 0xff;
} }
READ8_MEMBER( mbc55x_state::mbc55x_ppi_portb_r ) WRITE8_MEMBER(mbc55x_state::game_io_w)
{
return 0xff;
}
READ8_MEMBER( mbc55x_state::mbc55x_ppi_portc_r )
{
return 0xff;
}
WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_porta_w )
{ {
} }
WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portb_w ) READ8_MEMBER( mbc55x_state::printer_status_r)
{ {
return m_printer_status;
} }
WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portc_w ) WRITE8_MEMBER(mbc55x_state::printer_data_w)
{
m_printer->write_data7(!BIT(data, 7));
m_printer->write_data6(!BIT(data, 6));
m_printer->write_data5(!BIT(data, 5));
m_printer->write_data4(!BIT(data, 4));
m_printer->write_data3(!BIT(data, 3));
m_printer->write_data2(!BIT(data, 2));
m_printer->write_data1(!BIT(data, 1));
m_printer->write_data0(!BIT(data, 0));
}
WRITE8_MEMBER(mbc55x_state::disk_select_w)
{ {
floppy_image_device *floppy = nullptr; floppy_image_device *floppy = nullptr;
switch (data & 0x03) switch (data & 0x03)
{ {
case 0: floppy = m_floppy0->get_device(); break; case 0: floppy = m_floppy[0]->get_device(); break;
case 1: floppy = m_floppy1->get_device(); break; case 1: floppy = m_floppy[1]->get_device(); break;
case 2: floppy = m_floppy2->get_device(); break; case 2: floppy = m_floppy[2]->get_device(); break;
case 3: floppy = m_floppy3->get_device(); break; case 3: floppy = m_floppy[3]->get_device(); break;
} }
m_fdc->set_floppy(floppy); m_fdc->set_floppy(floppy);
@ -92,45 +95,23 @@ WRITE8_MEMBER( mbc55x_state::mbc55x_ppi_portc_w )
floppy->mon_w(0); floppy->mon_w(0);
floppy->ss_w(BIT(data, 2)); floppy->ss_w(BIT(data, 2));
} }
m_printer->write_strobe(!BIT(data, 3));
} }
/* Serial port USART, unimplemented as yet */ WRITE_LINE_MEMBER(mbc55x_state::printer_busy_w)
READ8_MEMBER( mbc55x_state::mbc55x_usart_r )
{ {
return 0; m_printer_status = (m_printer_status & 0xef) | (state ? 0x10 : 0x00);
} }
WRITE8_MEMBER( mbc55x_state::mbc55x_usart_w ) WRITE_LINE_MEMBER(mbc55x_state::printer_paper_end_w)
{ {
m_printer_status = (m_printer_status & 0xdf) | (state ? 0x20 : 0x00);
} }
/* PIC 8259 Configuration */ WRITE_LINE_MEMBER(mbc55x_state::printer_select_w)
READ8_MEMBER(mbc55x_state::mbcpic8259_r)
{ {
return m_pic->read(offset>>1); m_printer_status = (m_printer_status & 0xbf) | (state ? 0x40 : 0x00);
}
WRITE8_MEMBER(mbc55x_state::mbcpic8259_w)
{
m_pic->write(offset>>1, data);
}
READ8_MEMBER(mbc55x_state::mbcpit8253_r)
{
return m_pit->read(offset >> 1);
}
WRITE8_MEMBER(mbc55x_state::mbcpit8253_w)
{
m_pit->write(offset >> 1, data);
}
WRITE_LINE_MEMBER( mbc55x_state::pit8253_t2 )
{
m_kb_uart->write_txc(state);
m_kb_uart->write_rxc(state);
} }
/* Video ram page register */ /* Video ram page register */
@ -147,16 +128,6 @@ WRITE8_MEMBER( mbc55x_state::vram_page_w )
m_vram_page=data; m_vram_page=data;
} }
READ8_MEMBER(mbc55x_state::mbc55x_disk_r)
{
return m_fdc->read(offset>>1);
}
WRITE8_MEMBER(mbc55x_state::mbc55x_disk_w)
{
m_fdc->write(offset>>1, data);
}
/* /*
Keyboard emulation Keyboard emulation
@ -195,9 +166,9 @@ void mbc55x_state::scan_keyboard()
{ '9', '0', '-', '=', '\\', 'q', 'w', 'e' }, { '9', '0', '-', '=', '\\', 'q', 'w', 'e' },
{ 'r', 't', 'y', 'u', 'i', 'o', 'p', '[' }, { 'r', 't', 'y', 'u', 'i', 'o', 'p', '[' },
{ ']', 'a', 's', 'd', 'f', 'g', 'h', 'j' }, { ']', 'a', 's', 'd', 'f', 'g', 'h', 'j' },
{ 'k', 'l', ';', '\'', '`', 0x0D, 'z', 'x' }, { 'k', 'l', ';', '\'', '`', 0x0d, 'z', 'x' },
{ 'c', 'v', 'b', 'n', 'm', ',', '.', '/', }, { 'c', 'v', 'b', 'n', 'm', ',', '.', '/', },
{ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', } { ' ', 0x08, ' ', ' ', ' ', ' ', ' ', ' ', }
}; };
@ -209,7 +180,7 @@ void mbc55x_state::scan_keyboard()
{ '}', 'A', 'S', 'D', 'F', 'G', 'H', 'J' }, { '}', 'A', 'S', 'D', 'F', 'G', 'H', 'J' },
{ 'K', 'L', ':', '"', '~', 0x0d, 'Z', 'X' }, { 'K', 'L', ':', '"', '~', 0x0d, 'Z', 'X' },
{ 'C', 'V', 'B', 'N', 'M', ',', '?', '/' }, { 'C', 'V', 'B', 'N', 'M', ',', '?', '/' },
{ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' } { ' ', 0x08, ' ', ' ', ' ', ' ', ' ', ' ' }
}; };
// First read shift, control and graph // First read shift, control and graph
@ -246,7 +217,6 @@ TIMER_CALLBACK_MEMBER(mbc55x_state::keyscan_callback)
READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r) READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r)
{ {
uint8_t result = 0; uint8_t result = 0;
offset>>=1;
switch (offset) switch (offset)
{ {
@ -264,17 +234,6 @@ READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r)
return result; return result;
} }
WRITE8_MEMBER(mbc55x_state::mbc55x_kb_usart_w)
{
offset>>=1;
switch (offset)
{
case 0 : m_kb_uart->data_w(data); break;
case 1 : m_kb_uart->control_w(data); break;
}
}
void mbc55x_state::set_ram_size() void mbc55x_state::set_ram_size()
{ {
address_space &space = m_maincpu->space( AS_PROGRAM ); address_space &space = m_maincpu->space( AS_PROGRAM );
@ -346,8 +305,12 @@ void mbc55x_state::machine_start()
m_debug_machine=DEBUG_NONE; m_debug_machine=DEBUG_NONE;
m_printer_status = 0xff;
// Allocate keyscan timer // Allocate keyscan timer
m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mbc55x_state::keyscan_callback),this)); m_keyboard.keyscan_timer=machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mbc55x_state::keyscan_callback),this));
m_kb_uart->write_cts(0);
} }

View File

@ -183,8 +183,3 @@ void mbc55x_state::video_reset()
logerror("Video reset\n"); logerror("Video reset\n");
} }
WRITE_LINE_MEMBER(mbc55x_state::screen_vblank_mbc55x)
{
// logerror("screen_vblank_mbc55x\n");
}