This commit is contained in:
briantro 2016-10-06 19:48:00 -05:00
commit 9b91259fa7

View file

@ -120,6 +120,7 @@ Its BIOS performs POST and halts as there's no keyboard.
#include "imagedev/floppy.h"
#include "machine/pit8253.h"
#include "sound/speaker.h"
#include "machine/z80dart.h"
#include "machine/octo_kbd.h"
#include "machine/bankdev.h"
#include "machine/ram.h"
@ -146,6 +147,7 @@ public:
m_pit(*this, "pit"),
m_ppi(*this, "ppi"),
m_speaker(*this, "speaker"),
m_serial(*this, "serial"),
m_z80_bankdev(*this, "z80_bank"),
m_ram(*this, "main_ram"),
m_current_dma(-1),
@ -184,7 +186,8 @@ public:
DECLARE_WRITE_LINE_MEMBER(spk_w);
DECLARE_WRITE_LINE_MEMBER(spk_freq_w);
DECLARE_WRITE_LINE_MEMBER(beep_w);
DECLARE_WRITE_LINE_MEMBER(serial_clock_w);
DECLARE_WRITE_LINE_MEMBER(dack0_w) { m_dma1->hack_w(state ? 0 : 1); } // for all unused DMA channel?
DECLARE_WRITE_LINE_MEMBER(dack1_w) { if(!state) m_current_dma = 1; else if(m_current_dma == 1) m_current_dma = -1; } // HD
DECLARE_WRITE_LINE_MEMBER(dack2_w) { if(!state) m_current_dma = 2; else if(m_current_dma == 2) m_current_dma = -1; } // RAM refresh
@ -220,6 +223,7 @@ private:
required_device<pit8253_device> m_pit;
required_device<i8255_device> m_ppi;
required_device<speaker_sound_device> m_speaker;
required_device<z80sio2_device> m_serial;
required_device<address_map_bank_device> m_z80_bankdev;
required_device<ram_device> m_ram;
@ -267,7 +271,10 @@ static ADDRESS_MAP_START( octopus_io, AS_IO, 8, octopus_state )
AM_RANGE(0x51, 0x51) AM_DEVREADWRITE("keyboard", i8251_device, status_r, control_w)
// 0x70-73: HD controller
AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("pit", pit8253_device, read, write)
// 0xa0-a3: serial interface (Z80 SIO/2)
AM_RANGE(0xa0, 0xa0) AM_DEVREADWRITE("serial", z80sio2_device, da_r, da_w)
AM_RANGE(0xa1, 0xa1) AM_DEVREADWRITE("serial", z80sio2_device, ca_r, ca_w)
AM_RANGE(0xa2, 0xa2) AM_DEVREADWRITE("serial", z80sio2_device, db_r, db_w)
AM_RANGE(0xa3, 0xa3) AM_DEVREADWRITE("serial", z80sio2_device, cb_r, cb_w)
AM_RANGE(0xb0, 0xb1) AM_DEVREADWRITE("pic_master", pic8259_device, read, write)
AM_RANGE(0xb4, 0xb5) AM_DEVREADWRITE("pic_slave", pic8259_device, read, write)
AM_RANGE(0xc0, 0xc7) AM_DEVREADWRITE("crtc", scn2674_device, read, write)
@ -472,13 +479,11 @@ WRITE8_MEMBER(octopus_state::cntl_w)
{
m_rtc_address = true;
m_rtc_data = false;
logerror("Address strobe!\n");
}
if((data & 0x04) && !(m_prev_cntl & 0x04))
{
m_rtc_address = false;
m_rtc_data = true;
logerror("Data strobe!\n");
}
m_ppi->pc4_w(data & 0x02);
m_prev_cntl = m_cntl;
@ -567,6 +572,12 @@ WRITE_LINE_MEMBER(octopus_state::beep_w)
}
}
WRITE_LINE_MEMBER(octopus_state::serial_clock_w)
{
m_serial->rxca_w(state);
m_serial->txca_w(state);
}
READ8_MEMBER(octopus_state::dma_read)
{
UINT8 byte;
@ -621,6 +632,7 @@ void octopus_state::machine_reset()
m_rtc_address = true;
m_rtc_data = false;
membank("main_ram_bank")->set_base(m_ram->pointer());
m_kb_uart->write_dsr(1); // DSR is used to determine if a keyboard is connected? If DSR is high, then the CHAR_OUT BIOS function will not output to the screen.
}
void octopus_state::video_start()
@ -720,7 +732,6 @@ static MACHINE_CONFIG_START( octopus, octopus_state )
MCFG_I8251_RTS_HANDLER(WRITELINE(octopus_state,beep_w))
MCFG_RS232_PORT_ADD("keyboard_port", keyboard, "octopus")
MCFG_RS232_RXD_HANDLER(DEVWRITELINE("keyboard", i8251_device, write_rxd))
MCFG_RS232_DSR_HANDLER(DEVWRITELINE("keyboard", i8251_device, write_dsr))
MCFG_DEVICE_ADD("keyboard_clock_rx", CLOCK, 9600 * 64)
MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("keyboard",i8251_device,write_rxc))
MCFG_DEVICE_ADD("keyboard_clock_tx", CLOCK, 1200 * 64)
@ -733,8 +744,10 @@ static MACHINE_CONFIG_START( octopus, octopus_state )
MCFG_FLOPPY_DRIVE_ADD("fdc:1", octopus_floppies, "525dd", floppy_image_device::default_floppy_formats)
MCFG_DEVICE_ADD("pit", PIT8253, 0)
MCFG_PIT8253_CLK0(500) // DART channel A
MCFG_PIT8253_CLK1(500) // DART channel B
MCFG_PIT8253_CLK0(2457500) // DART channel A
MCFG_PIT8253_OUT0_HANDLER(WRITELINE(octopus_state,serial_clock_w)) // being able to write both Rx and Tx clocks at one time would be nice
MCFG_PIT8253_CLK1(2457500) // DART channel B
MCFG_PIT8253_OUT1_HANDLER(DEVWRITELINE("serial",z80sio2_device,rxtxcb_w))
MCFG_PIT8253_CLK2(2457500) // speaker frequency
MCFG_PIT8253_OUT2_HANDLER(WRITELINE(octopus_state,spk_freq_w))
@ -742,10 +755,17 @@ static MACHINE_CONFIG_START( octopus, octopus_state )
MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0)
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_Z80SIO2_ADD("serial", XTAL_16MHz / 4, 0, 0, 0, 0) // clock rate not mentioned in tech manual
MCFG_Z80DART_OUT_INT_CB(DEVWRITELINE("pic_master",pic8259_device, ir1_w))
MCFG_RS232_PORT_ADD("serial_a", default_rs232_devices, nullptr)
MCFG_RS232_CTS_HANDLER(DEVWRITELINE("serial",z80sio2_device, ctsa_w))
MCFG_RS232_RI_HANDLER(DEVWRITELINE("serial",z80sio2_device, ria_w)) MCFG_DEVCB_INVERT
MCFG_RS232_PORT_ADD("serial_b", default_rs232_devices, nullptr)
MCFG_RS232_CTS_HANDLER(DEVWRITELINE("serial",z80sio2_device, ctsb_w))
MCFG_RS232_RI_HANDLER(DEVWRITELINE("serial",z80sio2_device, rib_w)) MCFG_DEVCB_INVERT
// TODO: add components
// i8253 PIT timer (speaker output, serial timing, other stuff too?)
// Centronics parallel interface
// Z80SIO/2 (serial)
// Winchester HD controller (Xebec/SASI compatible? uses TTL logic)
/* video hardware */