invert IRQ signal from RTC (Concurrent DOS 4.1 now boots), add Centronics parallel port.

This commit is contained in:
mahlemiut 2016-10-14 19:14:59 +13:00
parent 42f0d8c6da
commit f26e087cf0

View File

@ -124,6 +124,12 @@ Its BIOS performs POST and halts as there's no keyboard.
#include "machine/octo_kbd.h"
#include "machine/bankdev.h"
#include "machine/ram.h"
#include "bus/centronics/ctronics.h"
#include "bus/centronics/comxpl80.h"
#include "bus/centronics/epson_ex800.h"
#include "bus/centronics/epson_lx800.h"
#include "bus/centronics/epson_lx810l.h"
#include "bus/centronics/printer.h"
class octopus_state : public driver_device
{
@ -148,6 +154,7 @@ public:
m_ppi(*this, "ppi"),
m_speaker(*this, "speaker"),
m_serial(*this, "serial"),
m_parallel(*this, "parallel"),
m_z80_bankdev(*this, "z80_bank"),
m_ram(*this, "ram"),
m_current_dma(-1),
@ -184,11 +191,15 @@ public:
DECLARE_WRITE8_MEMBER(rtc_w);
DECLARE_READ8_MEMBER(z80_vector_r);
DECLARE_WRITE8_MEMBER(z80_vector_w);
DECLARE_READ8_MEMBER(parallel_r);
DECLARE_WRITE8_MEMBER(parallel_w);
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(parallel_busy_w) { m_printer_busy = state; }
DECLARE_WRITE_LINE_MEMBER(parallel_slctout_w) { m_printer_slctout = state; }
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
@ -226,6 +237,7 @@ private:
required_device<i8255_device> m_ppi;
required_device<speaker_sound_device> m_speaker;
required_device<z80sio2_device> m_serial;
required_device<centronics_device> m_parallel;
required_device<address_map_bank_device> m_z80_bankdev;
required_device<ram_device> m_ram;
@ -246,6 +258,8 @@ private:
UINT8 m_prev_cntl;
UINT8 m_rs232_vector;
UINT8 m_rs422_vector;
bool m_printer_busy;
bool m_printer_slctout;
emu_timer* m_timer_beep;
};
@ -288,7 +302,7 @@ static ADDRESS_MAP_START( octopus_io, AS_IO, 8, octopus_state )
// 0xcf: mode control
AM_RANGE(0xd0, 0xd3) AM_DEVREADWRITE("fdc", fd1793_t, read, write)
AM_RANGE(0xe0, 0xe4) AM_READWRITE(z80_vector_r, z80_vector_w)
// 0xf0-f1: Parallel interface data I/O (Centronics), and control/status
AM_RANGE(0xf0, 0xf1) AM_READWRITE(parallel_r, parallel_w)
AM_RANGE(0xf8, 0xff) AM_DEVREADWRITE("ppi", i8255_device, read, write)
ADDRESS_MAP_END
@ -414,10 +428,14 @@ WRITE8_MEMBER(octopus_state::system_w)
READ8_MEMBER(octopus_state::system_r)
{
UINT8 val = 0x00;
switch(offset)
{
case 0:
return 0x1f; // do bits 0-4 mean anything? Language DIPs?
val = 0x1f;
if(m_printer_slctout)
val |= 0x20;
return val; // do bits 0-4 mean anything? Language DIPs?
}
return 0xff;
@ -613,6 +631,50 @@ WRITE_LINE_MEMBER(octopus_state::serial_clock_w)
m_serial->txca_w(state);
}
// Parallel Centronics port
// 0xf0 : data
// 0xf1 : control
// bit 2 = INIT? On boot, bits 0 and 1 are set high, bit 2 is set low then high again, all other bits are set low
// can generate interrupts - tech manual suggests that Strobe, Init, Ack, and Busy can trigger an interrupt (IRQ14)
READ8_MEMBER(octopus_state::parallel_r)
{
switch(offset)
{
case 0:
return 0;
case 1:
return m_printer_busy ? 0x01 : 0x00; // correct? Tech manual doesn't explain which bit is which
}
return 0xff;
}
WRITE8_MEMBER(octopus_state::parallel_w)
{
switch(offset)
{
case 0: // data
if(!(m_gpo & 0x02)) // parallel data direction
{
m_parallel->write_data0(BIT(data,0));
m_parallel->write_data1(BIT(data,1));
m_parallel->write_data2(BIT(data,2));
m_parallel->write_data3(BIT(data,3));
m_parallel->write_data4(BIT(data,4));
m_parallel->write_data5(BIT(data,5));
m_parallel->write_data6(BIT(data,6));
m_parallel->write_data7(BIT(data,7));
}
break;
case 1: // control (bit order unknown?)
if(!(m_gpo & 0x01)) // parallel control direction
{
m_parallel->write_init(BIT(data,2));
m_pic2->ir6_w(!BIT(data,2));
}
break;
}
}
READ8_MEMBER(octopus_state::dma_read)
{
UINT8 byte;
@ -642,13 +704,14 @@ WRITE_LINE_MEMBER( octopus_state::dma_hrq_changed )
// Any interrupt will also give bus control back to the 8088
IRQ_CALLBACK_MEMBER(octopus_state::x86_irq_cb)
{
UINT8 vector;
m_subcpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
m_z80_active = false;
if((strcmp(device.tag(),"pic_master") == 0) && irqline == 1)
return m_serial->m1_r();
else
return m_pic1->inta_cb(device,irqline);
vector = m_pic1->inta_cb(device,irqline);
if(vector == 0x61) // if we have hit a serial comms IRQ, then also have the Z80SIO/2 acknowledge the interrupt
vector = m_serial->m1_r();
return vector;
}
void octopus_state::machine_start()
@ -707,6 +770,15 @@ static SLOT_INTERFACE_START(keyboard)
SLOT_INTERFACE("octopus", OCTOPUS_KEYBOARD)
SLOT_INTERFACE_END
SLOT_INTERFACE_START(octopus_centronics_devices)
SLOT_INTERFACE("pl80", COMX_PL80)
SLOT_INTERFACE("ex800", EPSON_EX800)
SLOT_INTERFACE("lx800", EPSON_LX800)
SLOT_INTERFACE("lx810l", EPSON_LX810L)
SLOT_INTERFACE("ap2000", EPSON_AP2000)
SLOT_INTERFACE("printer", CENTRONICS_PRINTER)
SLOT_INTERFACE_END
static MACHINE_CONFIG_START( octopus, octopus_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu",I8088, XTAL_24MHz / 3) // 8MHz
@ -763,7 +835,7 @@ static MACHINE_CONFIG_START( octopus, octopus_state )
MCFG_I8255_OUT_PORTB_CB(WRITE8(octopus_state,cntl_w))
MCFG_I8255_OUT_PORTC_CB(WRITE8(octopus_state,gpo_w))
MCFG_MC146818_ADD("rtc", XTAL_32_768kHz)
MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic_slave",pic8259_device, ir2_w))
MCFG_MC146818_IRQ_HANDLER(DEVWRITELINE("pic_slave",pic8259_device, ir2_w)) MCFG_DEVCB_INVERT
// Keyboard UART
MCFG_DEVICE_ADD("keyboard", I8251, 0)
@ -804,9 +876,10 @@ static MACHINE_CONFIG_START( octopus, octopus_state )
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
// Centronics parallel interface
// Winchester HD controller (Xebec/SASI compatible? uses TTL logic)
MCFG_CENTRONICS_ADD("parallel", octopus_centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(octopus_state, parallel_busy_w))
MCFG_CENTRONICS_SELECT_HANDLER(WRITELINE(octopus_state, parallel_slctout_w))
// TODO: Winchester HD controller (Xebec/SASI compatible? uses TTL logic)
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)