mirror of
https://github.com/holub/mame
synced 2025-06-05 12:26:35 +03:00
From: Wilbert Pol [mailto:wilbert@jdg.info]
Subject: pcshare patch for mess Another patch to machine/pcshare; this patch allows the MESS machines to choose whether the RDY pin of the nec765 floppy controller is connected or not. Last weekend's pcshare keyboard was almost correct, it caused some stuck shift key situations in MESS. This patch fixes that. Removed a lot of MESS specific code from the machine/pcshare code.
This commit is contained in:
parent
fa67773ba7
commit
cce0f9f8e7
@ -34,23 +34,9 @@
|
||||
#include "machine/pckeybrd.h"
|
||||
|
||||
#ifdef MESS
|
||||
#include "machine/uart8250.h"
|
||||
#include "video/pc_vga.h"
|
||||
#include "video/pc_cga.h"
|
||||
#include "video/pc_mda.h"
|
||||
#include "video/pc_aga.h"
|
||||
|
||||
#include "includes/pc_mouse.h"
|
||||
#include "machine/pc_fdc.h"
|
||||
|
||||
#include "includes/pclpt.h"
|
||||
#include "machine/centroni.h"
|
||||
|
||||
#include "machine/pc_hdc.h"
|
||||
#include "machine/nec765.h"
|
||||
#include "audio/pc.h"
|
||||
|
||||
#include "mscommon.h"
|
||||
#endif /* MESS */
|
||||
|
||||
#define VERBOSE_DBG 0 /* general debug messages */
|
||||
@ -61,8 +47,6 @@
|
||||
#define JOY_LOG(N,M,A) \
|
||||
if(VERBOSE_JOY>=N){ if( M )logerror("%11.6f: %-24s",attotime_to_double(timer_get_time()),(char*)M ); logerror A; }
|
||||
|
||||
#define FDC_DMA 2
|
||||
|
||||
|
||||
static emu_timer *pc_keyboard_timer;
|
||||
|
||||
@ -71,72 +55,12 @@ static TIMER_CALLBACK( pc_keyb_timer );
|
||||
#define LOG_PORT80 0
|
||||
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
#ifdef MESS
|
||||
/* called when a interrupt is set/cleared from com hardware */
|
||||
static void pc_com_interrupt(int nr, int state)
|
||||
{
|
||||
static const int irq[4] = {4, 3, 4, 3};
|
||||
|
||||
/* issue COM1/3 IRQ4, COM2/4 IRQ3 */
|
||||
pic8259_set_irq_line(0, irq[nr], state);
|
||||
}
|
||||
|
||||
/* called when com registers read/written - used to update peripherals that
|
||||
are connected */
|
||||
static void pc_com_refresh_connected(int n, int data)
|
||||
{
|
||||
/* mouse connected to this port? */
|
||||
if (readinputport(3) & (0x80>>n))
|
||||
pc_mouse_handshake_in(n,data);
|
||||
}
|
||||
|
||||
/* PC interface to PC-com hardware. Done this way because PCW16 also
|
||||
uses PC-com hardware and doesn't have the same setup! */
|
||||
static const uart8250_interface com_interface[4]=
|
||||
{
|
||||
{
|
||||
TYPE8250,
|
||||
1843200,
|
||||
pc_com_interrupt,
|
||||
NULL,
|
||||
pc_com_refresh_connected
|
||||
},
|
||||
{
|
||||
TYPE8250,
|
||||
1843200,
|
||||
pc_com_interrupt,
|
||||
NULL,
|
||||
pc_com_refresh_connected
|
||||
},
|
||||
{
|
||||
TYPE8250,
|
||||
1843200,
|
||||
pc_com_interrupt,
|
||||
NULL,
|
||||
pc_com_refresh_connected
|
||||
},
|
||||
{
|
||||
TYPE8250,
|
||||
1843200,
|
||||
pc_com_interrupt,
|
||||
NULL,
|
||||
pc_com_refresh_connected
|
||||
}
|
||||
};
|
||||
#endif /* MESS */
|
||||
|
||||
|
||||
|
||||
static void pc_timer0_w(int state)
|
||||
{
|
||||
pic8259_set_irq_line(0, 0, state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* timer0 heartbeat IRQ
|
||||
* timer1 DRAM refresh (ignored)
|
||||
@ -191,42 +115,6 @@ static const struct pit8253_config pc_pit8254_config =
|
||||
};
|
||||
|
||||
|
||||
#ifdef MESS
|
||||
static const PC_LPT_CONFIG lpt_config[3]={
|
||||
{
|
||||
1,
|
||||
LPT_UNIDIRECTIONAL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
1,
|
||||
LPT_UNIDIRECTIONAL,
|
||||
NULL
|
||||
},
|
||||
{
|
||||
1,
|
||||
LPT_UNIDIRECTIONAL,
|
||||
NULL
|
||||
}
|
||||
};
|
||||
|
||||
static const CENTRONICS_CONFIG cent_config[3]={
|
||||
{
|
||||
PRINTER_IBM,
|
||||
pc_lpt_handshake_in
|
||||
},
|
||||
{
|
||||
PRINTER_IBM,
|
||||
pc_lpt_handshake_in
|
||||
},
|
||||
{
|
||||
PRINTER_IBM,
|
||||
pc_lpt_handshake_in
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
@ -379,33 +267,6 @@ static const struct dma8237_interface pc_dma =
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
#ifdef MESS
|
||||
static void pc_fdc_interrupt(int state)
|
||||
{
|
||||
pic8259_set_irq_line(0, 6, state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void pc_fdc_dma_drq(int state, int read_)
|
||||
{
|
||||
dma8237_drq_write(0, FDC_DMA, state);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static const struct pc_fdc_interface fdc_interface =
|
||||
{
|
||||
NEC765A,
|
||||
pc_fdc_interrupt,
|
||||
pc_fdc_dma_drq,
|
||||
};
|
||||
#endif /* MESS */
|
||||
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
static void pc_pic_set_int_line(int which, int interrupt)
|
||||
@ -428,48 +289,12 @@ static void pc_pic_set_int_line(int which, int interrupt)
|
||||
|
||||
void init_pc_common(UINT32 flags)
|
||||
{
|
||||
#ifdef MESS
|
||||
/* MESS managed RAM */
|
||||
if (mess_ram)
|
||||
memory_set_bankptr(10, mess_ram);
|
||||
#endif /* MESS */
|
||||
|
||||
/* PIT */
|
||||
if (flags & PCCOMMON_TIMER_8254)
|
||||
pit8253_init(1, &pc_pit8254_config);
|
||||
else if (flags & PCCOMMON_TIMER_8253)
|
||||
pit8253_init(1, &pc_pit8253_config);
|
||||
|
||||
#ifdef MESS
|
||||
/* FDC/HDC hardware */
|
||||
pc_fdc_init(&fdc_interface);
|
||||
pc_hdc_setup();
|
||||
|
||||
/* com hardware */
|
||||
uart8250_init(0, com_interface);
|
||||
uart8250_reset(0);
|
||||
uart8250_init(1, com_interface+1);
|
||||
uart8250_reset(1);
|
||||
uart8250_init(2, com_interface+2);
|
||||
uart8250_reset(2);
|
||||
uart8250_init(3, com_interface+3);
|
||||
uart8250_reset(3);
|
||||
|
||||
pc_lpt_config(0, lpt_config);
|
||||
centronics_config(0, cent_config);
|
||||
pc_lpt_set_device(0, &CENTRONICS_PRINTER_DEVICE);
|
||||
pc_lpt_config(1, lpt_config+1);
|
||||
centronics_config(1, cent_config+1);
|
||||
pc_lpt_set_device(1, &CENTRONICS_PRINTER_DEVICE);
|
||||
pc_lpt_config(2, lpt_config+2);
|
||||
centronics_config(2, cent_config+2);
|
||||
pc_lpt_set_device(2, &CENTRONICS_PRINTER_DEVICE);
|
||||
|
||||
/* serial mouse */
|
||||
pc_mouse_set_serial_port(0);
|
||||
pc_mouse_initialise();
|
||||
#endif /* MESS */
|
||||
|
||||
/* PC-XT keyboard */
|
||||
if (flags & PCCOMMON_KEYBOARD_AT)
|
||||
at_keyboard_init(AT_KEYBOARD_TYPE_AT);
|
||||
@ -519,7 +344,6 @@ UINT8 pc_keyb_read(void)
|
||||
static TIMER_CALLBACK( pc_keyb_timer )
|
||||
{
|
||||
if ( pc_keyb.on ) {
|
||||
pc_keyb.self_test = ( pc_keyb.self_test == 1 ) ? 2 : 0;
|
||||
pc_keyboard();
|
||||
} else {
|
||||
/* Clock has been low for more than 5 msec, start diagnostic test */
|
||||
@ -539,7 +363,7 @@ void pc_keyb_set_clock(int on)
|
||||
if (!on)
|
||||
timer_adjust_oneshot(pc_keyboard_timer, ATTOTIME_IN_MSEC(5), 0);
|
||||
else {
|
||||
if ( pc_keyb.self_test == 1 ) {
|
||||
if ( pc_keyb.self_test ) {
|
||||
/* The self test of the keyboard takes some time. 2 msec seems to work. */
|
||||
/* This still needs to verified against a real keyboard. */
|
||||
timer_adjust_oneshot(pc_keyboard_timer, ATTOTIME_IN_MSEC( 2 ), 0);
|
||||
@ -570,12 +394,8 @@ void pc_keyboard(void)
|
||||
if ( (data=at_keyboard_read())!=-1) {
|
||||
pc_keyb.data = data;
|
||||
DBG_LOG(1,"KB_scancode",("$%02x\n", pc_keyb.data));
|
||||
if ( ! ( data & 0x80 ) || pc_keyb.self_test == 2 ) {
|
||||
pic8259_set_irq_line(0, 1, 1);
|
||||
if ( pc_keyb.self_test == 2 ) {
|
||||
pc_keyb.self_test = 0;
|
||||
}
|
||||
}
|
||||
pic8259_set_irq_line(0, 1, 1);
|
||||
pc_keyb.self_test = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
#define PCCOMMON_TIMER_NONE 0
|
||||
#define PCCOMMON_TIMER_8253 4
|
||||
#define PCCOMMON_TIMER_8254 8
|
||||
#define PCCOMMON_NEC765_RDY_NC 16
|
||||
|
||||
void init_pc_common(UINT32 flags);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user