mirror of
https://github.com/holub/mame
synced 2025-04-23 00:39:36 +03:00
mg1: add hard disk controller
This commit is contained in:
parent
d939557e4c
commit
6187f85536
@ -8,41 +8,42 @@
|
||||
* - http://www.cpu-ns32k.net/Whitechapel.html
|
||||
*
|
||||
* TODO:
|
||||
* - hard disk controller
|
||||
* - mouse
|
||||
*/
|
||||
/*
|
||||
* WIP
|
||||
* - boots 42nix from hard disk image, but can't operate GUI without mouse
|
||||
*/
|
||||
|
||||
#include "emu.h"
|
||||
|
||||
// cpus and memory
|
||||
#include "kbd.h"
|
||||
|
||||
#include "bus/rs232/rs232.h"
|
||||
#include "cpu/ns32000/ns32000.h"
|
||||
#include "cpu/m6800/m6801.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
// various hardware
|
||||
#include "machine/am79c90.h"
|
||||
#include "machine/am9516.h"
|
||||
#include "machine/clock.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/input_merger.h"
|
||||
#include "machine/mm58174.h"
|
||||
#include "machine/ns32081.h"
|
||||
#include "machine/ns32082.h"
|
||||
#include "machine/ns32202.h"
|
||||
#include "machine/am79c90.h"
|
||||
#include "machine/am9516.h"
|
||||
#include "machine/i8251.h"
|
||||
#include "machine/nvram.h"
|
||||
#include "machine/pit8253.h"
|
||||
#include "machine/ram.h"
|
||||
#include "machine/upd7261.h"
|
||||
#include "machine/wd_fdc.h"
|
||||
//#include "machine/upd7261.h"
|
||||
#include "machine/mm58174.h"
|
||||
#include "machine/clock.h"
|
||||
#include "sound/spkrdev.h"
|
||||
#include "video/mc6845.h"
|
||||
|
||||
// buses and connectors
|
||||
#include "bus/rs232/rs232.h"
|
||||
#include "imagedev/floppy.h"
|
||||
#include "formats/applix_dsk.h"
|
||||
|
||||
// video
|
||||
#include "screen.h"
|
||||
#include "video/mc6845.h"
|
||||
|
||||
#include "kbd.h"
|
||||
#include "speaker.h"
|
||||
|
||||
#include "mg1.lh"
|
||||
|
||||
@ -72,12 +73,15 @@ public:
|
||||
, m_fdc(*this, "fdc")
|
||||
, m_fdd(*this, "fdc:0:35dd")
|
||||
, m_net(*this, "net")
|
||||
//, m_hdc(*this, "hdc")
|
||||
, m_hdc(*this, "hdc")
|
||||
, m_ctc(*this, "ctc")
|
||||
, m_crtc(*this, "crtc")
|
||||
, m_screen(*this, "screen")
|
||||
, m_vmram(*this, "vmram")
|
||||
, m_kbd(*this, "kbd")
|
||||
, m_buzzer(*this, "buzzer")
|
||||
, m_buzzen(*this, "buzzer_enable")
|
||||
, m_mouse_buttons(*this, "mouse_buttons")
|
||||
, m_led_err(*this, "led_err")
|
||||
, m_led_fdd(*this, "led_fdd")
|
||||
{
|
||||
@ -99,8 +103,6 @@ protected:
|
||||
private:
|
||||
MC6845_UPDATE_ROW(update_row);
|
||||
|
||||
static void floppy_formats(format_registration &fr);
|
||||
|
||||
// devices
|
||||
required_device<ns32016_device> m_cpu;
|
||||
required_device<ns32081_device> m_fpu;
|
||||
@ -122,7 +124,7 @@ private:
|
||||
required_device<floppy_image_device> m_fdd;
|
||||
required_device<am7990_device> m_net;
|
||||
|
||||
//required_device<upd7261_device> m_hdc;
|
||||
required_device<upd7261_device> m_hdc;
|
||||
required_device<pit8253_device> m_ctc;
|
||||
|
||||
required_device<mc6845_device> m_crtc;
|
||||
@ -131,6 +133,11 @@ private:
|
||||
|
||||
required_device<mg1_kbd_device> m_kbd;
|
||||
|
||||
required_device<speaker_sound_device> m_buzzer;
|
||||
required_device<input_merger_all_high_device> m_buzzen;
|
||||
|
||||
required_ioport m_mouse_buttons;
|
||||
|
||||
output_finder<> m_led_err;
|
||||
output_finder<> m_led_fdd;
|
||||
|
||||
@ -208,18 +215,18 @@ template <unsigned ST> void mg1_state::cpu_map(address_map &map)
|
||||
map(0x309200, 0x3093ff).mirror(0xcf6000).rw(m_net, FUNC(am7990_device::regs_r), FUNC(am7990_device::regs_w));
|
||||
map(0x309400, 0x3095ff).mirror(0xcf6000).umask16(0x00ff).rw(m_rtc, FUNC(mm58174_device::read), FUNC(mm58174_device::write));
|
||||
|
||||
//map(0x309600, 0x309603).mirror(0xcf6000).m(m_hdc, FUNC(upd7261_device::map)).umask16(0x00ff);
|
||||
map(0x309600, 0x309603).mirror(0xcf6000).m(m_hdc, FUNC(upd7261_device::map)).umask16(0x00ff);
|
||||
|
||||
map(0x309800, 0x309807).mirror(0xcf6000).umask16(0x00ff).rw(m_fdc, FUNC(wd1770_device::read), FUNC(wd1770_device::write));
|
||||
|
||||
map(0x309a00, 0x309bff).mirror(0xcf6000).umask16(0x00ff).lw8(
|
||||
[this](u8 data)
|
||||
{
|
||||
m_fdd->ss_w(!BIT(data, 0));
|
||||
m_fdd->ss_w(BIT(data, 0));
|
||||
m_fdc->dden_w(BIT(data, 1));
|
||||
m_led_fdd = !BIT(data, 2);
|
||||
m_led_err = BIT(data, 3);
|
||||
//m_hdc->head_w(BIT(data, 4) ? 0x08 : 0x00);
|
||||
m_hdc->head_w(BIT(data, 4) ? 0x08 : 0x00);
|
||||
}, "fdc_reg_w");
|
||||
|
||||
//map(0x309c00, 0x309dff).mirror(0xcf6000); // dma interrupt acknowledge
|
||||
@ -243,13 +250,13 @@ void mg1_state::iop_map(address_map &map)
|
||||
}, "iop_sem_w");
|
||||
|
||||
// i/o area
|
||||
//map(0x2000, 0x201f).mirror(0x1e00).lw8([this](u8 data) { logerror("mouse x counter 0x%02x\n", data); }, "mouse_x"); // mouse x counter
|
||||
map(0x2000, 0x201f).mirror(0x1e00).lw8([this](u8 data) { m_buzzen->in_w<1>(BIT(data, 0)); }, "mouse_x"); // mouse x counter/buzzer enable
|
||||
map(0x2020, 0x2020).mirror(0x1e00).lw8([this](offs_t offset, u8 data) { logerror("host reset %x,0x%02x\n", offset, data); }, "host_reset").select(0x0100);
|
||||
//map(0x2040, 0x205f).mirror(0x1e00).lw8([this](u8 data) { logerror("cursor 0x%02x\n", data); }, "cursor"); // cursor pixel offset & cursor number
|
||||
map(0x2060, 0x207f).mirror(0x1e00).lw8([this](u8 data) { m_icu->ir_w<10>(0); }, "iopint");
|
||||
map(0x2080, 0x2080).mirror(0x1e00).rw(m_crtc, FUNC(mc6845_device::status_r), FUNC(mc6845_device::address_w));
|
||||
map(0x2081, 0x2081).mirror(0x1e00).rw(m_crtc, FUNC(mc6845_device::register_r), FUNC(mc6845_device::register_w));
|
||||
//map(0x20a0, 0x20bf).mirror(0x1e00).lw8([this](u8 data) { logerror("mouse buttons 0x%02x\n", data); }, "mouse_b"); // mouse buttons
|
||||
map(0x20a0, 0x20bf).mirror(0x1e00).lr8([this]() { return m_mouse_buttons->read(); }, "mouse_b"); // mouse buttons
|
||||
//map(0x20c0, 0x20df).mirror(0x1e00).lw8([this](u8 data) { logerror("mouse y counter 0x%02x\n", data); }, "mouse_y"); // mouse y counter
|
||||
map(0x20e0, 0x20ff).mirror(0x1e00).rw(m_iop_ctc, FUNC(pit8253_device::read), FUNC(pit8253_device::write));
|
||||
|
||||
@ -266,6 +273,10 @@ void mg1_state::dma_map(address_map &map)
|
||||
}
|
||||
|
||||
static INPUT_PORTS_START(mg1)
|
||||
PORT_START("mouse_buttons")
|
||||
PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Left Button") PORT_CODE(MOUSECODE_BUTTON1)
|
||||
PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Middle Button") PORT_CODE(MOUSECODE_BUTTON3)
|
||||
PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Mouse Right Button") PORT_CODE(MOUSECODE_BUTTON2)
|
||||
INPUT_PORTS_END
|
||||
|
||||
MC6845_UPDATE_ROW(mg1_state::update_row)
|
||||
@ -296,6 +307,14 @@ MC6845_UPDATE_ROW(mg1_state::update_row)
|
||||
}
|
||||
}
|
||||
|
||||
static void floppy_formats(format_registration &fr)
|
||||
{
|
||||
fr.add_mfm_containers();
|
||||
|
||||
// TODO: unrelated to applix, but same logical format
|
||||
fr.add(FLOPPY_APPLIX_FORMAT);
|
||||
}
|
||||
|
||||
void mg1_state::mg1(machine_config &config)
|
||||
{
|
||||
NS32016(config, m_cpu, 16_MHz_XTAL / 2);
|
||||
@ -320,7 +339,7 @@ void mg1_state::mg1(machine_config &config)
|
||||
* 5 busint3 level lo
|
||||
* 6 level lo
|
||||
* 7 busint4 level lo
|
||||
* 8 level hi
|
||||
* 8 fdcintr level hi
|
||||
* 9 busint5 edge lo
|
||||
* 10 iopint edge lo
|
||||
* 11 edge hi
|
||||
@ -346,20 +365,21 @@ void mg1_state::mg1(machine_config &config)
|
||||
NVRAM(config, m_iop_sram); // 1xD4016C-3 2048x8 SRAM
|
||||
|
||||
PIT8253(config, m_iop_ctc);
|
||||
// channel 0 buzzer
|
||||
// out0 -> speaker
|
||||
// clk0 <- iope (1MHz)
|
||||
// gate0 <- pullup?
|
||||
m_iop_ctc->set_clk<0>(8_MHz_XTAL / 8);
|
||||
m_iop_ctc->out_handler<0>().set(m_buzzen, FUNC(input_merger_all_high_device::in_w<0>));
|
||||
|
||||
INPUT_MERGER_ALL_HIGH(config, m_buzzen);
|
||||
m_buzzen->output_handler().set(m_buzzer, FUNC(speaker_sound_device::level_w));
|
||||
|
||||
// channel 1 & 2 cursor position
|
||||
// crt-vbas -> clk1, clk2
|
||||
// hsync -> gate2
|
||||
// out2 -> ?
|
||||
// out1 -> ?
|
||||
// vsync -> gate1
|
||||
m_iop_ctc->set_clk<1>(60_MHz_XTAL / 64);
|
||||
m_iop_ctc->set_clk<2>(60_MHz_XTAL / 64);
|
||||
// out2 -> cout2 (triggered every line)
|
||||
// out1 -> cout1 (goes low when cursor required on this line)
|
||||
|
||||
AM9516(config, m_dma[0], 10_MHz_XTAL / 2); // graphics (not used)
|
||||
AM9516(config, m_dma[0], 8_MHz_XTAL / 2); // graphics (not used)
|
||||
|
||||
AM9516(config, m_dma[1], 10_MHz_XTAL / 2); // general, ch1 hard disk, ch2 -> J3 or floppy
|
||||
AM9516(config, m_dma[1], 8_MHz_XTAL / 2); // general, ch1 hard disk, ch2 -> J3 or floppy
|
||||
m_dma[1]->out_int().set(m_icu, FUNC(ns32202_device::ir_w<4>));
|
||||
m_dma[1]->set_addrmap(am9516_device::SYSTEM_MEM, &mg1_state::dma_map);
|
||||
|
||||
@ -384,6 +404,8 @@ void mg1_state::mg1(machine_config &config)
|
||||
m_crtc->set_show_border_area(false);
|
||||
m_crtc->set_hpixels_per_column(64);
|
||||
m_crtc->set_update_row_callback(FUNC(mg1_state::update_row));
|
||||
m_crtc->out_vsync_callback().set(m_iop_ctc, FUNC(pit8253_device::write_gate1));
|
||||
m_crtc->out_hsync_callback().set(m_iop_ctc, FUNC(pit8253_device::write_gate2));
|
||||
|
||||
// black & white crt, 56Hz refresh, 46.877kHz line, line sync 1.066uS, frame sync 341.32uS
|
||||
// crtc sees it as 16 col x 50 rows, with 64x16 character cells
|
||||
@ -396,20 +418,18 @@ void mg1_state::mg1(machine_config &config)
|
||||
m_net->dma_in().set([this](offs_t offset) { return m_cpu->space(0).read_word(offset); });
|
||||
m_net->dma_out().set([this](offs_t offset, u16 data, u16 mem_mask) { m_cpu->space(0).write_word(offset, data, mem_mask); });
|
||||
|
||||
// hard disk controller not emulated
|
||||
#if 0
|
||||
UPD7261(config, m_hdc, 10_MHz_XTAL);
|
||||
m_hdc->out_dreq().set(m_dma[1], FUNC(am9516_device::dreq_w<0>)).invert();
|
||||
m_hdc->out_int().set(m_icu, FUNC(ns32202_device::ir_w<3>));
|
||||
|
||||
HARDDISK(config, "hdc:0");
|
||||
HARDDISK(config, "hdc:1");
|
||||
#endif
|
||||
|
||||
WD1770(config, m_fdc, 8_MHz_XTAL);
|
||||
m_fdc->intrq_wr_callback().set(m_icu, FUNC(ns32202_device::ir_w<8>));
|
||||
//m_fdc->drq_wr_callback().set(m_dma, FUNC(dmac_0448_device::drq<1>));
|
||||
m_fdc->drq_wr_callback().set(m_dma[1], FUNC(am9516_device::dreq_w<1>)).invert();
|
||||
|
||||
// format is 80 tracks, 5 sectors/track, 1024 bytes/sector
|
||||
FLOPPY_CONNECTOR(config, "fdc:0", "35dd", FLOPPY_35_DD, true, floppy_formats).enable_sound(true);
|
||||
|
||||
PIT8253(config, m_ctc);
|
||||
@ -427,29 +447,29 @@ void mg1_state::mg1(machine_config &config)
|
||||
/*
|
||||
* Documentation indicates the serial clock for the IOP should be driven by the keyboard, however the available
|
||||
* keyboard firmware does not produce a compatible clock output. A hand-drawn sketch indicates the system front
|
||||
* panel allows the serial clock to be generated by a 2.4676MHz crystal and a 4060 divider. The default strapping
|
||||
* panel allows the serial clock to be generated by a 2.4576MHz crystal and a 4060 divider. The default strapping
|
||||
* selects a 256 divisor, giving a 9600Hz clock which after the 8x divider in the IOP gives a 1200 baud data rate.
|
||||
*/
|
||||
clock_device &kbd_clk(CLOCK(config, "kbd_clock", 2.4576_MHz_XTAL / 256));
|
||||
kbd_clk.signal_handler().set([this](int state) { if (state) m_iop->m6801_clock_serial(); });
|
||||
|
||||
SPEAKER(config, "mono").front_center();
|
||||
SPEAKER_SOUND(config, m_buzzer);
|
||||
m_buzzer->add_route(ALL_OUTPUTS, "mono", 0.50);
|
||||
|
||||
//SOFTWARE_LIST(config, "flop_list").set_original("mg1_flop");
|
||||
//SOFTWARE_LIST(config, "hdd_list").set_original("mg1_hdd");
|
||||
|
||||
config.set_default_layout(layout_mg1);
|
||||
}
|
||||
|
||||
void mg1_state::floppy_formats(format_registration &fr)
|
||||
{
|
||||
fr.add_mfm_containers();
|
||||
fr.add(FLOPPY_APPLIX_FORMAT);
|
||||
}
|
||||
|
||||
ROM_START(mg1)
|
||||
ROM_REGION16_LE(0x4000, "prom", 0)
|
||||
ROM_SYSTEM_BIOS(0, "260", "v2.60")
|
||||
ROMX_LOAD("sys_260_even.u291", 0x0000, 0x2000, CRC(24b45b73) SHA1(04d86587b104aa122ac395aa39eb92a1f4d68def), ROM_BIOS(0) | ROM_SKIP(1))
|
||||
ROMX_LOAD("sys_260_odd.u292", 0x0001, 0x2000, CRC(a46ebbf8) SHA1(a2ab9fa3a9576d63d8d49730bfcd58a0f508b30f), ROM_BIOS(0) | ROM_SKIP(1))
|
||||
|
||||
// floppy support seems to work better with this firmware version
|
||||
ROM_SYSTEM_BIOS(1, "251", "v2.51")
|
||||
ROMX_LOAD("even_2.51__sys__13.1_u291.u291", 0x0000, 0x2000, CRC(677cab3c) SHA1(d0197b45ddb1ddd8cd125727312b06dcae0f984a), ROM_BIOS(1) | ROM_SKIP(1))
|
||||
ROMX_LOAD("odd_2.51__sys__13.1_u292.u292", 0x0001, 0x2000, CRC(b0134a98) SHA1(a81bd4987030b09799bad0c3bc758ea8aed8cd2f), ROM_BIOS(1) | ROM_SKIP(1))
|
||||
|
Loading…
Reference in New Issue
Block a user