summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2012-10-17 10:43:30 +0000
committer Miodrag Milanovic <mmicko@gmail.com>2012-10-17 10:43:30 +0000
commit94bc36dc017c37b93e2f88ffd003ca9ef6fdcac0 (patch)
tree77cc597da5c89c7683b5579b19413b341040178e
parent43f00aa98f6624bc14686195a066542dfb5fe1e6 (diff)
clean up some chess machines (no whatsnew)
-rw-r--r--.gitattributes2
-rw-r--r--src/mess/drivers/glasgow.c28
-rw-r--r--src/mess/drivers/mephisto.c30
-rw-r--r--src/mess/drivers/mmodular.c100
-rw-r--r--src/mess/includes/mboard.h99
-rw-r--r--src/mess/machine/mboard.c176
-rw-r--r--src/mess/machine/mboard.h98
7 files changed, 262 insertions, 271 deletions
diff --git a/.gitattributes b/.gitattributes
index f5696aa1e9d..fa42daf22aa 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -6204,6 +6204,7 @@ src/mess/includes/mac.h svneol=native#text/plain
src/mess/includes/macpci.h svneol=native#text/plain
src/mess/includes/mbc55x.h svneol=native#text/plain
src/mess/includes/mbee.h svneol=native#text/plain
+src/mess/includes/mboard.h svneol=native#text/plain
src/mess/includes/mc1000.h svneol=native#text/plain
src/mess/includes/mc68328.h svneol=native#text/plain
src/mess/includes/mc80.h svneol=native#text/plain
@@ -6941,7 +6942,6 @@ src/mess/machine/mb89352.h svneol=native#text/plain
src/mess/machine/mbc55x.c svneol=native#text/plain
src/mess/machine/mbee.c svneol=native#text/plain
src/mess/machine/mboard.c svneol=native#text/plain
-src/mess/machine/mboard.h svneol=native#text/plain
src/mess/machine/mc68328.c svneol=native#text/plain
src/mess/machine/mc68328.h svneol=native#text/plain
src/mess/machine/mc6843.c svneol=native#text/plain
diff --git a/src/mess/drivers/glasgow.c b/src/mess/drivers/glasgow.c
index efc7a3a20a2..cd50e0f0667 100644
--- a/src/mess/drivers/glasgow.c
+++ b/src/mess/drivers/glasgow.c
@@ -50,14 +50,14 @@ R.Schaefer Oct 2010
#include "cpu/m68000/m68000.h"
#include "glasgow.lh"
#include "sound/beep.h"
-#include "machine/mboard.h"
+#include "includes/mboard.h"
-class glasgow_state : public driver_device
+class glasgow_state : public mboard_state
{
public:
glasgow_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ : mboard_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_beep(*this, BEEPER_TAG)
{ }
@@ -293,7 +293,7 @@ void glasgow_state::machine_start()
m_lcd_shift_counter = 3;
beep_set_frequency(m_beep, 44);
- mboard_savestate_register(machine());
+ mboard_savestate_register();
}
@@ -303,7 +303,7 @@ MACHINE_START_MEMBER(glasgow_state,dallas32)
m_lcd_shift_counter = 3;
beep_set_frequency(m_beep, 44);
- mboard_savestate_register(machine());
+ mboard_savestate_register();
}
@@ -321,8 +321,8 @@ static ADDRESS_MAP_START(glasgow_mem, AS_PROGRAM, 16, glasgow_state)
AM_RANGE(0x00010000, 0x00010001) AM_WRITE(glasgow_lcd_w)
AM_RANGE(0x00010002, 0x00010003) AM_READWRITE(glasgow_keys_r,glasgow_keys_w)
AM_RANGE(0x00010004, 0x00010005) AM_WRITE(glasgow_lcd_flag_w)
- AM_RANGE(0x00010006, 0x00010007) AM_READWRITE_LEGACY(mboard_read_board_16,mboard_write_LED_16)
- AM_RANGE(0x00010008, 0x00010009) AM_WRITE_LEGACY(mboard_write_board_16)
+ AM_RANGE(0x00010006, 0x00010007) AM_READWRITE(mboard_read_board_16,mboard_write_LED_16)
+ AM_RANGE(0x00010008, 0x00010009) AM_WRITE(mboard_write_board_16)
AM_RANGE(0x0001c000, 0x0001ffff) AM_RAM // 16KB
ADDRESS_MAP_END
@@ -333,10 +333,10 @@ static ADDRESS_MAP_START(amsterd_mem, AS_PROGRAM, 16, glasgow_state)
AM_RANGE(0x00800002, 0x00800003) AM_WRITE(write_lcd)
AM_RANGE(0x00800008, 0x00800009) AM_WRITE(write_lcd_flag)
AM_RANGE(0x00800004, 0x00800005) AM_WRITE(write_irq_flag)
- AM_RANGE(0x00800010, 0x00800011) AM_WRITE_LEGACY(mboard_write_board_16)
- AM_RANGE(0x00800020, 0x00800021) AM_READ_LEGACY(mboard_read_board_16)
+ AM_RANGE(0x00800010, 0x00800011) AM_WRITE(mboard_write_board_16)
+ AM_RANGE(0x00800020, 0x00800021) AM_READ(mboard_read_board_16)
AM_RANGE(0x00800040, 0x00800041) AM_READ(read_newkeys16)
- AM_RANGE(0x00800088, 0x00800089) AM_WRITE_LEGACY(mboard_write_LED_16)
+ AM_RANGE(0x00800088, 0x00800089) AM_WRITE(mboard_write_LED_16)
AM_RANGE(0x00ffc000, 0x00ffffff) AM_RAM // 16KB
ADDRESS_MAP_END
@@ -348,10 +348,10 @@ static ADDRESS_MAP_START(dallas32_mem, AS_PROGRAM, 32, glasgow_state)
AM_RANGE(0x00800000, 0x00800003) AM_WRITE(write_lcd32)
AM_RANGE(0x00800004, 0x00800007) AM_WRITE(write_beeper32)
AM_RANGE(0x00800008, 0x0080000B) AM_WRITE(write_lcd_flag32)
- AM_RANGE(0x00800010, 0x00800013) AM_WRITE_LEGACY(mboard_write_board_32)
- AM_RANGE(0x00800020, 0x00800023) AM_READ_LEGACY(mboard_read_board_32)
+ AM_RANGE(0x00800010, 0x00800013) AM_WRITE(mboard_write_board_32)
+ AM_RANGE(0x00800020, 0x00800023) AM_READ(mboard_read_board_32)
AM_RANGE(0x00800040, 0x00800043) AM_READ(read_newkeys32)
- AM_RANGE(0x00800088, 0x0080008b) AM_WRITE_LEGACY(mboard_write_LED_32)
+ AM_RANGE(0x00800088, 0x0080008b) AM_WRITE(mboard_write_LED_32)
ADDRESS_MAP_END
static INPUT_PORTS_START( new_keyboard ) //Amsterdam, Dallas 32, Roma, Roma 32
@@ -517,7 +517,7 @@ static MACHINE_CONFIG_START( glasgow, glasgow_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", glasgow_state, update_nmi, attotime::from_hz(50))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", glasgow_state, mboard_update_artwork, attotime::from_hz(100))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( amsterd, glasgow )
diff --git a/src/mess/drivers/mephisto.c b/src/mess/drivers/mephisto.c
index 615d86eb454..0086de31144 100644
--- a/src/mess/drivers/mephisto.c
+++ b/src/mess/drivers/mephisto.c
@@ -65,14 +65,14 @@ Mephisto 4 Turbo Kit 18mhz - (mm4tk)
#include "sound/beep.h"
//#include "mephisto.lh"
-#include "machine/mboard.h"
+#include "includes/mboard.h"
-class mephisto_state : public driver_device
+class mephisto_state : public mboard_state
{
public:
mephisto_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag),
+ : mboard_state(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_beep(*this, BEEPER_TAG)
{ }
@@ -163,10 +163,10 @@ static ADDRESS_MAP_START( rebel5_mem, AS_PROGRAM, 8, mephisto_state )
AM_RANGE( 0x0000, 0x1fff) AM_RAM // AM_BASE(m_p_ram)
AM_RANGE( 0x2000, 0x2007) AM_WRITE(write_led) // Status LEDs+ buzzer
AM_RANGE( 0x3000, 0x3007) AM_READ(read_keys) // Rebel 5.0
- AM_RANGE( 0x3000, 0x4000) AM_READ_LEGACY(mboard_read_board_8) // Chessboard
+ AM_RANGE( 0x3000, 0x4000) AM_READ(mboard_read_board_8) // Chessboard
AM_RANGE( 0x5000, 0x5000) AM_WRITE(write_lcd)
- AM_RANGE( 0x6000, 0x6000) AM_WRITE_LEGACY(mboard_write_LED_8) // Chessboard
- AM_RANGE( 0x7000, 0x7000) AM_WRITE_LEGACY(mboard_write_board_8) // Chessboard
+ AM_RANGE( 0x6000, 0x6000) AM_WRITE(mboard_write_LED_8) // Chessboard
+ AM_RANGE( 0x7000, 0x7000) AM_WRITE(mboard_write_board_8) // Chessboard
AM_RANGE( 0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -174,10 +174,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( mephisto_mem, AS_PROGRAM, 8, mephisto_state )
AM_RANGE( 0x0000, 0x1fff) AM_RAM //AM_BASE(m_p_ram)
AM_RANGE( 0x2000, 0x2000) AM_WRITE(write_lcd)
- AM_RANGE( 0x2400, 0x2407) AM_WRITE_LEGACY(mboard_write_LED_8) // Chessboard
- AM_RANGE( 0x2800, 0x2800) AM_WRITE_LEGACY(mboard_write_board_8) // Chessboard
+ AM_RANGE( 0x2400, 0x2407) AM_WRITE(mboard_write_LED_8) // Chessboard
+ AM_RANGE( 0x2800, 0x2800) AM_WRITE(mboard_write_board_8) // Chessboard
AM_RANGE( 0x2c00, 0x2c07) AM_READ(read_keys)
- AM_RANGE( 0x3000, 0x3000) AM_READ_LEGACY(mboard_read_board_8) // Chessboard
+ AM_RANGE( 0x3000, 0x3000) AM_READ(mboard_read_board_8) // Chessboard
AM_RANGE( 0x3400, 0x3407) AM_WRITE(write_led) // Status LEDs+ buzzer
AM_RANGE( 0x3800, 0x3800) AM_WRITE(mephisto_NMI) // NMI enable
AM_RANGE( 0x4000, 0x7fff) AM_ROM // Opening Library
@@ -188,10 +188,10 @@ static ADDRESS_MAP_START( mm2_mem, AS_PROGRAM, 8, mephisto_state )
AM_RANGE( 0x0000, 0x0fff) AM_RAM //AM_BASE(m_p_ram)
AM_RANGE( 0x1000, 0x1007) AM_WRITE(write_led_mm2) //Status LEDs
AM_RANGE( 0x1800, 0x1807) AM_READ(read_keys)
- AM_RANGE( 0x2000, 0x2000) AM_READ_LEGACY(mboard_read_board_8) //Chessboard
+ AM_RANGE( 0x2000, 0x2000) AM_READ(mboard_read_board_8) //Chessboard
AM_RANGE( 0x2800, 0x2800) AM_WRITE(write_lcd)
- AM_RANGE( 0x3000, 0x3000) AM_WRITE_LEGACY(mboard_write_LED_8) //Chessboard
- AM_RANGE( 0x3800, 0x3800) AM_WRITE_LEGACY(mboard_write_board_8) //Chessboard
+ AM_RANGE( 0x3000, 0x3000) AM_WRITE(mboard_write_LED_8) //Chessboard
+ AM_RANGE( 0x3800, 0x3800) AM_WRITE(mboard_write_board_8) //Chessboard
AM_RANGE( 0x4000, 0x7fff) AM_ROM // Opening Library ?
AM_RANGE( 0x8000, 0xffff) AM_ROM
ADDRESS_MAP_END
@@ -361,7 +361,7 @@ void mephisto_state::machine_start()
{
m_lcd_shift_counter = 3;
m_allowNMI = 1;
- mboard_savestate_register(machine());
+ mboard_savestate_register();
}
MACHINE_START_MEMBER(mephisto_state,mm2)
@@ -369,7 +369,7 @@ MACHINE_START_MEMBER(mephisto_state,mm2)
m_lcd_shift_counter = 3;
m_led7=0xff;
- mboard_savestate_register(machine());
+ mboard_savestate_register();
}
@@ -411,7 +411,7 @@ static MACHINE_CONFIG_START( mephisto, mephisto_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MCFG_TIMER_DRIVER_ADD_PERIODIC("nmi_timer", mephisto_state, update_nmi, attotime::from_hz(600))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", mephisto_state, mboard_update_artwork, attotime::from_hz(100))
MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( rebel5, mephisto )
diff --git a/src/mess/drivers/mmodular.c b/src/mess/drivers/mmodular.c
index e3b9c3c0af8..6786e97a5c8 100644
--- a/src/mess/drivers/mmodular.c
+++ b/src/mess/drivers/mmodular.c
@@ -95,7 +95,7 @@ Bit 5+6 LED 1-8 enable
#include "rendlay.h"
-#include "machine/mboard.h"
+#include "includes/mboard.h"
#include "machine/nvram.h"
//static UINT16 unknown2_data = 0;
@@ -124,11 +124,11 @@ INPUT_PORTS_EXTERN( chessboard );
UINT8 lcd32_char;
-class polgar_state : public driver_device
+class polgar_state : public mboard_state
{
public:
polgar_state(const machine_config &mconfig, device_type type, const char *tag)
- : driver_device(mconfig, type, tag) { }
+ : mboard_state(mconfig, type, tag) { }
UINT8 led_status;
UINT8 lcd_char;
@@ -200,6 +200,7 @@ public:
TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq6);
TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq2);
TIMER_DEVICE_CALLBACK_MEMBER(timer_update_irq_academy);
+ void common_chess_start();
};
static HD44780_INTERFACE( chess_display )
@@ -234,17 +235,6 @@ static UINT8 convert_imputmask(UINT8 input)
}
}
-static int get_first_cleared_bit(UINT8 data)
-{
- int i;
-
- for (i = 0; i < 8; i++)
- if (!BIT(data, i))
- return i;
-
- return NOT_VALID;
-}
-
WRITE8_MEMBER(polgar_state::write_polgar_IO)
{
int i;
@@ -1024,11 +1014,10 @@ MACHINE_START_MEMBER(polgar_state,van32)
MACHINE_START_MEMBER(polgar_state,risc)
{
-
}
-static void common_chess_start(void)
+void polgar_state::common_chess_start()
{
mboard_set_border_pieces();
mboard_set_board();
@@ -1037,45 +1026,38 @@ static void common_chess_start(void)
MACHINE_START_MEMBER(polgar_state,polgar)
{
common_chess_start();
- mboard_savestate_register(machine());
+ mboard_savestate_register();
}
MACHINE_START_MEMBER(polgar_state,sfortea)
{
common_chess_start();
- mboard_savestate_register(machine());
+ mboard_savestate_register();
}
MACHINE_START_MEMBER(polgar_state,diablo68)
{
-
common_chess_start();
-
}
MACHINE_START_MEMBER(polgar_state,van16)
{
-
- mboard_savestate_register(machine());
-
+ mboard_savestate_register();
}
MACHINE_RESET_MEMBER(polgar_state,van16)
{
common_chess_start();
-
}
MACHINE_RESET_MEMBER(polgar_state,polgar)
{
common_chess_start();
-
}
MACHINE_RESET_MEMBER(polgar_state,sfortea)
{
common_chess_start();
-
}
MACHINE_RESET_MEMBER(polgar_state,monteciv)
@@ -1119,9 +1101,9 @@ GFXDECODE_END
static ADDRESS_MAP_START(polgar_mem , AS_PROGRAM, 8, polgar_state )
AM_RANGE( 0x0000, 0x1fff ) AM_RAM
- AM_RANGE( 0x2400, 0x2400 ) AM_WRITE_LEGACY(mboard_write_LED_8 ) // Chessboard
- AM_RANGE( 0x2800, 0x2800 ) AM_WRITE_LEGACY(mboard_write_board_8) // Chessboard
- AM_RANGE( 0x3000, 0x3000 ) AM_READ_LEGACY(mboard_read_board_8 ) // Chessboard
+ AM_RANGE( 0x2400, 0x2400 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard
+ AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(mboard_write_board_8) // Chessboard
+ AM_RANGE( 0x3000, 0x3000 ) AM_READ(mboard_read_board_8 ) // Chessboard
AM_RANGE( 0x3400, 0x3405 ) AM_WRITE(polgar_write_LED) // Function LEDs
AM_RANGE( 0x2c00, 0x2c07 ) AM_READ(read_keys)
AM_RANGE( 0x2004, 0x2004 ) AM_WRITE(write_polgar_IO ) // LCD Instr. Reg + Beeper
@@ -1144,11 +1126,11 @@ static ADDRESS_MAP_START(gen32_mem, AS_PROGRAM, 32, polgar_state )
AM_RANGE( 0x00000000, 0x0003ffff ) AM_ROM
- AM_RANGE( 0xc0000000 , 0xc0000003 ) AM_READ_LEGACY(mboard_read_board_32 )
- AM_RANGE( 0xc8000000 , 0xc8000003 ) AM_WRITE_LEGACY(mboard_write_board_32 )
- AM_RANGE( 0xc8000004 , 0xc8000007 ) AM_WRITE_LEGACY(mboard_write_board_32 )
- AM_RANGE( 0xd0000000 , 0xd0000003 ) AM_WRITE_LEGACY(mboard_write_LED_32 )
- AM_RANGE( 0xd0000004 , 0xd0000007 ) AM_WRITE_LEGACY(mboard_write_LED_32 )
+ AM_RANGE( 0xc0000000 , 0xc0000003 ) AM_READ(mboard_read_board_32 )
+ AM_RANGE( 0xc8000000 , 0xc8000003 ) AM_WRITE(mboard_write_board_32 )
+ AM_RANGE( 0xc8000004 , 0xc8000007 ) AM_WRITE(mboard_write_board_32 )
+ AM_RANGE( 0xd0000000 , 0xd0000003 ) AM_WRITE(mboard_write_LED_32 )
+ AM_RANGE( 0xd0000004 , 0xd0000007 ) AM_WRITE(mboard_write_LED_32 )
AM_RANGE( 0xf0000004 , 0xf0000013 ) AM_READ(read_buttons_gen32 )
AM_RANGE( 0xe0000000 , 0xe0000003 ) AM_WRITE(write_LCD_data_32 )
AM_RANGE( 0xe0000010 , 0xe0000013 ) AM_WRITE(write_IOenables_32 )
@@ -1179,9 +1161,9 @@ static ADDRESS_MAP_START(van32_mem, AS_PROGRAM, 32, polgar_state )
AM_RANGE( 0x00000000, 0x0003ffff ) AM_ROM
- AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ_LEGACY(mboard_read_board_32 )
- AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE_LEGACY(mboard_write_board_32 )
- AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE_LEGACY(mboard_write_LED_32 )
+ AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ(mboard_read_board_32 )
+ AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE(mboard_write_board_32 )
+ AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE(mboard_write_LED_32 )
AM_RANGE( 0x800000ec , 0x800000ff ) AM_READ(read_buttons_van32 )
AM_RANGE( 0xa0000000 , 0xa0000003 ) AM_WRITE(write_LCD_data_32 )
AM_RANGE( 0xa0000010 , 0xa0000013 ) AM_WRITE(write_IOenables_32 )
@@ -1199,9 +1181,9 @@ static ADDRESS_MAP_START(alm32_mem, AS_PROGRAM, 32, polgar_state )
AM_RANGE( 0x00000000, 0x0001ffff ) AM_ROM
- AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ_LEGACY(mboard_read_board_32 )
- AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE_LEGACY(mboard_write_board_32 )
- AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE_LEGACY(mboard_write_LED_32 )
+ AM_RANGE( 0x800000fc , 0x800000ff ) AM_READ(mboard_read_board_32 )
+ AM_RANGE( 0x88000000 , 0x88000007 ) AM_WRITE(mboard_write_board_32 )
+ AM_RANGE( 0x90000000 , 0x90000007 ) AM_WRITE(mboard_write_LED_32 )
AM_RANGE( 0x800000ec , 0x800000ff ) AM_READ(read_buttons_van32 )
AM_RANGE( 0xa0000000 , 0xa0000003 ) AM_WRITE(write_LCD_data_32 )
AM_RANGE( 0xa0000010 , 0xa0000013 ) AM_WRITE(write_IOenables_32 )
@@ -1227,9 +1209,9 @@ static ADDRESS_MAP_START(van16_mem, AS_PROGRAM, 16, polgar_state )
AM_RANGE( 0x000000, 0x03ffff ) AM_ROM
- AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ_LEGACY(mboard_read_board_16 )
- AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE_LEGACY(mboard_write_board_16 )
- AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE_LEGACY(mboard_write_LED_16 )
+ AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ(mboard_read_board_16 )
+ AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE(mboard_write_board_16 )
+ AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE(mboard_write_LED_16 )
AM_RANGE( 0xf00000 , 0xf00009 ) AM_READ(read_buttons_van16 )
AM_RANGE( 0xd80000 , 0xd80001 ) AM_WRITE(write_LCD_data )
AM_RANGE( 0xd80008 , 0xd80009 ) AM_WRITE(write_IOenables )
@@ -1246,9 +1228,9 @@ static ADDRESS_MAP_START(alm16_mem, AS_PROGRAM, 16, polgar_state )
AM_RANGE( 0x000000, 0x01ffff ) AM_ROM
- AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ_LEGACY(mboard_read_board_16 )
- AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE_LEGACY(mboard_write_board_16 )
- AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE_LEGACY(mboard_write_LED_16 )
+ AM_RANGE( 0xc00000 , 0xc00001 ) AM_READ(mboard_read_board_16 )
+ AM_RANGE( 0xc80000 , 0xc80001 ) AM_WRITE(mboard_write_board_16 )
+ AM_RANGE( 0xd00000 , 0xd00001 ) AM_WRITE(mboard_write_LED_16 )
AM_RANGE( 0xf00000 , 0xf00009 ) AM_READ(read_buttons_van16 )
AM_RANGE( 0xd80000 , 0xd80001 ) AM_WRITE(write_LCD_data )
AM_RANGE( 0xd80008 , 0xd80009 ) AM_WRITE(write_IOenables )
@@ -1278,7 +1260,7 @@ static ADDRESS_MAP_START(academy_mem , AS_PROGRAM, 8, polgar_state )
AM_RANGE( 0x0000, 0x1fff ) AM_RAM
AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_academy )
AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(academy_write_board ) // Chessboard
- AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE_LEGACY(mboard_write_LED_8 ) // Chessboard
+ AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard
AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy )
AM_RANGE( 0x3001, 0x3001 ) AM_WRITE(academy_inhibitNMI )
AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED )
@@ -1290,7 +1272,7 @@ static ADDRESS_MAP_START(monteciv_mem , AS_PROGRAM, 8, polgar_state )
AM_RANGE( 0x0000, 0x1fff ) AM_RAM
AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_monteciv )
AM_RANGE( 0x2800, 0x2800 ) AM_WRITE(academy_write_board ) // Chessboard
- AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE_LEGACY(mboard_write_LED_8 ) // Chessboard
+ AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard
AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) // Status LEDs
AM_RANGE( 0x3000, 0x3001 ) AM_WRITE(monteciv_select_line ) // Select Keyline
AM_RANGE( 0x3002, 0x3002 ) AM_WRITE(beep_academy )
@@ -1306,7 +1288,7 @@ static ADDRESS_MAP_START(megaiv_mem , AS_PROGRAM, 8, polgar_state )
AM_RANGE( 0x0000, 0x1fff ) AM_RAM
/// AM_RANGE( 0x2400, 0x2400 ) AM_READ(read_keys_board_monteciv )
AM_RANGE( 0x6800, 0x6800 ) AM_WRITE(academy_write_board ) // 2800 // Chessboard
-/// AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE_LEGACY(mboard_write_LED_8 ) // Chessboard
+/// AM_RANGE( 0x2c00, 0x2c00 ) AM_WRITE(mboard_write_LED_8 ) // Chessboard
/// AM_RANGE( 0x3400, 0x3400 ) AM_WRITE(academy_write_LED ) // Status LEDs
AM_RANGE( 0x4400, 0x4400 ) AM_WRITE(megaiv_write_LED ) // 2400 // Select Keyline
AM_RANGE( 0x7000, 0x7001 ) AM_WRITE(megaiv_IO ) // Select Keyline
@@ -1567,7 +1549,7 @@ static MACHINE_CONFIG_START( polgar, polgar_state )
MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600))
MCFG_TIMER_START_DELAY(attotime::from_hz(60))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100))
MACHINE_CONFIG_END
@@ -1584,7 +1566,7 @@ static MACHINE_CONFIG_START( sfortea, polgar_state )
MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_M6502_irq, attotime::from_hz(600))
MCFG_TIMER_START_DELAY(attotime::from_hz(60))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100))
MACHINE_CONFIG_END
static MACHINE_CONFIG_START( alm32, polgar_state )
@@ -1593,7 +1575,7 @@ static MACHINE_CONFIG_START( alm32, polgar_state )
MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120))
MCFG_FRAGMENT_ADD( chess_common )
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -1626,7 +1608,7 @@ static MACHINE_CONFIG_START( monteciv, polgar_state )
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0)
MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", polgar_state, cause_nmi, attotime::from_hz(600))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100))
MACHINE_CONFIG_END
@@ -1647,7 +1629,7 @@ static MACHINE_CONFIG_START( diablo68, polgar_state )
MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq2, attotime::from_hz(60))
MCFG_TIMER_START_DELAY(attotime::from_hz(30))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120))
MACHINE_CONFIG_END
@@ -1659,7 +1641,7 @@ static MACHINE_CONFIG_START( van16, polgar_state )
MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(600))
//MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(587))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120))
MCFG_FRAGMENT_ADD( chess_common )
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -1676,7 +1658,7 @@ static MACHINE_CONFIG_START( van32, polgar_state )
MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120))
MCFG_FRAGMENT_ADD( chess_common )
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -1688,7 +1670,7 @@ static MACHINE_CONFIG_START( risc, polgar_state )
MCFG_CPU_PROGRAM_MAP(risc_mem)
MCFG_MACHINE_START_OVERRIDE(polgar_state,risc)
MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120))
MCFG_FRAGMENT_ADD( chess_common )
// MCFG_NVRAM_ADD_0FILL("nvram")
@@ -1702,7 +1684,7 @@ static MACHINE_CONFIG_START( gen32, polgar_state )
MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(375))
//MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(368.64))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(120))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(120))
MCFG_FRAGMENT_ADD( chess_common )
MCFG_NVRAM_ADD_0FILL("nvram")
@@ -1725,7 +1707,7 @@ static MACHINE_CONFIG_START( bpl32, polgar_state )
MCFG_MACHINE_START_OVERRIDE(polgar_state,van32)
MCFG_MACHINE_RESET_OVERRIDE(polgar_state,van16)
MCFG_TIMER_DRIVER_ADD_PERIODIC("int_timer", polgar_state, timer_update_irq6, attotime::from_hz(750))
- MCFG_TIMER_ADD_PERIODIC("artwork_timer", mboard_update_artwork, attotime::from_hz(100))
+ MCFG_TIMER_DRIVER_ADD_PERIODIC("artwork_timer", polgar_state, mboard_update_artwork, attotime::from_hz(100))
MCFG_FRAGMENT_ADD( chess_common )
MCFG_NVRAM_ADD_0FILL("nvram")
diff --git a/src/mess/includes/mboard.h b/src/mess/includes/mboard.h
new file mode 100644
index 00000000000..bc039a3eed5
--- /dev/null
+++ b/src/mess/includes/mboard.h
@@ -0,0 +1,99 @@
+/**********************************************************************
+
+ Mephisto Chess Computers
+
+**********************************************************************/
+
+#ifndef __MBOARD_H__
+#define __MBOARD_H__
+
+/***************************************************************************
+ MACROS
+***************************************************************************/
+
+enum
+{
+ EM, /*No piece*/
+ BP,
+ BN,
+ BB,
+ BR,
+ BQ,
+ BK,
+ WP,
+ WN,
+ WB,
+ WR,
+ WQ,
+ WK
+};
+
+#define NOT_VALID 99
+#define BORDER_PIECE 64
+
+
+/***************************************************************************
+ FUNCTION PROTOTYPES
+***************************************************************************/
+
+class mboard_state : public driver_device
+{
+public:
+ mboard_state(const machine_config &mconfig, device_type type, const char *tag)
+ : driver_device(mconfig, type, tag)
+ { }
+
+ DECLARE_READ8_MEMBER(mboard_read_board_8);
+ DECLARE_WRITE8_MEMBER(mboard_write_board_8);
+ DECLARE_WRITE8_MEMBER(mboard_write_LED_8);
+
+ DECLARE_READ16_MEMBER(mboard_read_board_16);
+ DECLARE_WRITE16_MEMBER(mboard_write_board_16);
+ DECLARE_WRITE16_MEMBER(mboard_write_LED_16);
+
+ DECLARE_READ32_MEMBER(mboard_read_board_32);
+ DECLARE_WRITE32_MEMBER(mboard_write_board_32);
+ DECLARE_WRITE32_MEMBER(mboard_write_LED_32);
+
+ TIMER_DEVICE_CALLBACK_MEMBER( mboard_update_artwork);
+
+ void mboard_savestate_register();
+
+ void mboard_set_board();
+ void mboard_set_border_pieces();
+
+ inline UINT8 pos_to_num(UINT8 val);
+
+ UINT8 mboard_lcd_invert;
+ UINT8 mboard_key_select;
+ UINT8 mboard_key_selector;
+
+ int get_first_cleared_bit(UINT8 data);
+private:
+ static const int start_board[64];
+ static UINT8 border_pieces[12];
+
+ int m_board[64];
+ int save_board[64];
+ UINT16 Line18_LED;
+ UINT16 Line18_REED;
+
+ int mouse_hold_border_piece;
+ UINT8 mouse_hold_from;
+ UINT8 mouse_hold_piece;
+
+ int read_board_flag;
+ int get_first_bit(UINT8 data);
+ UINT8 read_board();
+ void write_board(UINT8 data);
+ void write_LED(UINT8 data);
+ void board_presave();
+ void board_postload();
+ void clear_board();
+ void set_artwork();
+ void check_board_buttons();
+};
+
+
+
+#endif /* __MBOARD_H__ */
diff --git a/src/mess/machine/mboard.c b/src/mess/machine/mboard.c
index 00923fcf058..4d0ef90270b 100644
--- a/src/mess/machine/mboard.c
+++ b/src/mess/machine/mboard.c
@@ -4,16 +4,14 @@
**********************************************************************/
#include "emu.h"
-#include "machine/mboard.h"
+#include "includes/mboard.h"
+/***************************************************************************
+ TYPE DEFINITIONS
+***************************************************************************/
-static void set_artwork(running_machine &machine );
-static void check_board_buttons(running_machine &machine );
+#define IsPiece(x) ((m_board[x] >=1) && (m_board[x] <=12))
-UINT8 mboard_lcd_invert;
-UINT8 mboard_key_select;
-UINT8 mboard_key_selector;
-
-static const int start_board[64] =
+const int mboard_state::start_board[64] =
{
BR, BN, BB, BQ, BK, BB, BN, BR,
BP, BP, BP, BP, BP, BP, BP, BP,
@@ -25,18 +23,10 @@ static const int start_board[64] =
WR, WN, WB, WQ, WK, WB, WN, WR
};
-static UINT8 border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP,};
-
-static int m_board[64];
-static int save_board[64];
-static UINT16 Line18_LED;
-static UINT16 Line18_REED;
-
-static MOUSE_HOLD mouse_hold;
+UINT8 mboard_state::border_pieces[12] = {WK,WQ,WR,WB,WN,WP,BK,BQ,BR,BB,BN,BP,};
-static int read_board_flag = TRUE;
-static int get_first_bit(UINT8 data)
+int mboard_state::get_first_bit(UINT8 data)
{
int i;
@@ -47,7 +37,24 @@ static int get_first_bit(UINT8 data)
return NOT_VALID;
}
-static int get_first_cleared_bit(UINT8 data)
+
+inline UINT8 mboard_state::pos_to_num(UINT8 val)
+{
+ switch (val)
+ {
+ case 0xfe: return 7;
+ case 0xfd: return 6;
+ case 0xfb: return 5;
+ case 0xf7: return 4;
+ case 0xef: return 3;
+ case 0xdf: return 2;
+ case 0xbf: return 1;
+ case 0x7f: return 0;
+ default: return 0xff;
+ }
+}
+
+int mboard_state::get_first_cleared_bit(UINT8 data)
{
int i;
@@ -58,7 +65,7 @@ static int get_first_cleared_bit(UINT8 data)
return NOT_VALID;
}
-static UINT8 read_board(void)
+UINT8 mboard_state::read_board()
{
UINT8 i_18, i_AH;
UINT8 data;
@@ -110,12 +117,12 @@ data: 0 0000 0000 all fields occupied
}
-static void write_board( running_machine &machine, UINT8 data)
+void mboard_state::write_board(UINT8 data)
{
Line18_REED=data;
- if (read_board_flag && !strcmp(machine.system().name,"glasgow") ) //HACK
+ if (read_board_flag && !strcmp(machine().system().name,"glasgow") ) //HACK
Line18_LED = 0;
else
Line18_LED = data;
@@ -128,7 +135,7 @@ static void write_board( running_machine &machine, UINT8 data)
-static void write_LED(UINT8 data)
+void mboard_state::write_LED(UINT8 data)
{
int i;
UINT8 i_AH, i_18;
@@ -169,7 +176,7 @@ data: 10 0001 0000 Line E
-READ8_HANDLER( mboard_read_board_8 )
+READ8_MEMBER(mboard_state::mboard_read_board_8)
{
UINT8 data;
@@ -178,7 +185,7 @@ READ8_HANDLER( mboard_read_board_8 )
return data;
}
-READ16_HANDLER( mboard_read_board_16 )
+READ16_MEMBER(mboard_state::mboard_read_board_16)
{
UINT8 data;
@@ -186,7 +193,7 @@ READ16_HANDLER( mboard_read_board_16 )
return data << 8;
}
-READ32_HANDLER( mboard_read_board_32 )
+READ32_MEMBER(mboard_state::mboard_read_board_32)
{
UINT8 data;
@@ -194,41 +201,41 @@ READ32_HANDLER( mboard_read_board_32 )
return data<<24;
}
-WRITE8_HANDLER( mboard_write_board_8 )
+WRITE8_MEMBER(mboard_state::mboard_write_board_8)
{
- write_board(space.machine(),data);
+ write_board(data);
logerror("Write Board Port Data = %02x\n",data);
}
-WRITE16_HANDLER( mboard_write_board_16 )
+WRITE16_MEMBER(mboard_state::mboard_write_board_16)
{
- if (data & 0xff) write_board(space.machine(),data);
+ if (data & 0xff) write_board(data);
logerror("write board 16 %08x\n",data);
- write_board(space.machine(),data>>8);
+ write_board(data>>8);
}
-WRITE32_HANDLER( mboard_write_board_32 )
+WRITE32_MEMBER(mboard_state::mboard_write_board_32)
{
// data |= data << 24;
//printf("write board %08x %08x\n",offset,data);
logerror("write board 32 o: %08x d: %08x\n",offset,data);
- if (offset) write_board(space.machine(),data);
- else write_board(space.machine(),data>>24);
+ if (offset) write_board(data);
+ else write_board(data>>24);
}
-WRITE8_HANDLER( mboard_write_LED_8 )
+WRITE8_MEMBER(mboard_state::mboard_write_LED_8)
{
write_LED(data);
space.device().execute().spin_until_time(attotime::from_usec(7));
}
-WRITE16_HANDLER( mboard_write_LED_16 )
+WRITE16_MEMBER(mboard_state::mboard_write_LED_16)
{
write_LED(data >> 8);
space.device().execute().spin_until_time(attotime::from_usec(9));
}
-WRITE32_HANDLER( mboard_write_LED_32 )
+WRITE32_MEMBER(mboard_state::mboard_write_LED_32)
{
// data = data | data << 24;
//printf("write LED %08x %08x\n",offset,data);
@@ -241,14 +248,14 @@ WRITE32_HANDLER( mboard_write_LED_32 )
/* save states callback */
-static void board_presave(running_machine *machine)
+void mboard_state::board_presave()
{
int i;
for (i=0;i<64;i++)
save_board[i]=m_board[i];
}
-static void board_postload(running_machine *machine)
+void mboard_state::board_postload()
{
int i;
for (i=0;i<64;i++)
@@ -256,49 +263,50 @@ static void board_postload(running_machine *machine)
}
-void mboard_savestate_register(running_machine &machine)
+void mboard_state::mboard_savestate_register()
{
- state_save_register_global_array(machine,save_board);
- machine.save().register_postload(save_prepost_delegate(FUNC(board_postload),&machine));
- machine.save().register_presave(save_prepost_delegate(FUNC(board_presave),&machine));
+ state_save_register_global_array(machine(),save_board);
+ machine().save().register_postload(save_prepost_delegate(FUNC(mboard_state::board_postload),this));
+ machine().save().register_presave(save_prepost_delegate(FUNC(mboard_state::board_presave),this));
}
-void mboard_set_board( void )
+void mboard_state::mboard_set_board()
{
+ read_board_flag = TRUE;
int i;
for (i=0;i<64;i++)
m_board[i]=start_board[i];
}
-static void clear_board( void )
+void mboard_state::clear_board()
{
int i;
for (i=0;i<64;i++)
m_board[i]=EM;
}
-static void set_artwork ( running_machine &machine )
+void mboard_state::set_artwork()
{
int i;
for (i=0;i<64;i++)
output_set_indexed_value("P", i, m_board[i]);
}
-void mboard_set_border_pieces (void)
+void mboard_state::mboard_set_border_pieces()
{
int i;
for (i=0;i<12;i++)
output_set_indexed_value("Q", i, border_pieces[i]);
}
-TIMER_DEVICE_CALLBACK( mboard_update_artwork )
+TIMER_DEVICE_CALLBACK_MEMBER(mboard_state::mboard_update_artwork )
{
- check_board_buttons(timer.machine());
- set_artwork(timer.machine());
+ check_board_buttons();
+ set_artwork();
mboard_set_border_pieces();
}
-static void check_board_buttons ( running_machine &machine )
+void mboard_state::check_board_buttons()
{
int field;
int i;
@@ -315,14 +323,14 @@ static void check_board_buttons ( running_machine &machine )
/* check click on border pieces */
i=0;
- port_input=machine.root_device().ioport("B_BLACK")->read();
+ port_input=machine().root_device().ioport("B_BLACK")->read();
if (port_input)
{
i=get_first_bit(port_input)+6;
click_on_border_piece=TRUE;
}
- port_input=machine.root_device().ioport("B_WHITE")->read();
+ port_input=machine().root_device().ioport("B_WHITE")->read();
if (port_input)
{
i=get_first_bit(port_input);
@@ -335,20 +343,20 @@ static void check_board_buttons ( running_machine &machine )
{
if (border_pieces[i] > 12 ) /* second click on selected border piece */
{
- mouse_hold.border_piece=FALSE;
+ mouse_hold_border_piece=FALSE;
border_pieces[i]=border_pieces[i]-12;
- mouse_hold.from=0;
- mouse_hold.piece=0;
+ mouse_hold_from=0;
+ mouse_hold_piece=0;
}
- else if (!mouse_hold.piece) /*select border piece */
+ else if (!mouse_hold_piece) /*select border piece */
{
- if (mouse_hold.border_piece)
- border_pieces[mouse_hold.from]=border_pieces[mouse_hold.from]-12;
+ if (mouse_hold_border_piece)
+ border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12;
- mouse_hold.from=i;
- mouse_hold.piece=border_pieces[i];
+ mouse_hold_from=i;
+ mouse_hold_piece=border_pieces[i];
border_pieces[i]=border_pieces[i]+12;
- mouse_hold.border_piece=TRUE;
+ mouse_hold_border_piece=TRUE;
}
mouse_down = board_row + 1;
@@ -359,7 +367,7 @@ static void check_board_buttons ( running_machine &machine )
/* check click on board */
- data = machine.root_device().ioport(keynames[board_row])->read_safe(0xff);
+ data = machine().root_device().ioport(keynames[board_row])->read_safe(0xff);
if ((data != 0xff) && (!mouse_down) )
{
@@ -371,30 +379,30 @@ static void check_board_buttons ( running_machine &machine )
if (!(pos2num_res < 8))
logerror("Position out of bound!");
- else if ((mouse_hold.piece) && (!IsPiece(field)))
+ else if ((mouse_hold_piece) && (!IsPiece(field)))
{
/* Moving a piece onto a blank */
- m_board[field] = mouse_hold.piece;
+ m_board[field] = mouse_hold_piece;
- if (mouse_hold.border_piece)
+ if (mouse_hold_border_piece)
{
- border_pieces[mouse_hold.from]=border_pieces[mouse_hold.from]-12;
- }else if ( field != mouse_hold.from ) /* Put a selected piece back to the source field */
- m_board[mouse_hold.from] = 0;
+ border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12;
+ }else if ( field != mouse_hold_from ) /* Put a selected piece back to the source field */
+ m_board[mouse_hold_from] = 0;
- mouse_hold.from = 0;
- mouse_hold.piece = 0;
- mouse_hold.border_piece=FALSE;
+ mouse_hold_from = 0;
+ mouse_hold_piece = 0;
+ mouse_hold_border_piece=FALSE;
}
- else if ((!mouse_hold.piece) )
+ else if ((!mouse_hold_piece) )
{
/* Picking up a piece */
if (IsPiece(field))
{
- mouse_hold.from = field;
- mouse_hold.piece = m_board[field];
+ mouse_hold_from = field;
+ mouse_hold_piece = m_board[field];
m_board[field] = m_board[field]+12;
}
@@ -406,18 +414,18 @@ static void check_board_buttons ( running_machine &machine )
mouse_down = 0;
/* check click on border - remove selected piece*/
- if (machine.root_device().ioport("LINE10")->read_safe(0x01))
+ if (machine().root_device().ioport("LINE10")->read_safe(0x01))
{
- if (mouse_hold.piece)
+ if (mouse_hold_piece)
{
- if (mouse_hold.border_piece)
- border_pieces[mouse_hold.from]=border_pieces[mouse_hold.from]-12;
+ if (mouse_hold_border_piece)
+ border_pieces[mouse_hold_from]=border_pieces[mouse_hold_from]-12;
else
- m_board[mouse_hold.from] = 0;
+ m_board[mouse_hold_from] = 0;
- mouse_hold.from = 0;
- mouse_hold.piece = 0;
- mouse_hold.border_piece = FALSE;
+ mouse_hold_from = 0;
+ mouse_hold_piece = 0;
+ mouse_hold_border_piece = FALSE;
}
return;
@@ -427,7 +435,7 @@ static void check_board_buttons ( running_machine &machine )
if (data == 0xff)
{
- port_input=machine.root_device().ioport("B_BUTTONS")->read();
+ port_input=machine().root_device().ioport("B_BUTTONS")->read();
if (port_input==0x01)
{
clear_board();
diff --git a/src/mess/machine/mboard.h b/src/mess/machine/mboard.h
deleted file mode 100644
index 3fd35568041..00000000000
--- a/src/mess/machine/mboard.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/**********************************************************************
-
- Mephisto Chess Computers
-
-**********************************************************************/
-
-#ifndef __MBOARD_H__
-#define __MBOARD_H__
-
-#include "emu.h"
-
-
-/***************************************************************************
- MACROS
-***************************************************************************/
-
-enum
-{
- EM, /*No piece*/
- BP,
- BN,
- BB,
- BR,
- BQ,
- BK,
- WP,
- WN,
- WB,
- WR,
- WQ,
- WK
-};
-
-#define NOT_VALID 99
-#define BORDER_PIECE 64
-
-#define IsPiece(x) ((m_board[x] >=1) && (m_board[x] <=12))
-
-#define IsBitSet(x,y) ( y & (1<<x) ) //ersetzen durch BIT
-
-/***************************************************************************
- TYPE DEFINITIONS
-***************************************************************************/
-
-struct MOUSE_HOLD {
- int border_piece;
- UINT8 from;
- UINT8 piece;
-};
-
-/***************************************************************************
- FUNCTION PROTOTYPES
-***************************************************************************/
-
-DECLARE_READ8_HANDLER( mboard_read_board_8 );
-DECLARE_WRITE8_HANDLER( mboard_write_board_8 );
-DECLARE_WRITE8_HANDLER( mboard_write_LED_8 );
-
-DECLARE_READ16_HANDLER( mboard_read_board_16 );
-DECLARE_WRITE16_HANDLER( mboard_write_board_16 );
-DECLARE_WRITE16_HANDLER( mboard_write_LED_16 );
-
-DECLARE_READ32_HANDLER( mboard_read_board_32 );
-DECLARE_WRITE32_HANDLER( mboard_write_board_32 );
-DECLARE_WRITE32_HANDLER( mboard_write_LED_32 );
-
-TIMER_DEVICE_CALLBACK( mboard_update_artwork );
-
-void mboard_savestate_register(running_machine &machine);
-
-void mboard_set_board( void );
-void mboard_set_border_pieces (void);
-
-INLINE UINT8 pos_to_num(UINT8 val)
-{
- switch (val)
- {
- case 0xfe: return 7;
- case 0xfd: return 6;
- case 0xfb: return 5;
- case 0xf7: return 4;
- case 0xef: return 3;
- case 0xdf: return 2;
- case 0xbf: return 1;
- case 0x7f: return 0;
- default: return 0xff;
- }
-}
-
-/***************************************************************************
- GLOBALS
-***************************************************************************/
-
-extern UINT8 mboard_lcd_invert;
-extern UINT8 mboard_key_select;
-extern UINT8 mboard_key_selector;
-
-#endif /* __MBOARD_H__ */