mirror of
https://github.com/holub/mame
synced 2025-07-05 09:57:47 +03:00
(MESS) cat.c: switched driver to use the new DUART n68681 core [Lord Nightmare]
This commit is contained in:
parent
930e5b8cd0
commit
5253dbac24
@ -255,7 +255,7 @@ ToDo:
|
||||
// Includes
|
||||
#include "emu.h"
|
||||
#include "cpu/m68000/m68000.h"
|
||||
#include "machine/68681.h"
|
||||
#include "machine/n68681.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
class cat_state : public driver_device
|
||||
@ -272,7 +272,7 @@ public:
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
//m_nvram(*this, "nvram"), // merge with svram?
|
||||
//m_duart(*this, "duart68681"),
|
||||
m_duart(*this, "duartn68681"),
|
||||
//m_speaker(*this, "speaker"),
|
||||
m_svram(*this, "svram"), // nvram
|
||||
m_p_videoram(*this, "p_videoram"),
|
||||
@ -289,7 +289,11 @@ public:
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
//optional_device<nvram_device> m_nvram;
|
||||
//required_device<68681_device> m_duart;
|
||||
optional_device<duartn68681_device> m_duart; // should be required once plumbed to the swyft
|
||||
DECLARE_WRITE_LINE_MEMBER(cat_duart_irq_handler);
|
||||
DECLARE_WRITE_LINE_MEMBER(cat_duart_txa);
|
||||
DECLARE_READ8_MEMBER(cat_duart_input);
|
||||
DECLARE_WRITE8_MEMBER(cat_duart_output);
|
||||
//required_device<speaker_sound_device> m_speaker;
|
||||
optional_shared_ptr<UINT16> m_svram;
|
||||
required_shared_ptr<UINT16> m_p_videoram;
|
||||
@ -344,6 +348,7 @@ public:
|
||||
this causes the DUART to fire an interrupt, which makes the 68000 read
|
||||
the keyboard.
|
||||
*/
|
||||
UINT8 m_duart_irq_state;
|
||||
UINT16 m_6ms_counter;
|
||||
UINT8 m_video_enable;
|
||||
UINT8 m_video_invert;
|
||||
@ -697,7 +702,7 @@ static ADDRESS_MAP_START(cat_mem, AS_PROGRAM, 16, cat_state)
|
||||
AM_RANGE(0x80000c, 0x80000d) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus?
|
||||
AM_RANGE(0x80000e, 0x80000f) AM_READWRITE(cat_battery_r,cat_printer_control_w) AM_MIRROR(0x18FFE0) // Centronics Printer Control, keyboard led and country code enable
|
||||
AM_RANGE(0x800010, 0x80001f) AM_READ(cat_0080_r) AM_MIRROR(0x18FFE0) // Open bus?
|
||||
AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8_LEGACY("duart68681", duart68681_r, duart68681_w, 0xff ) AM_MIRROR(0x18FFE0)
|
||||
AM_RANGE(0x810000, 0x81001f) AM_DEVREADWRITE8("duartn68681", duartn68681_device, read, write, 0xff ) AM_MIRROR(0x18FFE0)
|
||||
AM_RANGE(0x820000, 0x82003f) AM_READWRITE(cat_modem_r,cat_modem_w) AM_MIRROR(0x18FFC0) // AMI S35213 Modem Chip, all access is on bit 7
|
||||
AM_RANGE(0x830000, 0x830001) AM_READ(cat_6ms_counter_r) AM_MIRROR(0x18FFFE) // 16bit 6ms counter clocked by output of another 16bit counter clocked at 10mhz
|
||||
AM_RANGE(0x840000, 0x840001) AM_READWRITE(cat_2e80_r,cat_opr_w) AM_MIRROR(0x18FFFE) // Output port register (video enable, invert, watchdog reset)
|
||||
@ -860,6 +865,7 @@ IRQ_CALLBACK_MEMBER(cat_state::cat_int_ack)
|
||||
MACHINE_START_MEMBER(cat_state,cat)
|
||||
{
|
||||
m_duart_inp = 0;
|
||||
m_duart_irq_state = 0;
|
||||
m_6ms_counter = 0;
|
||||
m_video_enable = 1;
|
||||
m_video_invert = 0;
|
||||
@ -871,6 +877,7 @@ MACHINE_RESET_MEMBER(cat_state,cat)
|
||||
{
|
||||
m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(cat_state::cat_int_ack),this));
|
||||
m_duart_inp = 0;
|
||||
m_duart_irq_state = 0;
|
||||
m_6ms_counter = 0;
|
||||
m_floppy_control = 0;
|
||||
m_6ms_timer->adjust(attotime::zero, 0, attotime::from_hz((XTAL_19_968MHz/2)/65536));
|
||||
@ -952,15 +959,16 @@ UINT32 cat_state::screen_update_swyft(screen_device &screen, bitmap_ind16 &bitma
|
||||
* d-latch and inputs on ip2 of the duart, causing the duart to fire an irq;
|
||||
* this is used by the cat to read the keyboard.
|
||||
*/
|
||||
static void duart_irq_handler(device_t *device, int state, UINT8 vector)
|
||||
WRITE_LINE_MEMBER(cat_state::cat_duart_irq_handler)
|
||||
{
|
||||
#ifdef DEBUG_DUART_IRQ_HANDLER
|
||||
fprintf(stderr, "Duart IRQ handler called: state: %02X, vector: %06X\n", state, vector);
|
||||
#endif
|
||||
m_duart_irq_state = state;
|
||||
//device->m_maincpu->set_input_line_and_vector(M68K_IRQ_1, state, vector);
|
||||
}
|
||||
|
||||
static void duart_tx(device_t *device, int channel, UINT8 data)
|
||||
WRITE_LINE_MEMBER(cat_state::cat_duart_txa)
|
||||
{
|
||||
#ifdef DEBUG_DUART_TXD
|
||||
fprintf(stderr, "Duart TXD: data %02X\n", data);
|
||||
@ -968,24 +976,23 @@ static void duart_tx(device_t *device, int channel, UINT8 data)
|
||||
}
|
||||
|
||||
/* mc68681 DUART Input pins:
|
||||
* IP0: CTS [using the hardware-CTS feature?]
|
||||
* IP0: CTS [using the duart builtin hardware-CTS feature?]
|
||||
* IP1: Centronics ACK (IP1 changes state 0->1 or 1->0 on the falling edge of /ACK using a d-latch)
|
||||
* IP2: KTOBF (IP2 changes state 0->1 or 1->0 on the rising edge of KTOBF using a d-latch; KTOBF is a 6.5536ms-period squarewave generated by one of the gate arrays, i need to check with a scope to see whether it is a single spike/pulse every 6.5536ms or if from the gate array it inverts every 6.5536ms, documentation isn't 100% clear but I suspect the former) [uses the Delta IP2 state change detection feature to generate an interrupt; I'm not sure if IP2 is used as a counter clock source but given the beep frequency of the real unit i very much doubt it, 6.5536ms is too slow]
|
||||
* IP3: RG ("ring" input)
|
||||
* IP4: Centronics BUSY
|
||||
* IP5: DSR
|
||||
*/
|
||||
static UINT8 duart_input(device_t *device)
|
||||
READ8_MEMBER(cat_state::cat_duart_input)
|
||||
{
|
||||
cat_state *state = device->machine().driver_data<cat_state>();
|
||||
#ifdef DEBUG_DUART_INPUT_LINES
|
||||
fprintf(stderr, "Duart input lines read!\n");
|
||||
#endif
|
||||
return state->m_duart_inp;
|
||||
return m_duart_inp;
|
||||
}
|
||||
|
||||
/* mc68681 DUART Output pins:
|
||||
* OP0: RTS [using the hardware-RTS feature?]
|
||||
* OP0: RTS [using the duart builtin hardware-RTS feature?]
|
||||
* OP1: DTR
|
||||
* OP2: /TDCS (select/enable the S2579 DTMF tone generator chip)
|
||||
* OP3: speaker out [using the 'channel b 1X tx or rx clock output' or more likely the 'timer output' feature to generate a squarewave]
|
||||
@ -994,19 +1001,20 @@ static UINT8 duart_input(device_t *device)
|
||||
* OP6: TD01 "
|
||||
* OP7: TD00 "
|
||||
*/
|
||||
static void duart_output(device_t *device, UINT8 data)
|
||||
WRITE8_MEMBER(cat_state::cat_duart_output)
|
||||
{
|
||||
#ifdef DEBUG_DUART_OUTPUT_LINES
|
||||
fprintf(stderr,"Duart output io lines changed to: %02X\n", data);
|
||||
#endif
|
||||
}
|
||||
|
||||
static const duart68681_config cat_duart68681_config =
|
||||
static const duartn68681_config cat_duart_config =
|
||||
{
|
||||
duart_irq_handler,
|
||||
duart_tx,
|
||||
duart_input,
|
||||
duart_output
|
||||
DEVCB_DRIVER_LINE_MEMBER(cat_state, cat_duart_irq_handler), /* irq callback */
|
||||
DEVCB_DRIVER_LINE_MEMBER(cat_state, cat_duart_txa), /* serial transmit A */
|
||||
DEVCB_NULL, /* serial transmit B */
|
||||
DEVCB_DRIVER_MEMBER(cat_state, cat_duart_input), /* input port */
|
||||
DEVCB_DRIVER_MEMBER(cat_state, cat_duart_output), /* output port */
|
||||
};
|
||||
|
||||
static MACHINE_CONFIG_START( cat, cat_state )
|
||||
@ -1031,7 +1039,7 @@ static MACHINE_CONFIG_START( cat, cat_state )
|
||||
|
||||
MCFG_VIDEO_START_OVERRIDE(cat_state,cat)
|
||||
|
||||
MCFG_DUART68681_ADD( "duart68681", XTAL_19_968MHz*2/11, cat_duart68681_config ) // duart is normally clocked by 3.6864mhz xtal, but cat uses a divider from the main xtal instead which yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire
|
||||
MCFG_DUARTN68681_ADD( "duartn68681", XTAL_19_968MHz*2/11, cat_duart_config ) // duart is normally clocked by 3.6864mhz xtal, but cat seemingly uses a divider from the main xtal instead which probably yields 3.63054545Mhz. There is a trace to cut and a mounting area to allow using an actual 3.6864mhz xtal if you so desire
|
||||
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
MACHINE_CONFIG_END
|
||||
|
Loading…
Reference in New Issue
Block a user