summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Robbbert <Robbbert@users.noreply.github.com>2017-10-07 00:28:05 +1100
committer Robbbert <Robbbert@users.noreply.github.com>2017-10-07 00:28:05 +1100
commitd09e8e345d9692fa7a1327e228db547e389f7f5c (patch)
tree07809ba40134534188da8637969014ffb1d60555
parentd4d1b51381e6a8fb868e5ae9298aa665eab1e9d5 (diff)
ts803 : fixed and used z80sti; cleanup and notes.
-rw-r--r--src/devices/machine/z80sti.cpp2
-rw-r--r--src/mame/drivers/ts803.cpp255
2 files changed, 90 insertions, 167 deletions
diff --git a/src/devices/machine/z80sti.cpp b/src/devices/machine/z80sti.cpp
index cc69a2967bb..cabc6daf466 100644
--- a/src/devices/machine/z80sti.cpp
+++ b/src/devices/machine/z80sti.cpp
@@ -582,11 +582,13 @@ WRITE8_MEMBER( z80sti_device::write )
case REGISTER_TBDR:
LOG("Z80STI Timer B Data Register: %x\n", tag(), data);
m_tdr[TIMER_B] = data;
+ m_tmc[TIMER_B] = data;
break;
case REGISTER_TADR:
LOG("Z80STI Timer A Data Register: %x\n", tag(), data);
m_tdr[TIMER_A] = data;
+ m_tmc[TIMER_A] = data;
break;
case REGISTER_UCR:
diff --git a/src/mame/drivers/ts803.cpp b/src/mame/drivers/ts803.cpp
index ec0ea6e3a03..25a2cb8b41d 100644
--- a/src/mame/drivers/ts803.cpp
+++ b/src/mame/drivers/ts803.cpp
@@ -21,24 +21,21 @@ PAGE SEL bit in PORT0 set to 1:
e000-FFFF - OS RAM
Z80STI:
- - fails hardware test, left out for now.
- provides baud-rate clock for DART ch B (serial printer)
- merges FDC and HDC irq into the daisy chain. FDC works without it though.
Keyboard / Z80DART:
- Keyboard has 8048 plus undumped rom. There's no schematic.
- Protocol: 9600 baud, 8 data bits, 2 stop bits, no parity, no handshaking.
- - Problem: every 2nd keystroke is ignored.
+ - Problem: every 2nd keystroke is ignored. The bios does this on purpose.
- Problem: some of the disks cause the keyboard to produce rubbish, unable to find
a baud rate that works.
To Do:
- - Fix Z80STI and use it
- Fix weird problem with keyboard, or better, get the rom and emulate it.
- Hard Drive
- Videoram has 4 banks, only first bank is currently used for display
- Option of a further 64k of main ram.
- - Dipswitches
- 2 more Serial ports (Serial Printer & Mouse; Modem)
- Optional RS422 board (has Z80SIO +others)
- Diagnostic LEDs
@@ -48,6 +45,7 @@ PAGE SEL bit in PORT0 set to 1:
**************************************************************************************************/
#include "emu.h"
+#include "machine/clock.h"
#include "bus/rs232/rs232.h"
#include "cpu/z80/z80.h"
#include "cpu/z80/z80daisy.h"
@@ -70,51 +68,35 @@ public:
, m_fdc(*this, "fdc")
, m_floppy0(*this, "fdc:0")
, m_floppy1(*this, "fdc:1")
- //, m_sti(*this, "sti")
- , m_dart(*this, "dart")
- , m_crtc(*this,"crtc")
, m_p_chargen(*this, "chargen")
- { }
-
- DECLARE_READ8_MEMBER( ts803_port_r );
- DECLARE_WRITE8_MEMBER( ts803_port_w );
- DECLARE_READ8_MEMBER( ts803_porthi_r );
- DECLARE_WRITE8_MEMBER( ts803_porthi_w );
-
- DECLARE_WRITE8_MEMBER( disk_0_control_w );
- DECLARE_READ8_MEMBER( disk_0_control_r );
-
- DECLARE_WRITE8_MEMBER( keyboard_put );
-
+ , m_io_dsw(*this, "DSW")
+ { }
+
+ DECLARE_READ8_MEMBER(port10_r);
+ DECLARE_WRITE8_MEMBER(port10_w);
+ DECLARE_READ8_MEMBER(porta0_r);
+ DECLARE_WRITE8_MEMBER(porta0_w);
+ DECLARE_WRITE8_MEMBER(disk_0_control_w);
+ DECLARE_READ8_MEMBER(disk_0_control_r);
MC6845_UPDATE_ROW(crtc_update_row);
MC6845_ON_UPDATE_ADDR_CHANGED(crtc_update_addr);
DECLARE_WRITE8_MEMBER( crtc_controlreg_w );
DECLARE_DRIVER_INIT(ts803);
- TIMER_DEVICE_CALLBACK_MEMBER(dart_tick);
-
uint32_t screen_update_ts803(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
private:
-
std::unique_ptr<uint8_t[]> m_videoram;
std::unique_ptr<uint8_t[]> m_56kram;
- uint8_t m_sioidxr=0;
- uint8_t m_sioarr[256];
bool m_graphics_mode;
- bool m_tick;
-
virtual void machine_reset() override;
virtual void machine_start() override;
-
required_device<palette_device> m_palette;
required_device<cpu_device> m_maincpu;
required_device<fd1793_device> m_fdc;
required_device<floppy_connector> m_floppy0;
required_device<floppy_connector> m_floppy1;
- //required_device<z80sti_device> m_sti;
- required_device<z80dart_device> m_dart;
- required_device<sy6545_1_device> m_crtc;
required_region_ptr<u8> m_p_chargen;
+ required_ioport m_io_dsw;
};
static ADDRESS_MAP_START(ts803_mem, AS_PROGRAM, 8, ts803_state)
@@ -127,37 +109,35 @@ ADDRESS_MAP_END
I/0 Port Addresses
-System Status Switch 1 00
-Diagnostic Indicators 1 and 2 10
+System Status Switch 1 00 (SW CE)
+Diagnostic Indicators 1 and 2 10 (10-1F = CTRL PORT CE)
Diagnostic Indicators 3 and 4 11
RS-422 Control and Auto Wait 12
Memory Bank Select 13
-STI Device (modem) 20-2F
+STI Device (modem) 20-2F (STI CE)
DART Dual Asynchronous Receiver Transmitter
-Device (keyboard, printer, mouse) 30-33
-RS-422 SIO Device 40-43
-Floppy Disk Controller 80-83
-Floppy Disk Drive Decoder 90
-Winchester Disk Controller Reset A0
-Winchester Disk Controller B0-BF
-Graphics Controller C0-CF
+Device (keyboard, printer, mouse) 30-33 (DART CE)
+RS-422 SIO Device 40-43 (I/O CE1)
+ 5x (I/O CE2)
+ 6x (PAR C/S CE)
+ 7x (PAR DATA CE)
+Floppy Disk Controller 80-83 (FDC CE)
+Floppy Disk Drive Decoder 90 (FDD CE)
+Winchester Disk Controller Reset A0 (WDC RST CE)
+Winchester Disk Controller B0-BF (WDC CE)
+Graphics Controller C0-CF (GIO SEL)
*/
static ADDRESS_MAP_START(ts803_io, AS_IO, 8, ts803_state)
ADDRESS_MAP_GLOBAL_MASK(0xff)
ADDRESS_MAP_UNMAP_HIGH
- AM_RANGE(0x00, 0x2f) AM_READWRITE(ts803_port_r, ts803_port_w)
-
- //AM_RANGE(0x00, 0x1f) AM_READWRITE(ts803_port_r, ts803_port_w)
- //AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("sti", z80sti_device, read, write)
+ AM_RANGE(0x00, 0x0f) AM_READ_PORT("DSW")
+ AM_RANGE(0x10, 0x1f) AM_READWRITE(port10_r, port10_w)
+ AM_RANGE(0x20, 0x2f) AM_DEVREADWRITE("sti", z80sti_device, read, write)
AM_RANGE(0x30, 0x33) AM_DEVREADWRITE("dart", z80dart_device, cd_ba_r, cd_ba_w)
-
AM_RANGE(0x80, 0x83) AM_DEVREADWRITE("fdc", fd1793_device, read, write)
- AM_RANGE(0x90, 0x90) AM_READWRITE(disk_0_control_r,disk_0_control_w)
-
- //AM_RANGE(0x91, 0xff) AM_READWRITE(ts803_porthi_r, ts803_porthi_w)
- AM_RANGE(0x91, 0xbf) AM_READWRITE(ts803_porthi_r, ts803_porthi_w)
-
+ AM_RANGE(0x90, 0x9f) AM_READWRITE(disk_0_control_r,disk_0_control_w)
+ AM_RANGE(0xa0, 0xbf) AM_READWRITE(porta0_r, porta0_w)
AM_RANGE(0xc0, 0xc0) AM_DEVREADWRITE("crtc", sy6545_1_device, status_r, address_w)
AM_RANGE(0xc2, 0xc2) AM_DEVREADWRITE("crtc", sy6545_1_device, register_r, register_w)
AM_RANGE(0xc4, 0xc4) AM_WRITE(crtc_controlreg_w)
@@ -165,28 +145,37 @@ ADDRESS_MAP_END
/* Input ports */
static INPUT_PORTS_START( ts803 )
+ PORT_START("DSW")
+ PORT_DIPNAME( 0x07, 0x00, "Printer Baud" ) PORT_DIPLOCATION("SW:1,2,3")
+ PORT_DIPSETTING( 0x00, "9600" )
+ PORT_DIPSETTING( 0x01, "4800" )
+ PORT_DIPSETTING( 0x02, "2400" )
+ PORT_DIPSETTING( 0x03, "1200" )
+ PORT_DIPSETTING( 0x04, "600" )
+ PORT_DIPSETTING( 0x05, "300" )
+ PORT_DIPSETTING( 0x06, "150" )
+ PORT_DIPSETTING( 0x07, "75" )
+ PORT_DIPNAME( 0x08, 0x00, "Model" ) PORT_DIPLOCATION("SW:4")
+ PORT_DIPSETTING( 0x00, "TS803" )
+ PORT_DIPSETTING( 0x08, "TS803H" )
+ PORT_DIPNAME( 0x10, 0x00, "Model specific #1" ) PORT_DIPLOCATION("SW:5")
+ PORT_DIPSETTING( 0x00, "On - TS803 leave here, TS803H Local" )
+ PORT_DIPSETTING( 0x10, "Off - TS803H remote" )
+ PORT_DIPNAME( 0x20, 0x00, "Model specific #2" ) PORT_DIPLOCATION("SW:6")
+ PORT_DIPSETTING( 0x00, "On - TS803 leave here, TS803H 2-head" )
+ PORT_DIPSETTING( 0x20, "Off - TS803H 4-head" )
+ PORT_DIPNAME( 0x40, 0x00, "Mains frequency" ) PORT_DIPLOCATION("SW:7")
+ PORT_DIPSETTING( 0x00, "60 Hz" )
+ PORT_DIPSETTING( 0x40, "50 Hz" )
+ PORT_DIPNAME( 0x80, 0x80, "Model specific #3" ) PORT_DIPLOCATION("SW:8")
+ PORT_DIPSETTING( 0x00, "On" )
+ PORT_DIPSETTING( 0x80, "Off - TS803H leave here" )
+ PORT_DIPNAME( 0x100,0x100, "Reverse Video" ) PORT_DIPLOCATION("SW:9")
+ PORT_DIPSETTING( 0x000, "Reverse" )
+ PORT_DIPSETTING( 0x100, "Normal" )
+ PORT_BIT( 0x200, IP_ACTIVE_LOW, IPT_UNUSED ) // SW10 is not connected to anything
INPUT_PORTS_END
-/* keyboard */
-
-WRITE8_MEMBER( ts803_state::keyboard_put )
-{
- if (data)
- {
- //printf("Keyboard stroke [%2x]\n",data);
-
- //m_maincpu->set_input_line_vector(INPUT_LINE_IRQ0, 0x3f);
- //m_maincpu->set_input_line(INPUT_LINE_IRQ0, ASSERT_LINE);
-
- if (data==0x0d) m_maincpu->space(AS_PROGRAM).write_byte(0xf83f,0xC1);
- else
- {
- m_maincpu->space(AS_PROGRAM).write_byte(0xf83f,0x4f);
- m_maincpu->space(AS_PROGRAM).write_byte(0xf890,data);
- }
- }
-}
-
/* disk drive */
static SLOT_INTERFACE_START( ts803_floppies )
@@ -229,11 +218,10 @@ READ8_MEMBER( ts803_state::disk_0_control_r )
return 0xff;
}
-READ8_MEMBER( ts803_state::ts803_porthi_r )
+READ8_MEMBER( ts803_state::porta0_r)
{
- //printf("PortHI read [%x]\n",offset+0x91);
-
- switch(offset+0x91)
+ offset += 0xa0;
+ switch(offset)
{
case 0xb2:
printf("B2 WDC read\n");
@@ -260,11 +248,10 @@ READ8_MEMBER( ts803_state::ts803_porthi_r )
return 0x00;
}
-WRITE8_MEMBER( ts803_state::ts803_porthi_w )
+WRITE8_MEMBER( ts803_state::porta0_w )
{
- //printf("PortHI write [%2x] [%2x]\n",offset+0x91,data);
-
- switch (offset+0x91)
+ offset += 0xa0;
+ switch (offset)
{
case 0xc4:
//printf("Control Register for Alpha or Graphics Mode Selection\n");
@@ -275,68 +262,19 @@ WRITE8_MEMBER( ts803_state::ts803_porthi_w )
}
}
-READ8_MEMBER( ts803_state::ts803_port_r )
+READ8_MEMBER( ts803_state::port10_r )
{
+ offset += 0x10;
printf("Port read [%x]\n",offset);
- switch (offset)
- {
- case 0x00:
- // system status switch 1 (dip switches)
- // 0,1,2: baud rate
- // 3: ts803-ts803h
- // 4: local-remote
- // 5: required (?)
- // 6: 60hz-50hz
- // 7: required
- return 0x80;
-
- case 0x20:
- // STI read (at boot time)
- return 0x55;
-
- case 0x26:
- // STI read (at boot time)
- return 0x55;
-
- case 0x27:
- // STI read (at boot time)
- return 0x55;
-
- case 0x2a:
- // STI read (at boot time)
- return 0x55;
-
- case 0x2d:
- // STI
- return 0x00;
-
- case 0x2b:
- // STI read (at boot time)
- return 0x55;
-
- case 0x42:
- // SIO
- m_sioidxr++;
- return m_sioarr[m_sioidxr-1];
-
- default:
- return 0xff;
- }
-
return 0xff;
}
-WRITE8_MEMBER( ts803_state::ts803_port_w )
+WRITE8_MEMBER( ts803_state::port10_w )
{
- //printf("Port write [%2x] [%2x]\n",offset,data);
-
+ offset += 0x10;
switch (offset)
{
- case 0x00:
- printf("Writing on system status switch\n");
- break;
-
case 0x10:
data &= 3;
printf("Writing to diagnostic indicators 1 & 2: %X\n", data);
@@ -364,11 +302,6 @@ WRITE8_MEMBER( ts803_state::ts803_port_w )
break;
- case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: case 0x28: case 0x29:
- case 0x2A: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
- //printf("STI device write [%2x]\n",data);
- break;
-
default:
printf("unknown port [%2.2x] write of [%2.2x]\n",offset,data);
break;
@@ -382,6 +315,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED( ts803_state::crtc_update_addr )
MC6845_UPDATE_ROW( ts803_state::crtc_update_row )
{
+ bool rv = BIT(m_io_dsw->read(), 8) ? 0 : 1;
const rgb_t *pens = m_palette->palette()->entry_list_raw();
uint8_t chr,gfx,inv;
uint16_t mem,x;
@@ -389,7 +323,7 @@ MC6845_UPDATE_ROW( ts803_state::crtc_update_row )
for (x = 0; x < x_count; x++)
{
- inv = (x == cursor_x) ? 0xff : 0;
+ inv = (rv ^ (x == cursor_x)) ? 0xff : 0;
if (m_graphics_mode)
{
@@ -400,7 +334,7 @@ MC6845_UPDATE_ROW( ts803_state::crtc_update_row )
{
mem = 0x1800 + ((ma + x) & 0x7ff);
chr = m_videoram[mem];
- gfx = (ra > 7) ? 0 : m_p_chargen[(chr<<3) | ((ra+1)&7)] ^ inv;
+ gfx = (ra > 7) ? inv : m_p_chargen[(chr<<3) | ((ra+1)&7)] ^ inv;
}
/* Display a scanline of a character (8 pixels) */
@@ -430,15 +364,6 @@ Bit 2 = 0 alpha memory access (round off)
m_graphics_mode = BIT(data, 0);
}
-// baud rate generator for keyboard, 9600 baud.
-TIMER_DEVICE_CALLBACK_MEMBER( ts803_state::dart_tick )
-{
- m_tick ^= 1;
- m_dart->rxca_w(m_tick);
- m_dart->txca_w(m_tick);
- m_dart->txcb_w(m_tick); // needed to pass the test
-}
-
void ts803_state::machine_start()
{
//save these 2 so we can examine them in the debugger
@@ -449,12 +374,7 @@ void ts803_state::machine_start()
void ts803_state::machine_reset()
{
m_graphics_mode = false;
- m_tick = 0;
-
- m_sioarr[0]=0x00;
- m_sioarr[1]=0xff;
- //m_sti->reset();
membank("bankr0")->set_entry(0);
membank("bankw0")->set_entry(0);
membank("bank4")->set_entry(0);
@@ -479,7 +399,7 @@ DRIVER_INIT_MEMBER( ts803_state, ts803 )
2: Z80 STI (RS 232C modem port)
3: FD 1793 floppy disk controller
4: Winchester disk controller board
-5: Time-of-day clock
+5: Time-of-day clock (no info in the manual about this)
Interrupts 0 through 2 are prioritized in a daisy-chain
arrangement. Interrupts 3 through 5 are wired to the Z80 STI
interrupt input pins. */
@@ -487,7 +407,7 @@ static const z80_daisy_config daisy_chain[] =
{
//{ "rs422" }, // not emulated
{ "dart" },
- //{ "sti" },
+ { "sti" },
{ nullptr }
};
@@ -512,31 +432,32 @@ static MACHINE_CONFIG_START( ts803 )
MCFG_MC6845_UPDATE_ROW_CB(ts803_state, crtc_update_row)
MCFG_MC6845_ADDR_CHANGED_CB(ts803_state, crtc_update_addr)
- //MCFG_DEVICE_ADD("sti", Z80STI, XTAL_16MHz/4) // STI baud rates are derived from XTAL_16MHz / 13
- //MCFG_Z80STI_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
+ MCFG_DEVICE_ADD("sti_clock", CLOCK, XTAL_16MHz / 13)
+ MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("sti", z80sti_device, tc_w))
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("sti", z80sti_device, rc_w))
+
+ MCFG_DEVICE_ADD("dart_clock", CLOCK, (XTAL_16MHz / 13) / 8)
+ MCFG_CLOCK_SIGNAL_HANDLER(DEVWRITELINE("dart", z80dart_device, txca_w))
+ MCFG_DEVCB_CHAIN_OUTPUT(DEVWRITELINE("dart", z80dart_device, rxca_w))
+
+ MCFG_DEVICE_ADD("sti", Z80STI, XTAL_16MHz/4)
+ MCFG_Z80STI_OUT_TBO_CB(DEVWRITELINE("dart", z80dart_device, rxtxcb_w))
+ MCFG_Z80STI_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
MCFG_DEVICE_ADD("dart", Z80DART, XTAL_16MHz / 4)
MCFG_Z80DART_OUT_INT_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0))
- //MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd))
- //MCFG_Z80DART_OUT_DTRA_CB(DEVWRITELINE("rs232", rs232_port_device, write_dtr))
- //MCFG_Z80DART_OUT_RTSA_CB(DEVWRITELINE("rs232", rs232_port_device, write_rts))
+ MCFG_Z80DART_OUT_TXDA_CB(DEVWRITELINE("rs232", rs232_port_device, write_txd))
MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "keyboard")
MCFG_RS232_RXD_HANDLER(DEVWRITELINE("dart", z80dart_device, rxa_w))
- //MCFG_RS232_CTS_HANDLER(DEVWRITELINE("dart", z80dart_device, ctsa_w))
/* floppy disk */
MCFG_FD1793_ADD("fdc", XTAL_1MHz)
- //MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("sti", z80sti_device, i7_w)) // add when sti is in
+ MCFG_WD_FDC_INTRQ_CALLBACK(DEVWRITELINE("sti", z80sti_device, i7_w))
MCFG_FLOPPY_DRIVE_ADD("fdc:0", ts803_floppies, "525dd", floppy_image_device::default_floppy_formats)
+ MCFG_FLOPPY_DRIVE_SOUND(true)
MCFG_FLOPPY_DRIVE_ADD("fdc:1", ts803_floppies, "525dd", floppy_image_device::default_floppy_formats)
MCFG_FLOPPY_DRIVE_SOUND(true)
-
- /* keyboard */
- //MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0)
- //MCFG_GENERIC_KEYBOARD_CB(WRITE8(ts803_state, keyboard_put))
- MCFG_TIMER_DRIVER_ADD_PERIODIC("dart_tick", ts803_state, dart_tick, attotime::from_hz(153600*2))
-
MACHINE_CONFIG_END
/* ROM definition */