diff options
author | mamehaze <mamehaze@users.noreply.github.com> | 2015-01-18 02:24:38 +0000 |
---|---|---|
committer | mamehaze <mamehaze@users.noreply.github.com> | 2015-01-18 02:24:38 +0000 |
commit | 444fa088ea613837d70c08ded58be8db5d011114 (patch) | |
tree | 34686b5ab2c45581e90408e822f07a69289e047b | |
parent | 509df8c3f975be8c7cfacb14191a7301ec74b099 (diff) | |
parent | 2044302b96e3dbf10976765c99f4220b8557c2a1 (diff) |
Merge branch 'master' of https://github.com/mamedev/mame
108 files changed, 2316 insertions, 638 deletions
diff --git a/src/emu/bus/vcs/dpc.c b/src/emu/bus/vcs/dpc.c index 7387c6dbb34..f701a531ebe 100644 --- a/src/emu/bus/vcs/dpc.c +++ b/src/emu/bus/vcs/dpc.c @@ -26,6 +26,23 @@ void dpc_device::device_start() { m_oscillator = timer_alloc(TIMER_OSC); m_oscillator->reset(); + + for (int i = 0; i < 8; i++) + { + save_item(NAME(m_df[i].top), i); + save_item(NAME(m_df[i].bottom), i); + save_item(NAME(m_df[i].low), i); + save_item(NAME(m_df[i].high), i); + save_item(NAME(m_df[i].flag), i); + save_item(NAME(m_df[i].music_mode), i); + save_item(NAME(m_df[i].osc_clk), i); + } + + save_item(NAME(m_movamt)); + save_item(NAME(m_latch_62)); + save_item(NAME(m_latch_64)); + save_item(NAME(m_dlc)); + save_item(NAME(m_shift_reg)); } void dpc_device::device_reset() diff --git a/src/emu/clifront.c b/src/emu/clifront.c index 5231d3079d3..c0258f75b62 100644 --- a/src/emu/clifront.c +++ b/src/emu/clifront.c @@ -24,6 +24,8 @@ #include "drivenum.h" +#include "osdepend.h" + #include <new> #include <ctype.h> diff --git a/src/emu/clifront.h b/src/emu/clifront.h index 81655e60a85..a4680d27dc8 100644 --- a/src/emu/clifront.h +++ b/src/emu/clifront.h @@ -15,8 +15,9 @@ #include "emu.h" #include "cliopts.h" -#include "osdepend.h" +// don't include osd_interface in header files +class osd_interface; //************************************************************************** // TYPE DEFINITIONS diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c index cb4650995b4..11e0d0550b3 100644 --- a/src/emu/cpu/tms0980/tms0980.c +++ b/src/emu/cpu/tms0980/tms0980.c @@ -69,54 +69,55 @@ unknown cycle: CME, SSE, SSS */ /* Microinstructions */ -#define M_15TN 0x00000001 /* 15 to -ALU */ -#define M_ATN 0x00000002 /* ACC to -ALU */ -#define M_AUTA 0x00000004 /* ALU to ACC */ -#define M_AUTY 0x00000008 /* ALU to Y */ -#define M_C8 0x00000010 /* CARRY8 to STATUS */ -#define M_CIN 0x00000020 /* Carry In to ALU */ -#define M_CKM 0x00000040 /* CKB to MEM */ -#define M_CKN 0x00000080 /* CKB to -ALU */ -#define M_CKP 0x00000100 /* CKB to +ALU */ -#define M_MTN 0x00000200 /* MEM to -ALU */ -#define M_MTP 0x00000400 /* MEM to +ALU */ -#define M_NATN 0x00000800 /* ~ACC to -ALU */ -#define M_NE 0x00001000 /* COMP to STATUS */ -#define M_STO 0x00002000 /* ACC to MEM */ -#define M_STSL 0x00004000 /* STATUS to Status Latch */ -#define M_YTP 0x00008000 /* Y to +ALU */ - -#define M_CME 0x00010000 /* Conditional Memory Enable */ -#define M_DMTP 0x00020000 /* DAM to +ALU */ -#define M_NDMTP 0x00040000 /* ~DAM to +ALU */ -#define M_SSE 0x00080000 /* Special Status Enable */ -#define M_SSS 0x00100000 /* Special Status Sample */ - -#define M_RSTR 0x00200000 /* -> line #36, F_RSTR (TMS02x0 custom) */ -#define M_UNK1 0x00400000 /* -> line #37, F_???? (TMS0270 custom) */ +#define M_15TN (1<<0) /* 15 to -ALU */ +#define M_ATN (1<<1) /* ACC to -ALU */ +#define M_AUTA (1<<2) /* ALU to ACC */ +#define M_AUTY (1<<3) /* ALU to Y */ +#define M_C8 (1<<4) /* CARRY8 to STATUS */ +#define M_CIN (1<<5) /* Carry In to ALU */ +#define M_CKM (1<<6) /* CKB to MEM */ +#define M_CKN (1<<7) /* CKB to -ALU */ +#define M_CKP (1<<8) /* CKB to +ALU */ +#define M_MTN (1<<9) /* MEM to -ALU */ +#define M_MTP (1<<10) /* MEM to +ALU */ +#define M_NATN (1<<11) /* ~ACC to -ALU */ +#define M_NE (1<<12) /* COMP to STATUS */ +#define M_STO (1<<13) /* ACC to MEM */ +#define M_STSL (1<<14) /* STATUS to Status Latch */ +#define M_YTP (1<<15) /* Y to +ALU */ + +#define M_CME (1<<16) /* Conditional Memory Enable */ +#define M_DMTP (1<<17) /* DAM to +ALU */ +#define M_NDMTP (1<<18) /* ~DAM to +ALU */ +#define M_SSE (1<<19) /* Special Status Enable */ +#define M_SSS (1<<20) /* Special Status Sample */ + +#define M_RSTR (1<<21) /* -> line #36, F_RSTR (TMS02x0 custom) */ +#define M_UNK1 (1<<22) /* -> line #37, F_???? (TMS0270 custom) */ /* Standard/fixed instructions - these are documented more in their specific handlers below */ -#define F_BR 0x00000001 -#define F_CALL 0x00000002 -#define F_CLO 0x00000004 -#define F_COMC 0x00000008 -#define F_COMX 0x00000010 -#define F_COMX8 0x00000020 -#define F_LDP 0x00000040 -#define F_LDX 0x00000080 -#define F_RBIT 0x00000100 -#define F_RETN 0x00000200 -#define F_RSTR 0x00000400 -#define F_SBIT 0x00000800 -#define F_SETR 0x00001000 -#define F_TDO 0x00002000 - -#define F_OFF 0x00004000 -#define F_REAC 0x00008000 -#define F_SAL 0x00010000 -#define F_SBL 0x00020000 -#define F_SEAC 0x00040000 -#define F_XDA 0x00080000 +#define F_BR (1<<0) +#define F_CALL (1<<1) +#define F_CLO (1<<2) +#define F_COMC (1<<3) +#define F_COMX (1<<4) +#define F_COMX8 (1<<5) +#define F_LDP (1<<6) +#define F_LDX (1<<7) +#define F_RBIT (1<<8) +#define F_RETN (1<<9) +#define F_RSTR (1<<10) +#define F_SBIT (1<<11) +#define F_SETR (1<<12) +#define F_TDO (1<<13) +#define F_TPC (1<<14) + +#define F_OFF (1<<15) +#define F_REAC (1<<16) +#define F_SAL (1<<17) +#define F_SBL (1<<18) +#define F_SEAC (1<<19) +#define F_XDA (1<<20) // supported types: @@ -132,13 +133,21 @@ unknown cycle: CME, SSE, SSS // - 20-term output PLA(opla) at the top-left // - the ALU is between the opla and mpla const device_type TMS1000 = &device_creator<tms1000_cpu_device>; // 28-pin DIP, 11 R pins -const device_type TMS1070 = &device_creator<tms1070_cpu_device>; // same as tms1000, just supports higher voltage +const device_type TMS1070 = &device_creator<tms1070_cpu_device>; // almost same as tms1000, just supports higher voltage const device_type TMS1200 = &device_creator<tms1200_cpu_device>; // 40-pin DIP, 13 R pins // TMS1270 has 10 O pins, how does that work? // TMS1100 is nearly the same as TMS1000, some different opcodes, and with double the RAM and ROM const device_type TMS1100 = &device_creator<tms1100_cpu_device>; // 28-pin DIP, 11 R pins +const device_type TMS1170 = &device_creator<tms1170_cpu_device>; // almost same as tms1100, just supports higher voltage const device_type TMS1300 = &device_creator<tms1300_cpu_device>; // 40-pin DIP, 16 R pins +const device_type TMS1370 = &device_creator<tms1370_cpu_device>; // almost same as tms1300, just supports higher voltage + +// TMS1400 follows the TMS1100, it doubles the ROM size again (4 chapters of 16 pages), and adds a 3-level callstack +// - rotate the view and mirror the OR-mask to get the proper layout of the mpla, the default is identical to tms1100 +// - the opla size is increased from 20 to 32 terms +const device_type TMS1400 = &device_creator<tms1400_cpu_device>; // 28-pin DIP, 11 R pins +const device_type TMS1470 = &device_creator<tms1470_cpu_device>; // almost same as tms1400, just supports higher voltage // TMS0980 // - 64x9bit RAM array at the bottom-left (set up as 144x4) @@ -177,6 +186,10 @@ static ADDRESS_MAP_START(program_11bit_8, AS_PROGRAM, 8, tms1xxx_cpu_device) AM_RANGE(0x000, 0x7ff) AM_ROM ADDRESS_MAP_END +static ADDRESS_MAP_START(program_12bit_8, AS_PROGRAM, 8, tms1xxx_cpu_device) + AM_RANGE(0x000, 0xfff) AM_ROM +ADDRESS_MAP_END + static ADDRESS_MAP_START(data_64x4, AS_DATA, 8, tms1xxx_cpu_device) AM_RANGE(0x00, 0x3f) AM_RAM @@ -217,8 +230,29 @@ tms1100_cpu_device::tms1100_cpu_device(const machine_config &mconfig, device_typ : tms1000_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) { } +tms1170_cpu_device::tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms1100_cpu_device(mconfig, TMS1170, "TMS1170", tag, owner, clock, 8, 11, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1170", __FILE__) +{ } + tms1300_cpu_device::tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : tms1100_cpu_device(mconfig, TMS1300, "TMS1200", tag, owner, clock, 8, 16, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1300", __FILE__) + : tms1100_cpu_device(mconfig, TMS1300, "TMS1300", tag, owner, clock, 8, 16, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1300", __FILE__) +{ } + +tms1370_cpu_device::tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms1100_cpu_device(mconfig, TMS1370, "TMS1370", tag, owner, clock, 8, 16, 6, 8, 3, 11, ADDRESS_MAP_NAME(program_11bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1370", __FILE__) +{ } + + +tms1400_cpu_device::tms1400_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms1100_cpu_device(mconfig, TMS1400, "TMS1400", tag, owner, clock, 8, 11, 6, 8, 3, 12, ADDRESS_MAP_NAME(program_12bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1400", __FILE__) +{ } + +tms1400_cpu_device::tms1400_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 o_pins, UINT8 r_pins, UINT8 pc_bits, UINT8 byte_bits, UINT8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source) + : tms1100_cpu_device(mconfig, type, name, tag, owner, clock, o_pins, r_pins, pc_bits, byte_bits, x_bits, prgwidth, program, datawidth, data, shortname, source) +{ } + +tms1470_cpu_device::tms1470_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) + : tms1400_cpu_device(mconfig, TMS1470, "TMS1470", tag, owner, clock, 8, 10, 6, 8, 3, 12, ADDRESS_MAP_NAME(program_12bit_8), 7, ADDRESS_MAP_NAME(data_128x4), "tms1470", __FILE__) { } @@ -264,6 +298,21 @@ machine_config_constructor tms1000_cpu_device::device_mconfig_additions() const } +static MACHINE_CONFIG_FRAGMENT(tms1400) + + // microinstructions PLA, output PLA + MCFG_PLA_ADD("mpla", 8, 16, 30) + MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY) + MCFG_PLA_ADD("opla", 5, 8, 32) + MCFG_PLA_FILEFORMAT(PLA_FMT_BERKELEY) +MACHINE_CONFIG_END + +machine_config_constructor tms1400_cpu_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME(tms1400); +} + + static MACHINE_CONFIG_FRAGMENT(tms0970) // main opcodes PLA, microinstructions PLA, output PLA, segment PLA @@ -380,6 +429,7 @@ void tms1xxx_cpu_device::device_start() m_sr = 0; m_pa = 0; m_pb = 0; + m_ps = 0; m_a = 0; m_x = 0; m_y = 0; @@ -417,6 +467,7 @@ void tms1xxx_cpu_device::device_start() save_item(NAME(m_sr)); save_item(NAME(m_pa)); save_item(NAME(m_pb)); + save_item(NAME(m_ps)); save_item(NAME(m_a)); save_item(NAME(m_x)); save_item(NAME(m_y)); @@ -582,6 +633,15 @@ void tms1100_cpu_device::device_reset() for (int i = 0x3c; i < 0x40; i++) m_fixed_decode[i] = 0; } +void tms1400_cpu_device::device_reset() +{ + tms1100_cpu_device::device_reset(); + + // small differences in 00-3f area + m_fixed_decode[0x09] = F_COMX; + m_fixed_decode[0x0b] = F_TPC; +} + void tms0970_cpu_device::device_reset() { @@ -899,7 +959,118 @@ void tms0980_cpu_device::set_cki_bus() // fixed opcode set //------------------------------------------------- -// TMS1000/common: +// handle branches: + +// TMS1000/common +// note: add(latch) and bl(branch latch) are specific to 0980 series, +// c(chapter) bits are specific to 1100(and 1400) series + +void tms1xxx_cpu_device::op_br() +{ + // BR/BL: conditional branch + if (m_status) + { + if (m_clatch == 0) + m_pa = m_pb; + m_ca = m_cb; + m_pc = m_opcode & m_pc_mask; + } +} + +void tms1xxx_cpu_device::op_call() +{ + // CALL/CALLL: conditional call + if (m_status) + { + UINT8 prev_pa = m_pa; + + if (m_clatch == 0) + { + m_clatch = 1; + m_sr = m_pc; + m_pa = m_pb; + m_cs = m_ca; + } + m_ca = m_cb; + m_pb = prev_pa; + m_pc = m_opcode & m_pc_mask; + } +} + +void tms1xxx_cpu_device::op_retn() +{ + // RETN: return from subroutine + if (m_clatch == 1) + { + m_clatch = 0; + m_pc = m_sr; + m_ca = m_cs; + } + m_add = 0; + m_bl = 0; + m_pa = m_pb; +} + + +// TMS1400-specific + +void tms1400_cpu_device::op_br() +{ + // BR/BL: conditional branch + if (m_status) + { + m_pa = m_pb; // don't care about clatch + m_ca = m_cb; + m_pc = m_opcode & m_pc_mask; + } +} + +void tms1400_cpu_device::op_call() +{ + // CALL/CALLL: conditional call + if (m_status) + { + // 3-level stack, mask clatch 3 bits (no need to mask others) + m_clatch = (m_clatch << 1 | 1) & 7; + + m_sr = m_sr << m_pc_bits | m_pc; + m_pc = m_opcode & m_pc_mask; + + m_ps = m_ps << 4 | m_pa; + m_pa = m_pb; + + m_cs = m_cs << 2 | m_ca; + m_ca = m_cb; + } + else + { + m_pb = m_pa; + m_cb = m_ca; + } +} + +void tms1400_cpu_device::op_retn() +{ + // RETN: return from subroutine + if (m_clatch & 1) + { + m_clatch >>= 1; + + m_pc = m_sr & m_pc_mask; + m_sr >>= m_pc_bits; + + m_pa = m_pb = m_ps & 0xf; + m_ps >>= 4; + + m_ca = m_cb = m_cs & 3; + m_cs >>= 2; + } +} + + +// handle other: + +// TMS1000/common void tms1xxx_cpu_device::op_sbit() { @@ -992,6 +1163,15 @@ void tms1xxx_cpu_device::op_comc() } +// TMS1400-specific + +void tms1xxx_cpu_device::op_tpc() +{ + // TPC: transfer page buffer to chapter buffer + m_cb = m_pb & 3; +} + + // TMS0970-specific (and possibly child classes) void tms0970_cpu_device::op_setr() { @@ -1010,6 +1190,7 @@ void tms0970_cpu_device::op_tdo() // TMS0980-specific (and possibly child classes) + void tms0980_cpu_device::op_comx() { // COMX: complement X register, but not the MSB @@ -1055,6 +1236,7 @@ void tms1xxx_cpu_device::op_sbl() // TMS0270-specific + void tms0270_cpu_device::op_setr() { // same as default, but handle write to output in dynamic_output @@ -1095,51 +1277,9 @@ void tms1xxx_cpu_device::execute_run() // fetch: rom address 1/2 // execute: br/call 2/2 - // note: add(latch) and bl(branch latch) are specific to 0980 series, - // c(chapter) bits are specific to 1100 series - if (m_status) - { - UINT8 new_pc = m_opcode & m_pc_mask; - - // BR: conditional branch - if (m_fixed & F_BR) - { - if (m_clatch == 0) - m_pa = m_pb; - m_ca = m_cb; - m_pc = new_pc; - } - - // CALL: conditional call - if (m_fixed & F_CALL) - { - UINT8 prev_pa = m_pa; - if (m_clatch == 0) - { - m_sr = m_pc; - m_clatch = 1; - m_pa = m_pb; - m_cs = m_ca; - } - m_ca = m_cb; - m_pb = prev_pa; - m_pc = new_pc; - } - } - - // RETN: return from subroutine - if (m_fixed & F_RETN) - { - if (m_clatch == 1) - { - m_pc = m_sr; - m_clatch = 0; - m_ca = m_cs; - } - m_add = 0; - m_bl = 0; - m_pa = m_pb; - } + if (m_fixed & F_BR) op_br(); + if (m_fixed & F_CALL) op_call(); + if (m_fixed & F_RETN) op_retn(); // execute: k input valid, read ram, clear alu inputs dynamic_output(); @@ -1216,6 +1356,7 @@ void tms1xxx_cpu_device::execute_run() if (m_fixed & F_COMX8) op_comx8(); if (m_fixed & F_LDP) op_ldp(); if (m_fixed & F_COMC) op_comc(); + if (m_fixed & F_TPC) op_tpc(); if (m_fixed & F_OFF) op_off(); if (m_fixed & F_SEAC) op_seac(); if (m_fixed & F_REAC) op_reac(); diff --git a/src/emu/cpu/tms0980/tms0980.h b/src/emu/cpu/tms0980/tms0980.h index ebc14cb44f4..b429b5b7720 100644 --- a/src/emu/cpu/tms0980/tms0980.h +++ b/src/emu/cpu/tms0980/tms0980.h @@ -106,6 +106,10 @@ protected: virtual void dynamic_output() { ; } // not used by default virtual void read_opcode(); + virtual void op_br(); + virtual void op_call(); + virtual void op_retn(); + virtual void op_sbit(); virtual void op_rbit(); virtual void op_setr(); @@ -118,6 +122,7 @@ protected: virtual void op_ldp(); virtual void op_comc(); + virtual void op_tpc(); virtual void op_xda(); virtual void op_off(); virtual void op_seac(); @@ -134,15 +139,16 @@ protected: optional_device<pla_device> m_spla; UINT8 m_pc; // 6 or 7-bit program counter - UINT8 m_sr; // 6 or 7-bit subroutine return register + UINT32 m_sr; // 6 or 7-bit subroutine return register(s) UINT8 m_pa; // 4-bit page address register UINT8 m_pb; // 4-bit page buffer register + UINT16 m_ps; // 4-bit page subroutine register(s) UINT8 m_a; // 4-bit accumulator UINT8 m_x; // 2,3,or 4-bit RAM X register UINT8 m_y; // 4-bit RAM Y register - UINT8 m_ca; // chapter address bit - UINT8 m_cb; // chapter buffer bit - UINT8 m_cs; // chapter subroutine bit + UINT8 m_ca; // chapter address register + UINT8 m_cb; // chapter buffer register + UINT16 m_cs; // chapter subroutine register(s) UINT16 m_r; UINT16 m_o; UINT8 m_cki_bus; @@ -155,7 +161,7 @@ protected: UINT8 m_status; UINT8 m_status_latch; UINT8 m_eac; // end around carry bit - UINT8 m_clatch; // call latch bit + UINT8 m_clatch; // call latch bit(s) UINT8 m_add; // add latch bit UINT8 m_bl; // branch latch bit @@ -244,12 +250,50 @@ protected: virtual void op_rstr(); }; +class tms1170_cpu_device : public tms1100_cpu_device +{ +public: + tms1170_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + class tms1300_cpu_device : public tms1100_cpu_device { public: tms1300_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); }; +class tms1370_cpu_device : public tms1100_cpu_device +{ +public: + tms1370_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + + +class tms1400_cpu_device : public tms1100_cpu_device +{ +public: + tms1400_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); + tms1400_cpu_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, UINT8 o_pins, UINT8 r_pins, UINT8 pc_bits, UINT8 byte_bits, UINT8 x_bits, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data, const char *shortname, const char *source); + +protected: + // overrides + virtual void device_reset(); + virtual machine_config_constructor device_mconfig_additions() const; + + virtual void op_br(); + virtual void op_call(); + virtual void op_retn(); + + virtual void op_setr() { tms1xxx_cpu_device::op_setr(); } // no anomaly with MSB of X register + virtual void op_rstr() { tms1xxx_cpu_device::op_rstr(); } // " +}; + +class tms1470_cpu_device : public tms1400_cpu_device +{ +public: + tms1470_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); +}; + class tms0970_cpu_device : public tms1000_cpu_device { @@ -344,7 +388,11 @@ extern const device_type TMS1000; extern const device_type TMS1070; extern const device_type TMS1200; extern const device_type TMS1100; +extern const device_type TMS1170; extern const device_type TMS1300; +extern const device_type TMS1370; +extern const device_type TMS1400; +extern const device_type TMS1470; extern const device_type TMS0970; extern const device_type TMS0980; extern const device_type TMS0270; diff --git a/src/emu/emu.mak b/src/emu/emu.mak index 71d20b40168..f572400ca74 100644 --- a/src/emu/emu.mak +++ b/src/emu/emu.mak @@ -120,6 +120,7 @@ EMUOBJS = \ $(EMUOBJ)/ui/mainmenu.o \ $(EMUOBJ)/ui/miscmenu.o \ $(EMUOBJ)/ui/barcode.o \ + $(EMUOBJ)/ui/devopt.o \ $(EMUOBJ)/ui/filemngr.o \ $(EMUOBJ)/ui/filesel.o \ $(EMUOBJ)/ui/imgcntrl.o \ @@ -147,7 +148,6 @@ EMUOBJS = \ $(EMUOBJ)/debug/textbuf.o \ $(EMUOBJ)/profiler.o \ $(EMUOBJ)/webengine.o \ - $(OSDOBJ)/osdcore.o \ $(OSDOBJ)/osdnet.o \ $(OSDOBJ)/modules/sound/none.o \ $(OSDOBJ)/modules/debugger/none.o \ diff --git a/src/emu/emuopts.h b/src/emu/emuopts.h index 3b9f4d94aba..880a51a2d09 100644 --- a/src/emu/emuopts.h +++ b/src/emu/emuopts.h @@ -354,10 +354,11 @@ public: const char *main_value(astring &buffer, const char *option) const; const char *sub_value(astring &buffer, const char *name, const char *subname) const; + bool add_slot_options(bool isfirst); + private: // device-specific option handling void add_device_options(bool isfirst); - bool add_slot_options(bool isfirst); void update_slot_options(); // INI parsing helper diff --git a/src/emu/ioport.c b/src/emu/ioport.c index bb3dc164513..17485e4dfdb 100644 --- a/src/emu/ioport.c +++ b/src/emu/ioport.c @@ -99,6 +99,8 @@ #include "uiinput.h" #include "debug/debugcon.h" +#include "osdepend.h" + #include <ctype.h> #include <time.h> diff --git a/src/emu/machine.c b/src/emu/machine.c index 9ab3452e963..d50667f365a 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -106,6 +106,11 @@ static char giant_string_buffer[65536] = { 0 }; // RUNNING MACHINE //************************************************************************** +osd_interface &running_machine::osd() const +{ + return m_manager.osd(); +} + //------------------------------------------------- // running_machine - constructor //------------------------------------------------- diff --git a/src/emu/machine.h b/src/emu/machine.h index 052eada1417..fb813938e05 100644 --- a/src/emu/machine.h +++ b/src/emu/machine.h @@ -19,7 +19,8 @@ #include <time.h> - +// forward declaration instead of osdepend.h +class osd_interface; //************************************************************************** // CONSTANTS @@ -157,7 +158,7 @@ public: const machine_config &config() const { return m_config; } device_t &root_device() const { return m_config.root_device(); } const game_driver &system() const { return m_system; } - osd_interface &osd() const { return m_manager.osd(); } + osd_interface &osd() const; machine_manager &manager() const { return m_manager; } resource_pool &respool() { return m_respool; } device_scheduler &scheduler() { return m_scheduler; } diff --git a/src/emu/machine/atahle.c b/src/emu/machine/atahle.c index ca41368ae0c..9500816c6fa 100644 --- a/src/emu/machine/atahle.c +++ b/src/emu/machine/atahle.c @@ -82,6 +82,7 @@ void ata_hle_device::device_start() m_buffer.resize(sector_length()); save_item(NAME(m_buffer)); save_item(NAME(m_buffer_offset)); + save_item(NAME(m_buffer_size)); save_item(NAME(m_error)); save_item(NAME(m_feature)); save_item(NAME(m_sector_count)); diff --git a/src/emu/machine/idehd.c b/src/emu/machine/idehd.c index f60702ac3bc..0abc90563f7 100644 --- a/src/emu/machine/idehd.c +++ b/src/emu/machine/idehd.c @@ -179,6 +179,10 @@ void ata_mass_storage_device::device_start() ata_hle_device::device_start(); save_item(NAME(m_can_identify_device)); + save_item(NAME(m_num_cylinders)); + save_item(NAME(m_num_sectors)); + save_item(NAME(m_num_heads)); + save_item(NAME(m_cur_lba)); save_item(NAME(m_sectors_until_int)); save_item(NAME(m_master_password_enable)); diff --git a/src/emu/mame.c b/src/emu/mame.c index 827f9ca91df..885af0396fa 100644 --- a/src/emu/mame.c +++ b/src/emu/mame.c @@ -92,6 +92,12 @@ machine_manager* machine_manager::m_manager = NULL; +osd_interface &machine_manager::osd() const +{ + return m_osd; +} + + machine_manager* machine_manager::instance(emu_options &options,osd_interface &osd) { if(!m_manager) diff --git a/src/emu/mame.h b/src/emu/mame.h index 4f2e7747d8b..427d11a1000 100644 --- a/src/emu/mame.h +++ b/src/emu/mame.h @@ -22,6 +22,7 @@ #include "webengine.h" +class osd_interface; //************************************************************************** // CONSTANTS @@ -88,7 +89,7 @@ public: static machine_manager *instance(); ~machine_manager(); - osd_interface &osd() const { return m_osd; } + osd_interface &osd() const; emu_options &options() const { return m_options; } web_engine *web() { return &m_web; } lua_engine *lua() { return &m_lua; } diff --git a/src/emu/netlist/analog/nld_bjt.c b/src/emu/netlist/analog/nld_bjt.c index 2f606fad0ae..1b538dd9d54 100644 --- a/src/emu/netlist/analog/nld_bjt.c +++ b/src/emu/netlist/analog/nld_bjt.c @@ -75,7 +75,7 @@ NETLIB_START(QBJT_switch) connect(m_RB.m_P, m_BC_dummy.m_P); connect(m_RC.m_P, m_BC_dummy.m_N); - save(NAME(m_state_on)); + save(NLNAME(m_state_on)); m_RB.set(netlist().gmin(), 0.0, 0.0); m_RC.set(netlist().gmin(), 0.0, 0.0); diff --git a/src/emu/netlist/analog/nld_ms_direct.h b/src/emu/netlist/analog/nld_ms_direct.h index ed1215ec293..eef61d0b5a6 100644 --- a/src/emu/netlist/analog/nld_ms_direct.h +++ b/src/emu/netlist/analog/nld_ms_direct.h @@ -69,10 +69,16 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::~netlist_matrix_solver_direct_t { //delete[] m_A[k]; } - //delete[] m_last_RHS; + for (int k = 0; k < N(); k++) + { + nl_free(m_terms[k]); + nl_free(m_row_ops[k]); + } + nl_free(m_row_ops[N()]); + //delete[] m_last_RHS; //delete[] m_RHS; - delete[] m_terms; - delete[] m_rails_temp; + nl_free_array(m_terms); + nl_free_array(m_rails_temp); //delete[] m_row_ops; } @@ -452,12 +458,12 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t( , m_dim(size) , m_lp_fact(0) { - m_terms = new terms_t *[N()]; - m_rails_temp = new terms_t[N()]; + m_terms = nl_alloc_array(terms_t *, N()); + m_rails_temp = nl_alloc_array(terms_t, N()); for (int k = 0; k < N(); k++) { - m_terms[k] = new terms_t; + m_terms[k] = nl_alloc(terms_t); m_row_ops[k] = vector_ops_t::create_ops(k); } m_row_ops[N()] = vector_ops_t::create_ops(N()); @@ -469,12 +475,12 @@ netlist_matrix_solver_direct_t<m_N, _storage_N>::netlist_matrix_solver_direct_t( , m_dim(size) , m_lp_fact(0) { - m_terms = new terms_t *[N()]; - m_rails_temp = new terms_t[N()]; + m_terms = nl_alloc_array(terms_t *, N()); + m_rails_temp = nl_alloc_array(terms_t, N()); for (int k = 0; k < N(); k++) { - m_terms[k] = new terms_t; + m_terms[k] = nl_alloc(terms_t); m_row_ops[k] = vector_ops_t::create_ops(k); } m_row_ops[N()] = vector_ops_t::create_ops(N()); diff --git a/src/emu/netlist/analog/nld_solver.c b/src/emu/netlist/analog/nld_solver.c index bef3dcbcd77..6b3d7dbeb18 100644 --- a/src/emu/netlist/analog/nld_solver.c +++ b/src/emu/netlist/analog/nld_solver.c @@ -44,31 +44,31 @@ vector_ops_t *vector_ops_t::create_ops(const int size) switch (size) { case 1: - return new vector_ops_impl_t<1>(); + return nl_alloc(vector_ops_impl_t<1>); case 2: - return new vector_ops_impl_t<2>(); + return nl_alloc(vector_ops_impl_t<2>); case 3: - return new vector_ops_impl_t<3>(); + return nl_alloc(vector_ops_impl_t<3>); case 4: - return new vector_ops_impl_t<4>(); + return nl_alloc(vector_ops_impl_t<4>); case 5: - return new vector_ops_impl_t<5>(); + return nl_alloc(vector_ops_impl_t<5>); case 6: - return new vector_ops_impl_t<6>(); + return nl_alloc(vector_ops_impl_t<6>); case 7: - return new vector_ops_impl_t<7>(); + return nl_alloc(vector_ops_impl_t<7>); case 8: - return new vector_ops_impl_t<8>(); + return nl_alloc(vector_ops_impl_t<8>); case 9: - return new vector_ops_impl_t<9>(); + return nl_alloc(vector_ops_impl_t<9>); case 10: - return new vector_ops_impl_t<10>(); + return nl_alloc(vector_ops_impl_t<10>); case 11: - return new vector_ops_impl_t<11>(); + return nl_alloc(vector_ops_impl_t<11>); case 12: - return new vector_ops_impl_t<12>(); + return nl_alloc(vector_ops_impl_t<12>); default: - return new vector_ops_impl_t<0>(size); + return nl_alloc(vector_ops_impl_t<0>, size); } } @@ -91,8 +91,6 @@ ATTR_COLD void terms_t::set_pointers() m_term[i]->m_Idr1 = &m_Idr[i]; m_other_curanalog[i] = &m_term[i]->m_otherterm->net().as_analog().m_cur_Analog; } - - m_ops = vector_ops_t::create_ops(m_gt.count()); } // ---------------------------------------------------------------------------------------- @@ -112,7 +110,7 @@ ATTR_COLD netlist_matrix_solver_t::netlist_matrix_solver_t(const eSolverType typ ATTR_COLD netlist_matrix_solver_t::~netlist_matrix_solver_t() { for (int i = 0; i < m_inps.count(); i++) - delete m_inps[i]; + global_free(m_inps[i]); } ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets) @@ -176,7 +174,7 @@ ATTR_COLD void netlist_matrix_solver_t::setup(netlist_analog_net_t::list_t &nets if (net_proxy_output == NULL) { - net_proxy_output = new netlist_analog_output_t(); + net_proxy_output = nl_alloc(netlist_analog_output_t); net_proxy_output->init_object(*this, this->name() + "." + pstring::sprintf("m%d", m_inps.count())); m_inps.add(net_proxy_output); net_proxy_output->m_proxied_net = &p->net().as_analog(); @@ -380,7 +378,7 @@ NETLIB_NAME(solver)::~NETLIB_NAME(solver)() while (e != NULL) { netlist_matrix_solver_t * const *en = m_mat_solvers.next(e); - delete *e; + global_free(*e); e = en; } @@ -435,15 +433,16 @@ template <int m_N, int _storage_N> netlist_matrix_solver_t * NETLIB_NAME(solver)::create_solver(int size, const int gs_threshold, const bool use_specific) { if (use_specific && m_N == 1) - return new netlist_matrix_solver_direct1_t(m_params); + return nl_alloc(netlist_matrix_solver_direct1_t, m_params); else if (use_specific && m_N == 2) - return new netlist_matrix_solver_direct2_t(m_params); + return nl_alloc(netlist_matrix_solver_direct2_t, m_params); else { + typedef netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N> solver_N; if (size >= gs_threshold) - return new netlist_matrix_solver_gauss_seidel_t<m_N,_storage_N>(m_params, size); + return nl_alloc(solver_N, m_params, size); else - return new netlist_matrix_solver_direct_t<m_N, _storage_N>(m_params, size); + return nl_alloc(solver_N, m_params, size); } } diff --git a/src/emu/netlist/analog/nld_solver.h b/src/emu/netlist/analog/nld_solver.h index 8aa87025e53..3c17cce0d8c 100644 --- a/src/emu/netlist/analog/nld_solver.h +++ b/src/emu/netlist/analog/nld_solver.h @@ -88,7 +88,7 @@ public: vector_ops_impl_t(int size) : vector_ops_t(size) { - assert(m_N == 0); + nl_assert(m_N == 0); } virtual ~vector_ops_impl_t() {} @@ -155,7 +155,7 @@ class ATTR_ALIGNED(64) terms_t NETLIST_PREVENT_COPYING(terms_t) public: - ATTR_COLD terms_t() : m_railstart(0), m_ops(NULL) + ATTR_COLD terms_t() : m_railstart(0) {} ATTR_COLD void clear() @@ -175,7 +175,6 @@ class ATTR_ALIGNED(64) terms_t ATTR_HOT inline double *go() { return m_go; } ATTR_HOT inline double *Idr() { return m_Idr; } ATTR_HOT inline double **other_curanalog() { return m_other_curanalog; } - ATTR_HOT vector_ops_t *ops() { return m_ops; } ATTR_COLD void set_pointers(); @@ -188,7 +187,6 @@ private: plinearlist_t<double> m_gt; plinearlist_t<double> m_Idr; plinearlist_t<double *> m_other_curanalog; - vector_ops_t * m_ops; }; class netlist_matrix_solver_t : public netlist_device_t diff --git a/src/emu/netlist/devices/net_lib.c b/src/emu/netlist/devices/net_lib.c index b9d6686b964..deb6411a3b0 100644 --- a/src/emu/netlist/devices/net_lib.c +++ b/src/emu/netlist/devices/net_lib.c @@ -49,6 +49,7 @@ #include "net_lib.h" #include "nld_system.h" +#include "../nl_factory.h" NETLIST_START(diode_models) NET_MODEL(".model 1N914 D(Is=2.52n Rs=.568 N=1.752 Cjo=4p M=.4 tt=20n Iave=200m Vpk=75 mfg=OnSemi type=silicon)") @@ -64,24 +65,10 @@ NETLIST_END() #define xstr(s) # s -#define ENTRY1(_nic, _name, _defparam) register_device<_nic>( # _name, xstr(_nic), _defparam ); +#define ENTRY1(_nic, _name, _defparam) factory.register_device<_nic>( # _name, xstr(_nic), _defparam ); #define ENTRY(_nic, _name, _defparam) ENTRY1(NETLIB_NAME(_nic), _name, _defparam) -netlist_factory_t::netlist_factory_t() -{ -} - -netlist_factory_t::~netlist_factory_t() -{ - for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e)) - { - net_device_t_base_factory *p = *e; - delete p; - } - m_list.clear(); -} - -void netlist_factory_t::initialize() +void nl_initialize_factory(netlist_factory_t &factory) { ENTRY(R, RES, "R") ENTRY(POT, POT, "R") @@ -162,39 +149,3 @@ void netlist_factory_t::initialize() ENTRY(NE555_dip, NE555_DIP, "-") } -netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const -{ - for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e)) - { - net_device_t_base_factory *p = *e; - if (strcmp(p->classname(), classname) == 0) - { - netlist_device_t *ret = p->Create(); - return ret; - } - p++; - } - setup.netlist().error("Class %s not found!\n", classname.cstr()); - return NULL; // appease code analysis -} - -netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const -{ - net_device_t_base_factory *f = factory_by_name(name, setup); - return f->Create(); -} - -net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const -{ - for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e)) - { - net_device_t_base_factory *p = *e; - if (strcmp(p->name(), name) == 0) - { - return p; - } - p++; - } - setup.netlist().error("Class %s not found!\n", name.cstr()); - return NULL; // appease code analysis -} diff --git a/src/emu/netlist/devices/net_lib.h b/src/emu/netlist/devices/net_lib.h index 8161f84cf45..f3db97584fe 100644 --- a/src/emu/netlist/devices/net_lib.h +++ b/src/emu/netlist/devices/net_lib.h @@ -99,4 +99,6 @@ NETLIST_EXTERNAL(diode_models); NETLIST_EXTERNAL(bjt_models); +void nl_initialize_factory(netlist_factory_t &factory); + #endif diff --git a/src/emu/netlist/devices/nld_4020.c b/src/emu/netlist/devices/nld_4020.c index 4a477efcff6..a8483ccbe84 100644 --- a/src/emu/netlist/devices/nld_4020.c +++ b/src/emu/netlist/devices/nld_4020.c @@ -51,7 +51,7 @@ NETLIB_START(4020_sub) register_output("Q13", m_Q[12]); register_output("Q14", m_Q[13]); - save(NAME(m_cnt)); + save(NLNAME(m_cnt)); } NETLIB_RESET(4020_sub) diff --git a/src/emu/netlist/devices/nld_74107.c b/src/emu/netlist/devices/nld_74107.c index c5b205150ac..84743900c66 100644 --- a/src/emu/netlist/devices/nld_74107.c +++ b/src/emu/netlist/devices/nld_74107.c @@ -11,9 +11,9 @@ NETLIB_START(74107Asub) register_output("Q", m_Q); register_output("QQ", m_QQ); - save(NAME(m_Q1)); - save(NAME(m_Q2)); - save(NAME(m_F)); + save(NLNAME(m_Q1)); + save(NLNAME(m_Q2)); + save(NLNAME(m_F)); } NETLIB_RESET(74107Asub) diff --git a/src/emu/netlist/devices/nld_74123.c b/src/emu/netlist/devices/nld_74123.c index 2218c06c9b4..e0bd2fc788d 100644 --- a/src/emu/netlist/devices/nld_74123.c +++ b/src/emu/netlist/devices/nld_74123.c @@ -32,9 +32,9 @@ NETLIB_START(74123) connect(m_RN.m_P, m_RP.m_N); connect(m_CV, m_RN.m_P); - save(NAME(m_last_trig)); - save(NAME(m_state)); - save(NAME(m_KP)); + save(NLNAME(m_last_trig)); + save(NLNAME(m_state)); + save(NLNAME(m_KP)); m_KP = 1.0 / (1.0 + exp(m_K.Value())); } diff --git a/src/emu/netlist/devices/nld_74153.c b/src/emu/netlist/devices/nld_74153.c index 94c51fa85a8..461d388fcf9 100644 --- a/src/emu/netlist/devices/nld_74153.c +++ b/src/emu/netlist/devices/nld_74153.c @@ -22,7 +22,7 @@ NETLIB_START(74153sub) m_chan = 0; - save(NAME(m_chan)); + save(NLNAME(m_chan)); } NETLIB_RESET(74153sub) diff --git a/src/emu/netlist/devices/nld_7448.c b/src/emu/netlist/devices/nld_7448.c index 59b00935240..03202eb8724 100644 --- a/src/emu/netlist/devices/nld_7448.c +++ b/src/emu/netlist/devices/nld_7448.c @@ -78,7 +78,7 @@ NETLIB_START(7448_sub) register_output("f", m_f); register_output("g", m_g); - save(NAME(m_state)); + save(NLNAME(m_state)); } NETLIB_RESET(7448_sub) @@ -98,7 +98,7 @@ NETLIB_UPDATE(7448_sub) NETLIB_FUNC_VOID(7448_sub, update_outputs, (UINT8 v)) { - assert(v<16); + nl_assert(v<16); if (v != m_state) { // max transfer time is 100 NS */ diff --git a/src/emu/netlist/devices/nld_7474.c b/src/emu/netlist/devices/nld_7474.c index 23e871fbbfc..a56207dc8f9 100644 --- a/src/emu/netlist/devices/nld_7474.c +++ b/src/emu/netlist/devices/nld_7474.c @@ -76,7 +76,7 @@ NETLIB_START(7474sub) register_output("Q", m_Q); register_output("QQ", m_QQ); - save(NAME(m_nextD)); + save(NLNAME(m_nextD)); } NETLIB_RESET(7474sub) diff --git a/src/emu/netlist/devices/nld_7483.c b/src/emu/netlist/devices/nld_7483.c index 8aa36e80b17..b0f2478e895 100644 --- a/src/emu/netlist/devices/nld_7483.c +++ b/src/emu/netlist/devices/nld_7483.c @@ -23,7 +23,7 @@ NETLIB_START(7483) register_output("S4", m_S4); register_output("C4", m_C4); - save(NAME(m_lastr)); + save(NLNAME(m_lastr)); } NETLIB_RESET(7483) diff --git a/src/emu/netlist/devices/nld_7490.c b/src/emu/netlist/devices/nld_7490.c index ab66fd99c8d..26c8e147904 100644 --- a/src/emu/netlist/devices/nld_7490.c +++ b/src/emu/netlist/devices/nld_7490.c @@ -19,9 +19,9 @@ NETLIB_START(7490) register_output("QC", m_Q[2]); register_output("QD", m_Q[3]); - save(NAME(m_cnt)); - save(NAME(m_last_A)); - save(NAME(m_last_B)); + save(NLNAME(m_cnt)); + save(NLNAME(m_last_A)); + save(NLNAME(m_last_B)); } diff --git a/src/emu/netlist/devices/nld_7493.c b/src/emu/netlist/devices/nld_7493.c index dd37085f57b..408ded68db0 100644 --- a/src/emu/netlist/devices/nld_7493.c +++ b/src/emu/netlist/devices/nld_7493.c @@ -40,7 +40,7 @@ NETLIB_START(7493ff) register_input("CLK", m_I); register_output("Q", m_Q); - save(NAME(m_reset)); + save(NLNAME(m_reset)); } NETLIB_RESET(7493ff) diff --git a/src/emu/netlist/devices/nld_74ls629.c b/src/emu/netlist/devices/nld_74ls629.c index 73b53718a9a..5a9a02e3852 100644 --- a/src/emu/netlist/devices/nld_74ls629.c +++ b/src/emu/netlist/devices/nld_74ls629.c @@ -49,9 +49,9 @@ NETLIB_START(SN74LS629clk) reset(); - save(NAME(m_enableq)); - save(NAME(m_inc)); - save(NAME(m_out)); + save(NLNAME(m_enableq)); + save(NLNAME(m_inc)); + save(NLNAME(m_out)); } NETLIB_RESET(SN74LS629clk) diff --git a/src/emu/netlist/devices/nld_9316.c b/src/emu/netlist/devices/nld_9316.c index 8ab89b8d123..017ee599f26 100644 --- a/src/emu/netlist/devices/nld_9316.c +++ b/src/emu/netlist/devices/nld_9316.c @@ -73,9 +73,9 @@ NETLIB_START(9316_sub) register_output("QD", m_QD); register_output("RC", m_RC); - save(NAME(m_cnt.ref())); - save(NAME(m_loadq.ref())); - save(NAME(m_ent.ref())); + save(NLNAME(m_cnt.ref())); + save(NLNAME(m_loadq.ref())); + save(NLNAME(m_ent.ref())); } NETLIB_RESET(9316_sub) diff --git a/src/emu/netlist/devices/nld_ne555.c b/src/emu/netlist/devices/nld_ne555.c index 55712f410f0..31b69d60996 100644 --- a/src/emu/netlist/devices/nld_ne555.c +++ b/src/emu/netlist/devices/nld_ne555.c @@ -42,7 +42,7 @@ NETLIB_START(NE555) connect(m_R2.m_N, m_R3.m_P); connect(m_RDIS.m_N, m_R3.m_N); - save(NAME(m_last_out)); + save(NLNAME(m_last_out)); } NETLIB_RESET(NE555) diff --git a/src/emu/netlist/devices/nld_signal.h b/src/emu/netlist/devices/nld_signal.h index 3284ed6fbde..2f703e955da 100644 --- a/src/emu/netlist/devices/nld_signal.h +++ b/src/emu/netlist/devices/nld_signal.h @@ -44,7 +44,7 @@ public: { register_input(sIN[i], m_i[i]); } - save(NAME(m_active)); + save(NLNAME(m_active)); } ATTR_COLD void reset() @@ -118,7 +118,7 @@ public: register_input("A", m_i[0]); register_input("B", m_i[1]); - save(NAME(m_active)); + save(NLNAME(m_active)); } ATTR_COLD void reset() diff --git a/src/emu/netlist/devices/nld_system.h b/src/emu/netlist/devices/nld_system.h index 47ca470d197..16f61cd35fa 100644 --- a/src/emu/netlist/devices/nld_system.h +++ b/src/emu/netlist/devices/nld_system.h @@ -198,7 +198,7 @@ public: ATTR_COLD nld_a_to_d_proxy(netlist_input_t &in_proxied) : netlist_device_t() { - assert(in_proxied.family() == LOGIC); + nl_assert(in_proxied.family() == LOGIC); m_I.m_logic_family = in_proxied.m_logic_family; } @@ -240,7 +240,7 @@ public: ATTR_COLD nld_base_d_to_a_proxy(netlist_output_t &out_proxied) : netlist_device_t() { - assert(out_proxied.family() == LOGIC); + nl_assert(out_proxied.family() == LOGIC); m_logic_family = out_proxied.m_logic_family; } diff --git a/src/emu/netlist/devices/nld_truthtable.h b/src/emu/netlist/devices/nld_truthtable.h index 2f9e5ed1dbe..be5d0703445 100644 --- a/src/emu/netlist/devices/nld_truthtable.h +++ b/src/emu/netlist/devices/nld_truthtable.h @@ -50,11 +50,11 @@ public: { nl_util::pstring_list io = nl_util::split(ttline,"|"); // checks - assert(io.count() == 2); + nl_assert(io.count() == 2); nl_util::pstring_list inout = nl_util::split(io[0], ","); - assert(inout.count() == m_num_bits); + nl_assert(inout.count() == m_num_bits); nl_util::pstring_list out = nl_util::split(io[1], ","); - assert(out.count() == m_NO); + nl_assert(out.count() == m_NO); for (int i=0; i < m_NI; i++) { @@ -133,13 +133,13 @@ public: { nl_util::pstring_list io = nl_util::split(ttline,"|"); // checks - assert(io.count() == 3); + nl_assert(io.count() == 3); nl_util::pstring_list inout = nl_util::split(io[0], ","); - assert(inout.count() == m_num_bits); + nl_assert(inout.count() == m_num_bits); nl_util::pstring_list out = nl_util::split(io[1], ","); - assert(out.count() == m_NO); + nl_assert(out.count() == m_NO); nl_util::pstring_list times = nl_util::split(io[2], ","); - assert(times.count() == m_NO); + nl_assert(times.count() == m_NO); UINT16 val = 0; UINT8 tindex[m_NO]; diff --git a/src/emu/netlist/netlist.mak b/src/emu/netlist/netlist.mak index e5140e74c67..b3d1c7a4817 100644 --- a/src/emu/netlist/netlist.mak +++ b/src/emu/netlist/netlist.mak @@ -26,6 +26,7 @@ NETLISTOBJS+= \ $(NETLISTOBJ)/nl_base.o \ $(NETLISTOBJ)/nl_parser.o \ $(NETLISTOBJ)/nl_setup.o \ + $(NETLISTOBJ)/nl_factory.o \ $(NETLISTOBJ)/pstring.o \ $(NETLISTOBJ)/pstate.o \ $(NETLISTOBJ)/analog/nld_bjt.o \ diff --git a/src/emu/netlist/nl_base.c b/src/emu/netlist/nl_base.c index 53873fb1fb0..06eed63bffd 100644 --- a/src/emu/netlist/nl_base.c +++ b/src/emu/netlist/nl_base.c @@ -9,6 +9,8 @@ #include "pstring.h" #include "nl_util.h" +#include <stdlib.h> // FIXME: only included for atof + const netlist_time netlist_time::zero = netlist_time::from_raw(0); netlist_logic_family_desc_t netlist_family_TTL = @@ -150,7 +152,7 @@ netlist_base_t::~netlist_base_t() { if (!m_nets[i]->isRailNet()) { - delete m_nets[i]; + global_free(m_nets[i]); } } @@ -164,7 +166,7 @@ netlist_base_t::~netlist_base_t() ATTR_COLD void netlist_base_t::save_register() { save(static_cast<pstate_callback_t &>(m_queue), "m_queue"); - save(NAME(m_time)); + save(NLNAME(m_time)); netlist_object_t::save_register(); } @@ -529,7 +531,7 @@ ATTR_HOT void netlist_net_t::dec_active(netlist_core_terminal_t &term) ATTR_COLD void netlist_net_t::register_railterminal(netlist_output_t &mr) { - assert(m_railterminal == NULL); + nl_assert(m_railterminal == NULL); m_railterminal = &mr; } @@ -545,12 +547,12 @@ ATTR_COLD void netlist_net_t::rebuild_list() ATTR_COLD void netlist_net_t::save_register() { - save(NAME(m_time)); - save(NAME(m_active)); - save(NAME(m_in_queue)); - save(NAME(m_cur_Analog)); - save(NAME(m_cur_Q)); - save(NAME(m_new_Q)); + save(NLNAME(m_time)); + save(NLNAME(m_active)); + save(NLNAME(m_in_queue)); + save(NLNAME(m_cur_Analog)); + save(NLNAME(m_cur_Q)); + save(NLNAME(m_new_Q)); netlist_object_t::save_register(); } @@ -569,7 +571,7 @@ ATTR_HOT ATTR_ALIGN static inline void update_dev(const netlist_core_terminal_t ATTR_HOT ATTR_ALIGN inline void netlist_net_t::update_devs() { //assert(m_num_cons != 0); - assert(this->isRailNet()); + nl_assert(this->isRailNet()); const UINT32 masks[4] = { 1, 5, 3, 1 }; const UINT32 mask = masks[ (m_cur_Q << 1) | m_new_Q ]; @@ -707,8 +709,8 @@ ATTR_COLD void netlist_analog_net_t::reset() ATTR_COLD void netlist_analog_net_t::save_register() { - save(NAME(m_DD_n_m_1)); - save(NAME(m_h_n_m_1)); + save(NLNAME(m_DD_n_m_1)); + save(NLNAME(m_h_n_m_1)); netlist_net_t::save_register(); } @@ -803,9 +805,9 @@ ATTR_COLD void netlist_terminal_t::reset() ATTR_COLD void netlist_terminal_t::save_register() { - save(NAME(m_Idr1)); - save(NAME(m_go1)); - save(NAME(m_gt1)); + save(NLNAME(m_Idr1)); + save(NLNAME(m_go1)); + save(NLNAME(m_gt1)); netlist_core_terminal_t::save_register(); } diff --git a/src/emu/netlist/nl_base.h b/src/emu/netlist/nl_base.h index 59803356a9c..8ee96c8f184 100644 --- a/src/emu/netlist/nl_base.h +++ b/src/emu/netlist/nl_base.h @@ -444,7 +444,7 @@ public: ATTR_HOT inline const state_e state() const { return m_state; } ATTR_HOT inline void set_state(const state_e astate) { - assert(astate != STATE_NONEX); + nl_assert(astate != STATE_NONEX); m_state = astate; } @@ -453,7 +453,7 @@ public: protected: ATTR_COLD virtual void save_register() { - save(NAME(m_state)); + save(NLNAME(m_state)); netlist_owned_object_t::save_register(); } @@ -710,7 +710,7 @@ public: */ ATTR_COLD inline netlist_sig_t &Q_state_ptr() { - assert(family() == LOGIC); + nl_assert(family() == LOGIC); return m_cur_Q; } @@ -738,15 +738,15 @@ public: ATTR_HOT inline const double Q_Analog() const { - //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); - assert(family() == ANALOG); + //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); + nl_assert(family() == ANALOG); return m_cur_Analog; } ATTR_COLD inline double &Q_Analog_state_ptr() { - //assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); - assert(family() == ANALOG); + //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); + nl_assert(family() == ANALOG); return m_cur_Analog; } @@ -883,7 +883,7 @@ public: protected: ATTR_COLD virtual void save_register() { - save(NAME(m_param)); + save(NLNAME(m_param)); netlist_param_t::save_register(); } @@ -905,7 +905,7 @@ public: protected: ATTR_COLD virtual void save_register() { - save(NAME(m_param)); + save(NLNAME(m_param)); netlist_param_t::save_register(); } @@ -988,7 +988,7 @@ public: ATTR_HOT inline const netlist_sig_t INPLOGIC(const netlist_logic_input_t &inp) const { - assert(inp.state() != netlist_input_t::STATE_INP_PASSIVE); + nl_assert(inp.state() != netlist_input_t::STATE_INP_PASSIVE); return inp.Q(); } @@ -1262,25 +1262,25 @@ ATTR_HOT inline void netlist_param_double_t::setTo(const double param) ATTR_HOT inline netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() { - assert(family() == LOGIC); + nl_assert(family() == LOGIC); return static_cast<netlist_logic_net_t &>(*this); } ATTR_HOT inline const netlist_logic_net_t & RESTRICT netlist_net_t::as_logic() const { - assert(family() == LOGIC); + nl_assert(family() == LOGIC); return static_cast<const netlist_logic_net_t &>(*this); } ATTR_HOT inline netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() { - assert(family() == ANALOG); + nl_assert(family() == ANALOG); return static_cast<netlist_analog_net_t &>(*this); } ATTR_HOT inline const netlist_analog_net_t & RESTRICT netlist_net_t::as_analog() const { - assert(family() == ANALOG); + nl_assert(family() == ANALOG); return static_cast<const netlist_analog_net_t &>(*this); } @@ -1370,80 +1370,4 @@ ATTR_HOT inline void netlist_analog_output_t::set_Q(const double newQ) } } - -// ----------------------------------------------------------------------------- -// net_dev class factory -// ----------------------------------------------------------------------------- - -class net_device_t_base_factory -{ - NETLIST_PREVENT_COPYING(net_device_t_base_factory) -public: - ATTR_COLD net_device_t_base_factory(const pstring &name, const pstring &classname, - const pstring &def_param) - : m_name(name), m_classname(classname), m_def_param(def_param) - {} - - ATTR_COLD virtual ~net_device_t_base_factory() {} - - ATTR_COLD virtual netlist_device_t *Create() const = 0; - - ATTR_COLD const pstring &name() const { return m_name; } - ATTR_COLD const pstring &classname() const { return m_classname; } - ATTR_COLD const pstring ¶m_desc() const { return m_def_param; } - ATTR_COLD const nl_util::pstring_list term_param_list(); - ATTR_COLD const nl_util::pstring_list def_params(); - -protected: - pstring m_name; /* device name */ - pstring m_classname; /* device class name */ - pstring m_def_param; /* default parameter */ -}; - -template <class C> -class net_device_t_factory : public net_device_t_base_factory -{ - NETLIST_PREVENT_COPYING(net_device_t_factory) -public: - ATTR_COLD net_device_t_factory(const pstring &name, const pstring &classname, - const pstring &def_param) - : net_device_t_base_factory(name, classname, def_param) { } - - ATTR_COLD netlist_device_t *Create() const - { - netlist_device_t *r = new C(); - //r->init(setup, name); - return r; - } -}; - -class netlist_factory_t -{ -public: - typedef plinearlist_t<net_device_t_base_factory *> list_t; - - ATTR_COLD netlist_factory_t(); - ATTR_COLD ~netlist_factory_t(); - - ATTR_COLD void initialize(); - - template<class _C> - ATTR_COLD void register_device(const pstring &name, const pstring &classname, - const pstring &def_param) - { - m_list.add(new net_device_t_factory< _C >(name, classname, def_param) ); - } - - ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const; - ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const; - ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const; - - const list_t &list() { return m_list; } - -private: - list_t m_list; - -}; - - #endif /* NLBASE_H_ */ diff --git a/src/emu/netlist/nl_config.h b/src/emu/netlist/nl_config.h index 972094ae324..3977c703073 100644 --- a/src/emu/netlist/nl_config.h +++ b/src/emu/netlist/nl_config.h @@ -10,7 +10,11 @@ /* FIXME: at some time, make it compile on it's own */ -#include "emu.h" +#include "osdcore.h" +#include "corealloc.h" +#include <math.h> +#include <exception> +#include <typeinfo> //============================================================ // SETUP @@ -102,6 +106,57 @@ #define end_timing(v) do { } while (0) #endif +// this macro passes an item followed by a string version of itself as two consecutive parameters +#define NLNAME(x) x, #x + +//============================================================ +// Exceptions +//============================================================ + +// emu_fatalerror is a generic fatal exception that provides an error string +class nl_fatalerror : public std::exception +{ +public: + nl_fatalerror(const char *format, ...) ATTR_PRINTF(2,3) + { + char text[1024]; + va_list ap; + va_start(ap, format); + vsprintf(text, format, ap); + va_end(ap); + osd_printf_error("%s\n", text); + } + nl_fatalerror(const char *format, va_list ap) + { + char text[1024]; + vsprintf(text, format, ap); + osd_printf_error("%s\n", text); + } +}; + +//============================================================ +// Memory allocation +//============================================================ + +#define nl_alloc(T, ...) global_alloc(T(__VA_ARGS__)) +#define nl_alloc_array(T, N) global_alloc_array(T, N) + +#define nl_free(_ptr) global_free(_ptr) +#define nl_free_array(_ptr) global_free_array(_ptr) + + +//============================================================ +// Asserts +//============================================================ + +#ifdef MAME_DEBUG +#define nl_assert(x) do { if (!(x)) throw nl_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) +#define nl_assert_always(x, msg) do { if (!(x)) throw nl_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) +#else +#define nl_assert(x) do { } while (0) +//#define assert_always(x, msg) do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0) +#define nl_assert_always(x, msg) do { } while (0) +#endif //============================================================ // Compiling standalone @@ -110,7 +165,7 @@ // Compiling without mame ? #ifndef ATTR_HOT -//#warning ATTR_HOT not defined +#warning ATTR_HOT not defined // standard C includes #include <math.h> @@ -132,9 +187,6 @@ #define UNEXPECTED #define ATTR_UNUSED __attribute__((__unused__)) -// this macro passes an item followed by a string version of itself as two consecutive parameters -#define NAME(x) x, #x - /* 8-bit values */ typedef unsigned char UINT8; typedef signed char INT8; @@ -160,15 +212,6 @@ __extension__ typedef signed long long INT64; #endif #endif -#ifdef MAME_DEBUG -#define assert(x) do { if (!(x)) throw emu_fatalerror("assert: %s:%d: %s", __FILE__, __LINE__, #x); } while (0) -#define assert_always(x, msg) do { if (!(x)) throw emu_fatalerror("Fatal error: %s\nCaused by assert: %s:%d: %s", msg, __FILE__, __LINE__, #x); } while (0) -#else -#define assert(x) do { } while (0) -//#define assert_always(x, msg) do { if (!(x)) throw emu_fatalerror("Fatal error: %s (%s:%d)", msg, __FILE__, __LINE__); } while (0) -#define assert_always(x, msg) do { } while (0) -#endif - /* U64 and S64 are used to wrap long integer constants. */ #if defined(__GNUC__) || defined(_MSC_VER) #define U64(val) val##ULL diff --git a/src/emu/netlist/nl_dice_compat.h b/src/emu/netlist/nl_dice_compat.h index 6fbede6d453..e4e8c28add9 100644 --- a/src/emu/netlist/nl_dice_compat.h +++ b/src/emu/netlist/nl_dice_compat.h @@ -13,7 +13,7 @@ * -------------------------------------------------------------------- */ //#define CHIP(_n, _t) netlist.register_dev(NET_NEW(_t ## _dip), _n); -#define CHIP(_n, _t) setup.register_dev( new nld_ ## _t ## _dip(), _n); +#define CHIP(_n, _t) setup.register_dev( nL_alloc(nld_ ## _t ## _dip()), _n); #define CONNECTION( ... ) CONNECTIONY( CONNECTIONX( __VA_ARGS__ ) ) #define CONNECTIONY(_a) _a diff --git a/src/emu/netlist/nl_factory.c b/src/emu/netlist/nl_factory.c new file mode 100644 index 00000000000..dc097c53069 --- /dev/null +++ b/src/emu/netlist/nl_factory.c @@ -0,0 +1,102 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/*************************************************************************** + + nl_factory.c + + Discrete netlist implementation. + +**************************************************************************** + + Couriersud reserves the right to license the code under a less restrictive + license going forward. + + Copyright Nicola Salmoria and the MAME team + All rights reserved. + + Redistribution and use of this code or any derivative works are permitted + provided that the following conditions are met: + + * Redistributions may not be sold, nor may they be used in a commercial + product or activity. + + * Redistributions that are modified from the original source must include the + complete source code, including the source code for all components used by a + binary built from the modified sources. However, as a special exception, the + source code distributed need not include anything that is normally distributed + (in either source or binary form) with the major components (compiler, kernel, + and so on) of the operating system on which the executable runs, unless that + component itself accompanies the executable. + + * Redistributions must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + + +****************************************************************************/ + +#include "nl_factory.h" +#include "nl_setup.h" + +netlist_factory_t::netlist_factory_t() +{ +} + +netlist_factory_t::~netlist_factory_t() +{ + for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e)) + { + net_device_t_base_factory *p = *e; + global_free(p); + } + m_list.clear(); +} + +netlist_device_t *netlist_factory_t::new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const +{ + for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e)) + { + net_device_t_base_factory *p = *e; + if (strcmp(p->classname(), classname) == 0) + { + netlist_device_t *ret = p->Create(); + return ret; + } + p++; + } + setup.netlist().error("Class %s not found!\n", classname.cstr()); + return NULL; // appease code analysis +} + +netlist_device_t *netlist_factory_t::new_device_by_name(const pstring &name, netlist_setup_t &setup) const +{ + net_device_t_base_factory *f = factory_by_name(name, setup); + return f->Create(); +} + +net_device_t_base_factory * netlist_factory_t::factory_by_name(const pstring &name, netlist_setup_t &setup) const +{ + for (net_device_t_base_factory * const *e = m_list.first(); e != NULL; e = m_list.next(e)) + { + net_device_t_base_factory *p = *e; + if (strcmp(p->name(), name) == 0) + { + return p; + } + p++; + } + setup.netlist().error("Class %s not found!\n", name.cstr()); + return NULL; // appease code analysis +} diff --git a/src/emu/netlist/nl_factory.h b/src/emu/netlist/nl_factory.h new file mode 100644 index 00000000000..90b79ae9b45 --- /dev/null +++ b/src/emu/netlist/nl_factory.h @@ -0,0 +1,95 @@ +// license:GPL-2.0+ +// copyright-holders:Couriersud +/* + * nl_factory.h + * + * + */ + +#ifndef NLFACTORY_H_ +#define NLFACTORY_H_ + +#include "nl_config.h" +#include "plists.h" +#include "nl_base.h" +#if 0 +#include "nl_time.h" +#include "nl_util.h" +#include "pstate.h" +#endif +#include "pstring.h" + +// ----------------------------------------------------------------------------- +// net_dev class factory +// ----------------------------------------------------------------------------- + +class net_device_t_base_factory +{ + NETLIST_PREVENT_COPYING(net_device_t_base_factory) +public: + ATTR_COLD net_device_t_base_factory(const pstring &name, const pstring &classname, + const pstring &def_param) + : m_name(name), m_classname(classname), m_def_param(def_param) + {} + + ATTR_COLD virtual ~net_device_t_base_factory() {} + + ATTR_COLD virtual netlist_device_t *Create() const = 0; + + ATTR_COLD const pstring &name() const { return m_name; } + ATTR_COLD const pstring &classname() const { return m_classname; } + ATTR_COLD const pstring ¶m_desc() const { return m_def_param; } + ATTR_COLD const nl_util::pstring_list term_param_list(); + ATTR_COLD const nl_util::pstring_list def_params(); + +protected: + pstring m_name; /* device name */ + pstring m_classname; /* device class name */ + pstring m_def_param; /* default parameter */ +}; + +template <class C> +class net_device_t_factory : public net_device_t_base_factory +{ + NETLIST_PREVENT_COPYING(net_device_t_factory) +public: + ATTR_COLD net_device_t_factory(const pstring &name, const pstring &classname, + const pstring &def_param) + : net_device_t_base_factory(name, classname, def_param) { } + + ATTR_COLD netlist_device_t *Create() const + { + netlist_device_t *r = nl_alloc(C); + //r->init(setup, name); + return r; + } +}; + +class netlist_factory_t +{ +public: + typedef plinearlist_t<net_device_t_base_factory *> list_t; + + ATTR_COLD netlist_factory_t(); + ATTR_COLD ~netlist_factory_t(); + + template<class _C> + ATTR_COLD void register_device(const pstring &name, const pstring &classname, + const pstring &def_param) + { + m_list.add(nl_alloc(net_device_t_factory< _C >, name, classname, def_param)); + } + + ATTR_COLD netlist_device_t *new_device_by_classname(const pstring &classname, netlist_setup_t &setup) const; + ATTR_COLD netlist_device_t *new_device_by_name(const pstring &name, netlist_setup_t &setup) const; + ATTR_COLD net_device_t_base_factory * factory_by_name(const pstring &name, netlist_setup_t &setup) const; + + const list_t &list() { return m_list; } + +private: + list_t m_list; + +}; + + +#endif /* NLFACTORY_H_ */ diff --git a/src/emu/netlist/nl_lists.h b/src/emu/netlist/nl_lists.h index 67b398503d6..ea2cf597e1b 100644 --- a/src/emu/netlist/nl_lists.h +++ b/src/emu/netlist/nl_lists.h @@ -59,7 +59,7 @@ public: } *i = e; inc_stat(m_prof_sort); - assert(m_end - m_list < _Size); + nl_assert(m_end - m_list < _Size); } ATTR_HOT inline const entry_t *pop() diff --git a/src/emu/netlist/nl_setup.c b/src/emu/netlist/nl_setup.c index 49e8167386e..95f62470944 100644 --- a/src/emu/netlist/nl_setup.c +++ b/src/emu/netlist/nl_setup.c @@ -14,6 +14,9 @@ #include "analog/nld_solver.h" #include "analog/nld_twoterm.h" +//FIXME: we need a nl_getenv +#include <stdlib.h> + static NETLIST_START(base) TTL_INPUT(ttlhigh, 1) TTL_INPUT(ttllow, 0) @@ -38,7 +41,7 @@ netlist_setup_t::netlist_setup_t(netlist_base_t &netlist) void netlist_setup_t::init() { - m_factory.initialize(); + nl_initialize_factory(factory()); NETLIST_NAME(base)(*this); } @@ -378,7 +381,7 @@ netlist_param_t *netlist_setup_t::find_param(const pstring ¶m_in, bool requi nld_base_d_to_a_proxy *netlist_setup_t::get_d_a_proxy(netlist_output_t &out) { - assert(out.isFamily(netlist_terminal_t::LOGIC)); + nl_assert(out.isFamily(netlist_terminal_t::LOGIC)); //printf("proxy for %s\n", out.name().cstr());; netlist_logic_output_t &out_cast = dynamic_cast<netlist_logic_output_t &>(out); @@ -387,7 +390,7 @@ nld_base_d_to_a_proxy *netlist_setup_t::get_d_a_proxy(netlist_output_t &out) if (proxy == NULL) { // create a new one ... - proxy = new nld_d_to_a_proxy(out); + proxy = nl_alloc(nld_d_to_a_proxy ,out); pstring x = pstring::sprintf("proxy_da_%s_%d", out.name().cstr(), m_proxy_cnt); m_proxy_cnt++; @@ -416,7 +419,7 @@ void netlist_setup_t::connect_input_output(netlist_input_t &in, netlist_output_t { if (out.isFamily(netlist_terminal_t::ANALOG) && in.isFamily(netlist_terminal_t::LOGIC)) { - nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(in); + nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, in); pstring x = pstring::sprintf("proxy_ad_%s_%d", in.name().cstr(), m_proxy_cnt); m_proxy_cnt++; @@ -452,7 +455,7 @@ void netlist_setup_t::connect_terminal_input(netlist_terminal_t &term, netlist_i else if (inp.isFamily(netlist_terminal_t::LOGIC)) { NL_VERBOSE_OUT(("connect_terminal_input: connecting proxy\n")); - nld_a_to_d_proxy *proxy = new nld_a_to_d_proxy(inp); + nld_a_to_d_proxy *proxy = nl_alloc(nld_a_to_d_proxy, inp); pstring x = pstring::sprintf("proxy_ad_%s_%d", inp.name().cstr(), m_proxy_cnt); m_proxy_cnt++; @@ -499,8 +502,8 @@ void netlist_setup_t::connect_terminal_output(netlist_terminal_t &in, netlist_ou void netlist_setup_t::connect_terminals(netlist_core_terminal_t &t1, netlist_core_terminal_t &t2) { - //assert(in.isType(netlist_terminal_t::TERMINAL)); - //assert(out.isType(netlist_terminal_t::TERMINAL)); + //nl_assert(in.isType(netlist_terminal_t::TERMINAL)); + //nl_assert(out.isType(netlist_terminal_t::TERMINAL)); if (t1.has_net() && t2.has_net()) { @@ -520,7 +523,7 @@ void netlist_setup_t::connect_terminals(netlist_core_terminal_t &t1, netlist_cor else { NL_VERBOSE_OUT(("adding net ...\n")); - netlist_analog_net_t *anet = new netlist_analog_net_t(); + netlist_analog_net_t *anet = nl_alloc(netlist_analog_net_t); t1.set_net(*anet); //m_netlist.solver()->m_nets.add(anet); // FIXME: Nets should have a unique name @@ -683,6 +686,7 @@ void netlist_setup_t::resolve_inputs() void netlist_setup_t::start_devices() { + //FIXME: we need a nl_getenv if (getenv("NL_LOGS")) { NL_VERBOSE_OUT(("Creating dynamic logs ...\n")); diff --git a/src/emu/netlist/nl_setup.h b/src/emu/netlist/nl_setup.h index 9a6028c4848..d437755af11 100644 --- a/src/emu/netlist/nl_setup.h +++ b/src/emu/netlist/nl_setup.h @@ -11,6 +11,7 @@ #define NLSETUP_H_ #include "nl_base.h" +#include "nl_factory.h" //============================================================ // MACROS / inline netlist definitions diff --git a/src/emu/netlist/plists.h b/src/emu/netlist/plists.h index 17b90d538ae..9493317b709 100644 --- a/src/emu/netlist/plists.h +++ b/src/emu/netlist/plists.h @@ -28,7 +28,7 @@ public: if (m_num_elements == 0) m_list = NULL; else - m_list = new _ListClass[m_num_elements]; + m_list = nl_alloc_array(_ListClass, m_num_elements); m_count = 0; } @@ -38,7 +38,7 @@ public: if (m_num_elements == 0) m_list = NULL; else - m_list = new _ListClass[m_num_elements]; + m_list = nl_alloc_array(_ListClass, m_num_elements); m_count = 0; for (int i=0; i<rhs.count(); i++) { @@ -60,7 +60,7 @@ public: ATTR_COLD ~plinearlist_t() { if (m_list != NULL) - delete[] m_list; + nl_free_array(m_list); m_list = NULL; } @@ -108,7 +108,7 @@ public: ATTR_HOT inline void remove_at(const int pos) { - assert((pos>=0) && (pos<m_count)); + nl_assert((pos>=0) && (pos<m_count)); m_count--; for (int i = pos; i < m_count; i++) { @@ -118,8 +118,8 @@ public: ATTR_HOT inline void swap(const int pos1, const int pos2) { - assert((pos1>=0) && (pos1<m_count)); - assert((pos2>=0) && (pos2<m_count)); + nl_assert((pos1>=0) && (pos1<m_count)); + nl_assert((pos2>=0) && (pos2<m_count)); _ListClass tmp = m_list[pos1]; m_list[pos1] = m_list[pos2]; m_list[pos2] =tmp; @@ -157,18 +157,18 @@ public: { for (_ListClass *i = m_list; i < m_list + m_count; i++) { - delete *i; + nl_free(*i); } clear(); } private: - ATTR_HOT inline void resize(const int new_size) + ATTR_COLD void resize(const int new_size) { int cnt = count(); if (new_size > 0) { - _ListClass *m_new = new _ListClass[new_size]; + _ListClass *m_new = nl_alloc_array(_ListClass, new_size); _ListClass *pd = m_new; if (cnt > new_size) @@ -176,14 +176,14 @@ private: for (_ListClass *ps = m_list; ps < m_list + cnt; ps++, pd++) *pd = *ps; if (m_list != NULL) - delete[] m_list; + nl_free_array(m_list); m_list = m_new; m_count = cnt; } else { if (m_list != NULL) - delete[] m_list; + nl_free_array(m_list); m_list = NULL; m_count = 0; } @@ -331,7 +331,7 @@ public: } p = p->m_next; } - assert_always(false, "element not found"); + nl_assert_always(false, "element not found"); } } @@ -357,7 +357,7 @@ public: _ListClass **p = &m_head; while (*p != &elem) { - assert(*p != NULL); + nl_assert(*p != NULL); p = &((*p)->m_next); } (*p) = elem.m_next; diff --git a/src/emu/netlist/pstate.c b/src/emu/netlist/pstate.c index 6dfa6c62527..5b50b6dbceb 100644 --- a/src/emu/netlist/pstate.c +++ b/src/emu/netlist/pstate.c @@ -27,7 +27,7 @@ ATTR_COLD void pstate_manager_t::save_state_ptr(const pstring &stname, const pst }; NL_VERBOSE_OUT(("SAVE: <%s> %s(%d) %p\n", fullname.cstr(), ts[dt].cstr(), size, ptr)); - pstate_entry_t *p = new pstate_entry_t(stname, dt, owner, size, count, ptr, is_ptr); + pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, dt, owner, size, count, ptr, is_ptr); m_save.add(p); } @@ -60,3 +60,11 @@ ATTR_COLD void pstate_manager_t::post_load() if (m_save[i]->m_dt == DT_CUSTOM) m_save[i]->m_callback->on_post_load(); } + +template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname) +{ + //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state); + pstate_entry_t *p = nl_alloc(pstate_entry_t, stname, owner, &state); + m_save.add(p); + state.register_state(*this, stname); +} diff --git a/src/emu/netlist/pstate.h b/src/emu/netlist/pstate.h index 59f91bc59a1..8c7b7763ed9 100644 --- a/src/emu/netlist/pstate.h +++ b/src/emu/netlist/pstate.h @@ -145,13 +145,7 @@ private: pstate_entry_t::list_t m_save; }; -template<> ATTR_COLD inline void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname) -{ - //save_state_ptr(stname, DT_CUSTOM, 0, 1, &state); - pstate_entry_t *p = new pstate_entry_t(stname, owner, &state); - m_save.add(p); - state.register_state(*this, stname); -} +template<> ATTR_COLD void pstate_manager_t::save_item(pstate_callback_t &state, const void *owner, const pstring &stname); template<> ATTR_COLD inline void pstate_manager_t::save_item(netlist_time &nlt, const void *owner, const pstring &stname) { diff --git a/src/emu/netlist/pstring.c b/src/emu/netlist/pstring.c index c1bc1e031db..d6c00b550fd 100644 --- a/src/emu/netlist/pstring.c +++ b/src/emu/netlist/pstring.c @@ -5,6 +5,7 @@ #include "pstring.h" #include <cstdio> +#include <stdlib.h> // The following will work on linux, however not on Windows .... @@ -13,7 +14,6 @@ //pstring::str_t *pstring::m_zero = new(pstring::m_pool, 0) pstring::str_t(0); pblockpool pstring::m_pool; - pstring::str_t pstring::m_zero; /* diff --git a/src/emu/render.h b/src/emu/render.h index 244d0e2bd56..5666e6825ee 100644 --- a/src/emu/render.h +++ b/src/emu/render.h @@ -46,7 +46,7 @@ #ifndef __RENDER_H__ #define __RENDER_H__ -#include "osdepend.h" +//#include "osdepend.h" #include <math.h> diff --git a/src/emu/rendfont.c b/src/emu/rendfont.c index 444d8836d07..16a3d4cf446 100644 --- a/src/emu/rendfont.c +++ b/src/emu/rendfont.c @@ -14,6 +14,7 @@ #include "emuopts.h" #include <zlib.h> +#include "osdepend.h" #include "uismall.fh" diff --git a/src/emu/rendfont.h b/src/emu/rendfont.h index 62ce244d69a..4db45ca0a90 100644 --- a/src/emu/rendfont.h +++ b/src/emu/rendfont.h @@ -13,6 +13,8 @@ #include "render.h" +// forward instead of include +class osd_font; //************************************************************************** // TYPE DEFINITIONS @@ -91,7 +93,7 @@ private: dynamic_array<glyph> m_glyphs[256]; // array of glyph subtables dynamic_array<char> m_rawdata; // pointer to the raw data for the font UINT64 m_rawsize; // size of the raw font data - osd_font m_osdfont; // handle to the OSD font + osd_font *m_osdfont; // handle to the OSD font // constants static const int CACHED_CHAR_SIZE = 12; diff --git a/src/emu/rendutil.h b/src/emu/rendutil.h index 5912dd9ab13..a158ded0c2a 100644 --- a/src/emu/rendutil.h +++ b/src/emu/rendutil.h @@ -12,7 +12,6 @@ #ifndef __RENDUTIL_H__ #define __RENDUTIL_H__ -#include "osdepend.h" #include "render.h" #include <math.h> diff --git a/src/emu/sound/tiaintf.c b/src/emu/sound/tiaintf.c index 64285ff10b5..26ee206a7a0 100644 --- a/src/emu/sound/tiaintf.c +++ b/src/emu/sound/tiaintf.c @@ -30,7 +30,7 @@ tia_device::tia_device(const machine_config &mconfig, const char *tag, device_t void tia_device::device_start() { m_channel = stream_alloc(0, 1, clock()); - m_chip = tia_sound_init(clock(), clock(), 16); + m_chip = tia_sound_init(this, clock(), clock(), 16); assert_always(m_chip != NULL, "Error creating TIA chip"); } diff --git a/src/emu/sound/tiasound.c b/src/emu/sound/tiasound.c index 5c4296371af..e5934767536 100644 --- a/src/emu/sound/tiasound.c +++ b/src/emu/sound/tiasound.c @@ -526,6 +526,22 @@ static void poly_init(UINT8 *poly, int size, int f0, int f1) } } +static void tia_save_state(device_t *device, tia *tia) +{ + device->save_item(NAME(tia->AUDC)); + device->save_item(NAME(tia->AUDF)); + device->save_item(NAME(tia->AUDV)); + device->save_item(NAME(tia->Outvol)); + device->save_item(NAME(tia->P4)); + device->save_item(NAME(tia->P5)); + device->save_item(NAME(tia->P9)); + device->save_item(NAME(tia->Div_n_cnt)); + device->save_item(NAME(tia->Div_n_max)); + device->save_item(NAME(tia->Div_3_cnt)); + device->save_item(NAME(tia->Samp_n_cnt)); + device->save_item(NAME(tia->oversampling)); +} + /*****************************************************************************/ /* Module: tia_sh_start() */ /* Purpose: to handle the power-up initialization functions */ @@ -541,7 +557,7 @@ static void poly_init(UINT8 *poly, int size, int f0, int f1) /* */ /*****************************************************************************/ -void *tia_sound_init(int clock, int sample_rate, int gain) +void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain) { struct tia *chip; int chan; @@ -581,6 +597,8 @@ void *tia_sound_init(int clock, int sample_rate, int gain) chip->P5[chan] = 0; chip->P9[chan] = 0; } + + tia_save_state(device, chip); return chip; } diff --git a/src/emu/sound/tiasound.h b/src/emu/sound/tiasound.h index 9733d8dc1d7..9ca92a2bfd1 100644 --- a/src/emu/sound/tiasound.h +++ b/src/emu/sound/tiasound.h @@ -37,7 +37,7 @@ #ifndef __TIASOUND_H__ #define __TIASOUND_H__ -void *tia_sound_init(int clock, int sample_rate, int gain); +void *tia_sound_init(device_t *device, int clock, int sample_rate, int gain); void tia_sound_free(void *chip); void tia_process (void *chip, stream_sample_t *buffer, int length); void tia_write(void *chip, offs_t offset, UINT8 data); diff --git a/src/emu/ui/devopt.c b/src/emu/ui/devopt.c new file mode 100644 index 00000000000..4a56e4ee25e --- /dev/null +++ b/src/emu/ui/devopt.c @@ -0,0 +1,259 @@ +/********************************************************************* + + ui/devopt.c + + Internal menu for the device configuration. + + Copyright Nicola Salmoria and the MAME Team. + Visit http://mamedev.org for licensing and usage restrictions. + +*********************************************************************/ + +#include "emu.h" +#include "ui/ui.h" +#include "ui/devopt.h" + +/*------------------------------------------------- + ui_device_config - handle the game information + menu + -------------------------------------------------*/ + +ui_menu_device_config::ui_menu_device_config(running_machine &machine, render_container *container, device_slot_interface *slot, device_slot_option *option) : ui_menu(machine, container) +{ + astring tmp_tag; + tmp_tag.cpy(slot->device().tag()).cat(":").cat(option->name()); + m_option = option; + m_owner = slot; + m_mounted = false; + + device_iterator deviter(machine.config().root_device()); + for (device_t *device = deviter.first(); device != NULL; device = deviter.next()) + { + if (strcmp(device->tag(), tmp_tag.cstr()) == 0) + { + m_mounted = true; + break; + } + } +} + +void ui_menu_device_config::populate() +{ + astring string; + device_t *dev; + + string.printf("[This option is%s currently mounted in the running system]\n\n", m_mounted ? "" : " NOT"); + string.catprintf("Option: %s\n", m_option->name()); + + dev = const_cast<machine_config &>(machine().config()).device_add(&machine().config().root_device(), m_option->name(), m_option->devtype(), 0); + + string.catprintf("Device: %s\n", dev->name()); + if (!m_mounted) + string.cat("\nIf you select this option, the following items will be enabled:\n"); + else + string.cat("\nThe selected option enables the following items:\n"); + + // loop over all CPUs + execute_interface_iterator execiter(*dev); + if (execiter.count() > 0) + { + string.cat("* CPU:\n"); + tagmap_t<UINT8> exectags; + for (device_execute_interface *exec = execiter.first(); exec != NULL; exec = execiter.next()) + { + if (exectags.add(exec->device().tag(), 1, FALSE) == TMERR_DUPLICATE) + continue; + + // get cpu specific clock that takes internal multiplier/dividers into account + int clock = exec->device().clock(); + + // count how many identical CPUs we have + int count = 1; + const char *name = exec->device().name(); + execute_interface_iterator execinneriter(*dev); + for (device_execute_interface *scan = execinneriter.first(); scan != NULL; scan = execinneriter.next()) + { + if (exec->device().type() == scan->device().type() && strcmp(name, scan->device().name()) == 0 && exec->device().clock() == scan->device().clock()) + if (exectags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE) + count++; + } + + // if more than one, prepend a #x in front of the CPU name + if (count > 1) + string.catprintf(" %d" UTF8_MULTIPLY, count); + else + string.cat(" "); + string.cat(name); + + // display clock in kHz or MHz + if (clock >= 1000000) + string.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); + else + string.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); + } + } + + // display screen information + screen_device_iterator scriter(*dev); + if (scriter.count() > 0) + { + string.cat("* Video:\n"); + for (screen_device *screen = scriter.first(); screen != NULL; screen = scriter.next()) + { + string.catprintf(" Screen '%s': ", screen->tag()); + + if (screen->screen_type() == SCREEN_TYPE_VECTOR) + string.cat("Vector\n"); + else + { + const rectangle &visarea = screen->visible_area(); + + string.catprintf("%d " UTF8_MULTIPLY " %d (%s) %f" UTF8_NBSP "Hz\n", + visarea.width(), visarea.height(), + (machine().system().flags & ORIENTATION_SWAP_XY) ? "V" : "H", + ATTOSECONDS_TO_HZ(screen->frame_period().attoseconds)); + } + } + } + + // loop over all sound chips + sound_interface_iterator snditer(*dev); + if (snditer.count() > 0) + { + string.cat("* Sound:\n"); + tagmap_t<UINT8> soundtags; + for (device_sound_interface *sound = snditer.first(); sound != NULL; sound = snditer.next()) + { + if (soundtags.add(sound->device().tag(), 1, FALSE) == TMERR_DUPLICATE) + continue; + + // count how many identical sound chips we have + int count = 1; + sound_interface_iterator sndinneriter(*dev); + for (device_sound_interface *scan = sndinneriter.first(); scan != NULL; scan = sndinneriter.next()) + { + if (sound->device().type() == scan->device().type() && sound->device().clock() == scan->device().clock()) + if (soundtags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE) + count++; + } + // if more than one, prepend a #x in front of the CPU name + if (count > 1) + string.catprintf(" %d" UTF8_MULTIPLY, count); + else + string.cat(" "); + string.cat(sound->device().name()); + + // display clock in kHz or MHz + int clock = sound->device().clock(); + if (clock >= 1000000) + string.catprintf(" %d.%06d" UTF8_NBSP "MHz\n", clock / 1000000, clock % 1000000); + else if (clock != 0) + string.catprintf(" %d.%03d" UTF8_NBSP "kHz\n", clock / 1000, clock % 1000); + else + string.cat("\n"); + } + } + + int input = 0, input_mj = 0, input_hana = 0, input_gamble = 0, input_analog = 0, input_adjust = 0; + int dips = 0, confs = 0; + astring errors, dips_opt, confs_opt; + ioport_list portlist; + device_iterator iptiter(*dev); + for (device_t *iptdev = iptiter.first(); iptdev != NULL; iptdev = iptiter.next()) + portlist.append(*iptdev, errors); + + // check if the device adds inputs to the system + for (ioport_port *port = portlist.first(); port != NULL; port = port->next()) + for (ioport_field *field = port->first_field(); field != NULL; field = field->next()) + { + if (field->type() >= IPT_MAHJONG_FIRST && field->type() < IPT_MAHJONG_LAST) + input_mj++; + else if (field->type() >= IPT_HANAFUDA_FIRST && field->type() < IPT_HANAFUDA_LAST) + input_hana++; + else if (field->type() >= IPT_GAMBLING_FIRST && field->type() < IPT_GAMBLING_LAST) + input_gamble++; + else if (field->type() >= IPT_ANALOG_FIRST && field->type() < IPT_ANALOG_LAST) + input_analog++; + else if (field->type() == IPT_ADJUSTER) + input_adjust++; + else if (field->type() >= IPT_START1 && field->type() < IPT_UI_FIRST) + input++; + else if (field->type() == IPT_DIPSWITCH) + { + dips++; + dips_opt.cat(" ").cat(field->name()); + for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next()) + { + if (setting->value() == field->defvalue()) + { + dips_opt.catprintf(" [default: %s]\n", setting->name()); + break; + } + } + } + else if (field->type() == IPT_CONFIG) + { + confs++; + confs_opt.cat(" ").cat(field->name()); + for (ioport_setting *setting = field->first_setting(); setting != NULL; setting = setting->next()) + { + if (setting->value() == field->defvalue()) + { + confs_opt.catprintf(" [default: %s]\n", setting->name()); + break; + } + } + } + } + + if (dips) + string.cat("* Dispwitch settings:\n").cat(dips_opt); + if (confs) + string.cat("* Configuration settings:\n").cat(confs_opt); + if (input + input_mj + input_hana + input_gamble + input_analog + input_adjust) + string.cat("* Input device(s):\n"); + if (input) + string.catprintf(" Player inputs [%d inputs]\n", input); + if (input_mj) + string.catprintf(" Mahjong inputs [%d inputs]\n", input_mj); + if (input_hana) + string.catprintf(" Hanafuda inputs [%d inputs]\n", input_hana); + if (input_gamble) + string.catprintf(" Gambling inputs [%d inputs]\n", input_gamble); + if (input_analog) + string.catprintf(" Analog inputs [%d inputs]\n", input_analog); + if (input_adjust) + string.catprintf(" Adjuster inputs [%d inputs]\n", input_adjust); + + image_interface_iterator imgiter(*dev); + if (imgiter.count() > 0) + { + string.cat("* Media Options:\n"); + for (const device_image_interface *imagedev = imgiter.first(); imagedev != NULL; imagedev = imgiter.next()) + string.catprintf(" %s [tag: %s]\n", imagedev->image_type_name(), imagedev->device().tag()); + } + + slot_interface_iterator slotiter(*dev); + if (slotiter.count() > 0) + { + string.cat("* Slot Options:\n"); + for (const device_slot_interface *slot = slotiter.first(); slot != NULL; slot = slotiter.next()) + string.catprintf(" %s [default: %s]\n", slot->device().tag(), slot->default_option() ? slot->default_option() : "----"); + } + + if ((execiter.count() + scriter.count() + snditer.count() + imgiter.count() + slotiter.count() + input + input_mj + input_hana + input_gamble + input_analog + input_adjust) == 0) + string.cat("[None]\n"); + + const_cast<machine_config &>(machine().config()).device_remove(&machine().config().root_device(), m_option->name()); + item_append(string, NULL, MENU_FLAG_MULTILINE, NULL); +} + +void ui_menu_device_config::handle() +{ + /* process the menu */ + process(0); +} + +ui_menu_device_config::~ui_menu_device_config() +{ +} diff --git a/src/emu/ui/devopt.h b/src/emu/ui/devopt.h new file mode 100644 index 00000000000..2640d358460 --- /dev/null +++ b/src/emu/ui/devopt.h @@ -0,0 +1,31 @@ +/*************************************************************************** + + ui/devopt.h + + Internal menu for the device configuration. + + Copyright Nicola Salmoria and the MAME Team. + Visit http://mamedev.org for licensing and usage restrictions. + +***************************************************************************/ + +#pragma once + +#ifndef __UI_DEVOPT_H__ +#define __UI_DEVOPT_H__ + +class ui_menu_device_config : public ui_menu { +public: + ui_menu_device_config(running_machine &machine, render_container *container, device_slot_interface *slot, device_slot_option *option); + virtual ~ui_menu_device_config(); + virtual void populate(); + virtual void handle(); + +private: + device_slot_interface *m_owner; + device_slot_option *m_option; + bool m_mounted; +}; + + +#endif /* __UI_DEVOPT_H__ */ diff --git a/src/emu/ui/filemngr.c b/src/emu/ui/filemngr.c index b641f40eb81..00390696963 100644 --- a/src/emu/ui/filemngr.c +++ b/src/emu/ui/filemngr.c @@ -59,57 +59,86 @@ void ui_menu_file_manager::custom_render(void *selectedref, float top, float bot } +void ui_menu_file_manager::fill_image_line(device_image_interface *img, astring &instance, astring &filename) +{ + // get the image type/id + instance.printf("%s (%s)", img->instance_name(), img->brief_instance_name()); + + // get the base name + if (img->basename() != NULL) + { + filename.cpy(img->basename()); + + // if the image has been loaded through softlist, also show the loaded part + if (img->part_entry() != NULL) + { + const software_part *tmp = img->part_entry(); + if (tmp->name() != NULL) + { + filename.cat(" ("); + filename.cat(tmp->name()); + // also check if this part has a specific part_id (e.g. "Map Disc", "Bonus Disc", etc.), and in case display it + if (img->get_feature("part_id") != NULL) + { + filename.cat(": "); + filename.cat(img->get_feature("part_id")); + } + filename.cat(")"); + } + } + } + else + filename.cpy("---"); +} + //------------------------------------------------- // populate //------------------------------------------------- void ui_menu_file_manager::populate() { - astring buffer; - bool first = true; + astring buffer, tmp_inst, tmp_name; + bool first_entry = true; + astring prev_owner; // cycle through all devices for this system - image_interface_iterator iter(machine().root_device()); - for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) + device_iterator iter(machine().root_device()); + tagmap_t<UINT8> devtags; + for (device_t *dev = iter.first(); dev != NULL; dev = iter.next()) { - if (first) - first = false; - else - item_append("", NULL, MENU_FLAG_DISABLE, NULL); - - // get the image type/id - buffer.printf("%s (%s)", image->instance_name(), image->brief_instance_name()); - item_append(buffer, "", MENU_FLAG_DISABLE, NULL); - item_append("Device", image->device().tag(), MENU_FLAG_DISABLE, NULL); - - // get the base name - if (image->basename() != NULL) - { - buffer.cpy(image->basename()); - - // if the image has been loaded through softlist, also show the loaded part - if (image->part_entry() != NULL) + bool tag_appended = false; + if (devtags.add(dev->tag(), 1, FALSE) == TMERR_DUPLICATE) + continue; + + // check whether it owns an image interface + image_interface_iterator subiter(*dev); + if (subiter.count() > 0) + { + // if so, cycle through all its image interfaces + image_interface_iterator subiter(*dev); + for (device_image_interface *scan = subiter.first(); scan != NULL; scan = subiter.next()) { - const software_part *tmp = image->part_entry(); - if (tmp->name() != NULL) - { - buffer.cat(" ("); - buffer.cat(tmp->name()); - // also check if this part has a specific part_id (e.g. "Map Disc", "Bonus Disc", etc.), and in case display it - if (image->get_feature("part_id") != NULL) + // if it is a children device, and not something further down the device tree, we want it in the menu! + if (strcmp(scan->device().owner()->tag(), dev->tag()) == 0) + if (devtags.add(scan->device().tag(), 1, FALSE) != TMERR_DUPLICATE) { - buffer.cat(": "); - buffer.cat(image->get_feature("part_id")); + // check whether we already had some devices with the same owner: if not, output the owner tag! + if (!tag_appended) + { + if (first_entry) + first_entry = false; + else + item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); + buffer.printf("[root%s]", dev->tag()); + item_append(buffer, NULL, 0, NULL); + tag_appended = true; + } + // finally, append the image interface to the menu + fill_image_line(scan, tmp_inst, tmp_name); + item_append(tmp_inst, tmp_name, 0, (void *) scan); } - buffer.cat(")"); - } } } - else - buffer.cpy("---"); - - // record the menu item - item_append("Mounted File", buffer, 0, (void *) image); } item_append(MENU_SEPARATOR_ITEM, NULL, 0, NULL); item_append("Reset", NULL, 0, (void *)1); diff --git a/src/emu/ui/filemngr.h b/src/emu/ui/filemngr.h index c515aaeff2e..1e023477e10 100644 --- a/src/emu/ui/filemngr.h +++ b/src/emu/ui/filemngr.h @@ -25,6 +25,8 @@ public: virtual void populate(); virtual void handle(); virtual void custom_render(void *selectedref, float top, float bottom, float x, float y, float x2, float y2); + + void fill_image_line(device_image_interface *img, astring &instance, astring &filename); }; #endif /* __UI_FILEMNGR_H__ */ diff --git a/src/emu/ui/miscmenu.c b/src/emu/ui/miscmenu.c index bd3b2812e27..5ee0d78acb3 100644 --- a/src/emu/ui/miscmenu.c +++ b/src/emu/ui/miscmenu.c @@ -23,6 +23,7 @@ #include "ui/miscmenu.h" #include "ui/filemngr.h" +#include "osdepend.h" /*------------------------------------------------- ui_slider_ui_handler - pushes the slider diff --git a/src/emu/ui/slotopt.c b/src/emu/ui/slotopt.c index e7258897130..04e9b1fafa4 100644 --- a/src/emu/ui/slotopt.c +++ b/src/emu/ui/slotopt.c @@ -13,6 +13,7 @@ #include "ui/ui.h" #include "ui/slotopt.h" +#include "ui/devopt.h" /*------------------------------------------------- @@ -187,7 +188,10 @@ void ui_menu_slot_devices::handle() if (menu_event != NULL && menu_event->itemref != NULL) { if ((FPTR)menu_event->itemref == 1 && menu_event->iptkey == IPT_UI_SELECT) + { + machine().options().add_slot_options(false); machine().schedule_hard_reset(); + } else if (menu_event->iptkey == IPT_UI_LEFT || menu_event->iptkey == IPT_UI_RIGHT) { device_slot_interface *slot = (device_slot_interface *)menu_event->itemref; @@ -195,5 +199,12 @@ void ui_menu_slot_devices::handle() set_slot_device(slot, val); reset(UI_MENU_RESET_REMEMBER_REF); } + else if (menu_event->iptkey == IPT_UI_SELECT) + { + device_slot_interface *slot = (device_slot_interface *)menu_event->itemref; + device_slot_option *option = slot_get_current_option(slot); + if (option) + ui_menu::stack_push(auto_alloc_clear(machine(), ui_menu_device_config(machine(), container, slot, option))); + } } } diff --git a/src/emu/video.c b/src/emu/video.c index 2cc4ff225f2..1a7983606b0 100644 --- a/src/emu/video.c +++ b/src/emu/video.c @@ -20,7 +20,7 @@ #include "snap.lh" - +#include "osdepend.h" //************************************************************************** // DEBUGGING diff --git a/src/emu/webengine.c b/src/emu/webengine.c index f049135687b..bc7c5fa39e8 100644 --- a/src/emu/webengine.c +++ b/src/emu/webengine.c @@ -16,7 +16,7 @@ #include "webengine.h" #include "lua.hpp" - +#include "osdepend.h" //************************************************************************** // WEB ENGINE diff --git a/src/lib/lib.mak b/src/lib/lib.mak index 923e6aca196..9867c6459dc 100644 --- a/src/lib/lib.mak +++ b/src/lib/lib.mak @@ -39,6 +39,7 @@ OBJDIRS += \ #------------------------------------------------- UTILOBJS = \ + $(OSDOBJ)/osdcore.o \ $(LIBOBJ)/util/astring.o \ $(LIBOBJ)/util/avhuff.o \ $(LIBOBJ)/util/aviio.o \ diff --git a/src/lib/util/chd.c b/src/lib/util/chd.c index 10f85fce4f2..43539103d33 100644 --- a/src/lib/util/chd.c +++ b/src/lib/util/chd.c @@ -2665,6 +2665,11 @@ void chd_file_compressor::async_read() // advance the read pointer m_read_done_offset += numbytes; } + catch (chd_error& err) + { + fprintf(stderr, "CHD error occured: %s\n", chd_file::error_string(err)); + m_read_error = true; + } catch (std::exception& ex) { fprintf(stderr, "exception occured: %s\n", ex.what()); diff --git a/src/lib/util/corefile.h b/src/lib/util/corefile.h index 8dc79ecf0a2..07ac491e1f2 100644 --- a/src/lib/util/corefile.h +++ b/src/lib/util/corefile.h @@ -14,7 +14,6 @@ #define __COREFILE_H__ #include <stdarg.h> -#include "osdcore.h" #include "astring.h" #include "coretmpl.h" diff --git a/src/lib/util/options.h b/src/lib/util/options.h index 97e062b028b..8c1f80bea93 100644 --- a/src/lib/util/options.h +++ b/src/lib/util/options.h @@ -11,7 +11,6 @@ #ifndef __OPTIONS_H__ #define __OPTIONS_H__ -#include "osdcore.h" #include "corefile.h" #include "tagmap.h" diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c index 2f6541cf436..32b4497bfd4 100644 --- a/src/mame/audio/mario.c +++ b/src/mame/audio/mario.c @@ -2,7 +2,6 @@ #include "cpu/z80/z80.h" #include "cpu/mcs48/mcs48.h" #include "sound/ay8910.h" -#include "sound/discrete.h" #include "includes/mario.h" @@ -39,6 +38,252 @@ #define I8035_P1_W_AH(M,B,D) I8035_P1_W(M,ACTIVEHIGH_PORT_BIT(I8035_P1_R(M),B,(D))) #define I8035_P2_W_AH(M,B,D) I8035_P2_W(M,ACTIVEHIGH_PORT_BIT(I8035_P2_R(M),B,(D))) + +#if !OLD_SOUND + +/* ---------------------------------------------------------------------- */ +/* mario sound */ +/* ---------------------------------------------------------------------- */ +static NETLIST_START(nl_mario_snd0) + + RES(R17, RES_K(27)) /* 20 according to parts list */ + /* 27 verified, 30K in schematics */ + CAP(C14, CAP_U(4.7)) /* verified */ + + TTL_74123(2H_A) + NET_C(2H_A.VCC, V5) + NET_C(2H_A.GND, GND) + NET_C(SOUND0.Q, 2H_A.B) + NET_C(GND, 2H_A.A) + NET_C(2H_A.CLRQ, ttlhigh) /* NOT IN SCHEMATICS */ + DIODE(D1, "1N4148") /* FIXME: try to identify */ + TTL_7404_INVERT(1H_A, 2H_A.QQ) + NET_C(R17.1, V5) + NET_C(R17.2, D1.A, C14.1) + NET_C(D1.K, 2H_A.RC) + NET_C(C14.2, 2H_A.C) + + RES(R6, RES_K(4.7)) /* verified */ + CAP(C3, CAP_U(10)) /* verified */ + + NET_C(1H_A.Q, R6.1) + NET_C(R6.2, C3.1, 1J_A.FC) + NET_C(R6.2, 2J_A.FC) + NET_C(C3.2, GND) + + //#define MR_C6 CAP_N(3.9) /* verified */ + + SN74LS629(1J_A, CAP_N(3.9)) + NET_C(1J_A.RNG, V5) + NET_C(1J_A.ENQ, ttllow) + NET_C(GND, 1J_A.GND) + + //#define MR_C17 CAP_N(22) /* verified */ + + SN74LS629(2J_A, CAP_N(22)) + NET_C(2J_A.RNG, V5) + NET_C(2J_A.ENQ, ttllow) + NET_C(GND, 2J_A.GND) + + TTL_7486_XOR(1K_A, 1J_A.Y, 2J_A.Y) + TTL_7408_AND(2K_A, 2H_A.Q, 1K_A) +NETLIST_END() + +/* ---------------------------------------------------------------------- */ +/* skid sound */ +/* ---------------------------------------------------------------------- */ + +// FIXME: Diodes are 1S953 +static NETLIST_START(nl_mario_snd7) + + RES(R61, RES_K(47)) + CAP(C41, CAP_U(4.7)) /* verified */ + + TTL_74123(4L_A) + NET_C(4L_A.VCC, V5) + NET_C(4L_A.GND, GND) + NET_C(SOUND7.Q, 4L_A.B) + NET_C(GND, 4L_A.A) + NET_C(4L_A.CLRQ, ttlhigh) /* NOT IN SCHEMATICS */ + DIODE(D10, "1N4148") /* FIXME: try to identify */ + TTL_7404_INVERT(4J_A, 4L_A.Q) + NET_C(R61.1, V5) + NET_C(R61.2, D10.A, C41.1) + NET_C(D10.K, 4L_A.RC) + NET_C(C41.2, 4L_A.C) + + RES(R65, RES_K(10)) + CAP(C44, CAP_U(3.3)) /* verified */ + + SN74LS629(4K_A, CAP_U(0.022)) + NET_C(4K_A.RNG, V5) + NET_C(4K_A.ENQ, ttllow) + NET_C(GND, 4K_A.GND) + NET_C(R65.1, 4J_A.Q) + NET_C(R65.2, 4K_A.FC, C44.1) + NET_C(C44.2, GND) + + CD_4020(3H, 4K_B.Y, ttllow, V5, GND) + TTL_7404_INVERT(4J_B, 3H.Q12) + + RES(R64, RES_K(20)) + CAP(C43, CAP_U(3.3)) /* verified */ + + SN74LS629(4K_B, CAP_U(0.0047)) + NET_C(4K_B.RNG, V5) + NET_C(4K_B.ENQ, ttllow) + NET_C(GND, 4K_B.GND) + NET_C(R64.1, 4J_B.Q) + NET_C(R64.2, 4K_B.FC, C43.1) + NET_C(C43.2, GND) + + TTL_7486_XOR(1K_C, 3H.Q4, 4K_A.Y) + TTL_7408_AND(2K_C, 4L_A.Q, 1K_C) + +NETLIST_END() + +/* ---------------------------------------------------------------------- */ +/* DAC sound */ +/* ---------------------------------------------------------------------- */ +static NETLIST_START(nl_mario_dac) + RES(R34, RES_M(2)) + RES(R35, RES_M(1)) + RES(R36, RES_M(1.8)) + LM3900(3M_1) + NET_C(3M_1.VM, GND) + NET_C(3M_1.VP, V5) + + NET_C(DAC.VOUT, R34.1) + NET_C(3M_1.MINUS, R34.2, R35.2) + NET_C(3M_1.OUT, R35.1) + NET_C(3M_1.PLUS, R36.1) + NET_C(R36.2, GND) + + RES(R21, RES_M(1.8)) + RES(R23, RES_K(10)) + RES(R25, RES_K(10)) + RES(R37, RES_K(750)) + RES(R38, RES_K(360)) + RES(R39, RES_K(750)) + + CAP(C18, CAP_P(100)) + CAP(C19, CAP_U(10)) + CAP(C20, CAP_U(1)) + CAP(C30, CAP_P(100)) + + LM3900(3M_2) + NET_C(3M_2.VM, GND) + NET_C(3M_2.VP, V5) + + NET_C(R35.1, C20.1) + NET_C(C20.2, R37.1) + NET_C(R37.2, R38.2, C18.1, R39.2) + + NET_C(C18.2, GND) + NET_C(R38.1, C30.2, 3M_2.MINUS) + NET_C(3M_2.OUT, R39.1, C30.1) + + NET_C(R21.1, 3M_2.PLUS) + NET_C(R21.2, C19.1, R25.2, R23.1) + NET_C(C19.2, R23.2, GND) + NET_C(R25.1, V5) +NETLIST_END() + +static NETLIST_START(nl_mario) + + /* Standard stuff */ + + SOLVER(Solver, 48000) + PARAM(Solver.ACCURACY, 1e-8) + PARAM(Solver.SOR_FACTOR, 1.0) + PARAM(Solver.GS_THRESHOLD, 5) + PARAM(Solver.GS_LOOPS, 4) + //PARAM(Solver.LTE, 5e-2) // Default is not enough for paddle control + PARAM(Solver.DYNAMIC_TS, 0) + ANALOG_INPUT(V5, 5) + + TTL_INPUT(SOUND0, 1) + INCLUDE(nl_mario_snd0) + + TTL_INPUT(SOUND7, 1) + INCLUDE(nl_mario_snd7) + + R2R_DAC(DAC, 3.4, 10000.0, 8) + NET_C(DAC.VGND, GND) + + INCLUDE(nl_mario_dac) + + /* ---------------------------------------------------------------------- */ + /* mixing */ + /* ---------------------------------------------------------------------- */ + + RES(R20, RES_K(22)) /* verified */ + RES(R19, RES_K(22)) /* verified */ + RES(R40, RES_K(22)) /* verified */ + RES(R41, RES_K(100)) /* verified */ + CAP(C31, CAP_U(0.022)) /* */ + + NET_C(2K_A.Q, R20.1) + NET_C(GND, R19.1) //FIXME + NET_C(2K_C.Q, R41.1) + +#if 1 + RES(DUM, RES_K(22)) + NET_C(R39.1, DUM.1) + NET_C(DUM.2, GND) + FRONTIER(front1, R39.1, R40.1) +#else + NET_C(R39.1, R40.1) +#endif + + NET_C(R20.2, R19.2, R40.2, R41.2, C31.1) + NET_C(C31.2, GND) + + CAP(C32, CAP_U(1)) /* verified */ + RES(R42, RES_K(43)) /* verified */ + RES(R43, RES_K(100)) /* verified */ + + NET_C(C31.1, C32.1) + NET_C(C32.2, R42.1, R43.2, Q10.B) + //NET_C(C32.2, R42.1, R43.2) + NET_C(R43.1, V5) + NET_C(R42.2, GND) +#if 1 + RES(R63, RES_K(1)) /* */ + RES(R62, 150) /* */ + + QBJT_EB(Q10, "2SC1815") + + NET_C(R62.2, GND) + NET_C(R62.1, Q10.E) + + NET_C(R63.1, V5) + NET_C(R63.2, Q10.C) + + CAP(C42, CAP_U(0.1)) + CAP(C47, CAP_U(4.7)) + RES(VR1, RES_K(10)) + + NET_C(C42.1, C47.1, R62.1) + NET_C(C42.2, GND) + NET_C(C47.2, VR1.1) + NET_C(VR1.2, GND) +#endif + /* ---------------------------------------------------------------------- */ + /* Output */ + /* ---------------------------------------------------------------------- */ + + RES(ROUT, 1000000) + + //NET_C(Q10.C, ROUT.1) + //NET_C(R43.2, ROUT.1) + NET_C(VR1.1, ROUT.1) + + NET_C(GND, ROUT.2) + +NETLIST_END() + +#else /**************************************************************** * * Discrete Sound defines @@ -390,7 +635,7 @@ static DISCRETE_SOUND_START(mario) DISCRETE_TASK_END() DISCRETE_SOUND_END - +#endif /**************************************************************** * * EA / Banking @@ -498,7 +743,11 @@ READ8_MEMBER(mario_state::mario_sh_tune_r) WRITE8_MEMBER(mario_state::mario_sh_sound_w) { +#if OLD_SOUND m_discrete->write(space, DS_DAC, data); +#else + m_audio_dac->write(data); +#endif } WRITE8_MEMBER(mario_state::mario_sh_p1_w) @@ -538,13 +787,19 @@ WRITE8_MEMBER(mario_state::mario_sh_tuneselect_w) /* Mario running sample */ WRITE8_MEMBER(mario_state::mario_sh1_w) { +#if OLD_SOUND m_discrete->write(space, DS_SOUND0_INP, 0); +#else + m_audio_snd0->write(data); +#endif } /* Luigi running sample */ WRITE8_MEMBER(mario_state::mario_sh2_w) { +#if OLD_SOUND m_discrete->write(space, DS_SOUND1_INP, 0); +#endif } /* Misc samples */ @@ -577,7 +832,11 @@ WRITE8_MEMBER(mario_state::mario_sh3_w) I8035_P1_W_AH(space, 3, data & 1); break; case 7: /* skid */ +#if OLD_SOUND machine().device<discrete_device>("discrete")->write(space, DS_SOUND7_INP, data & 1); +#else + m_audio_snd7->write((data & 1) ^ 1); +#endif break; } } @@ -626,9 +885,23 @@ MACHINE_CONFIG_FRAGMENT( mario_audio ) MCFG_CPU_IO_MAP(mario_sound_io_map) MCFG_SPEAKER_STANDARD_MONO("mono") + +#if OLD_SOUND MCFG_SOUND_ADD("discrete", DISCRETE, 0) MCFG_DISCRETE_INTF(mario) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1) +#else + MCFG_SOUND_ADD("snd_nl", NETLIST_SOUND, 48000) + MCFG_NETLIST_SETUP(nl_mario) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) + + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd0", "SOUND0.IN", 0, 1) + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "snd7", "SOUND7.IN", 0, 1) + MCFG_NETLIST_LOGIC_INPUT("snd_nl", "dac", "DAC.VAL", 0, 255) + + MCFG_NETLIST_STREAM_OUTPUT("snd_nl", 0, "ROUT.1") + MCFG_NETLIST_ANALOG_MULT_OFFSET(150000.0, 0.0) +#endif MACHINE_CONFIG_END diff --git a/src/mame/drivers/aleck64.c b/src/mame/drivers/aleck64.c index e1416c8a940..ad991aeb33c 100644 --- a/src/mame/drivers/aleck64.c +++ b/src/mame/drivers/aleck64.c @@ -103,8 +103,6 @@ Magical Tetris Challenge JAPAN -On bootup, they also mention 'T.L.S' (Temporary Landing System), which seems -to be the hardware system, designed by Arika Co. Ltd. PCB Layout @@ -185,6 +183,8 @@ public: DECLARE_DRIVER_INIT(aleck64); DECLARE_WRITE32_MEMBER(aleck_dips_w); DECLARE_READ32_MEMBER(aleck_dips_r); + DECLARE_READ16_MEMBER(e90_prot_r); + DECLARE_WRITE16_MEMBER(e90_prot_w); private: UINT32 m_dip_read_offset; }; @@ -311,15 +311,47 @@ static ADDRESS_MAP_START( n64_map, AS_PROGRAM, 32, aleck64_state ) AM_RANGE(0x1fc00000, 0x1fc007bf) AM_ROM AM_REGION("user1", 0) // PIF ROM AM_RANGE(0x1fc007c0, 0x1fc007ff) AM_DEVREADWRITE("rcp", n64_periphs, pif_ram_r, pif_ram_w) - /* - Surely this should mirror main ram? srmvs crashes, and - vivdolls overwrites it's memory test code if it does mirror - */ - AM_RANGE(0xc0000000, 0xc07fffff) AM_RAM + AM_RANGE(0xc0000000, 0xc07fffff) AM_RAM // SDRAM, Aleck 64 specific AM_RANGE(0xc0800000, 0xc0800fff) AM_READWRITE(aleck_dips_r,aleck_dips_w) - AM_RANGE(0xd0000000, 0xd00fffff) AM_RAM // mtetrisc, write only, mirror? +ADDRESS_MAP_END +/* + E90 protection handlers +*/ + +READ16_MEMBER(aleck64_state::e90_prot_r) +{ +// offset 0 $800 = status ready, active high + return 0; +} + +WRITE16_MEMBER(aleck64_state::e90_prot_w) +{ + switch(offset*2) + { + case 0x16: + if(data != 6 && data != 7) + printf("! %04x %04x %08x\n",offset*2,data,mem_mask); + + if(data & 1) // 0 -> 1 transition + { + //for(int i=0;i<0x1000;i+=4) + // space.write_dword(0x007502f4+i,space.read_dword(0xd0000000+i)); + } + break; + //0x1e bit 0 probably enables the chip + default: + printf("%04x %04x %08x\n",offset*2,data,mem_mask); + break; + } +} + +static ADDRESS_MAP_START( e90_map, AS_PROGRAM, 32, aleck64_state ) + AM_IMPORT_FROM( n64_map ) + AM_RANGE(0xd0000000, 0xd0000fff) AM_RAM // x/y offsets + AM_RANGE(0xd0010000, 0xd0010fff) AM_RAM // RGB555 palette + AM_RANGE(0xd0030000, 0xd003001f) AM_READWRITE16(e90_prot_r, e90_prot_w,0xffffffff) ADDRESS_MAP_END static ADDRESS_MAP_START( rsp_map, AS_PROGRAM, 32, aleck64_state ) @@ -351,7 +383,7 @@ static INPUT_PORTS_START( aleck64 ) PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) PORT_START("P1_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0xff,0x00) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(1) PORT_REVERSE PORT_START("P2") PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) // Button A @@ -374,7 +406,7 @@ static INPUT_PORTS_START( aleck64 ) PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) PORT_START("P2_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0xff,0x00) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) + PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_PLAYER(2) PORT_REVERSE PORT_START("IN0") PORT_DIPNAME( 0x80000000, 0x80000000, "DIPSW1 #8" ) PORT_DIPLOCATION("SW1:8") @@ -457,13 +489,6 @@ static INPUT_PORTS_START( 11beat ) PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_UNUSED ) PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_PLAYER(2) - - PORT_MODIFY("P1_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_REVERSE PORT_PLAYER(1) - - PORT_MODIFY("P2_ANALOG_Y") - PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(30) PORT_KEYDELTA(30) PORT_REVERSE PORT_PLAYER(2) - INPUT_PORTS_END static INPUT_PORTS_START( mtetrisc ) @@ -848,6 +873,11 @@ static MACHINE_CONFIG_START( aleck64, aleck64_state ) MCFG_N64_PERIPHS_ADD("rcp"); MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( a64_e90, aleck64 ) + MCFG_CPU_MODIFY("maincpu") + MCFG_CPU_PROGRAM_MAP(e90_map) +MACHINE_CONFIG_END + DRIVER_INIT_MEMBER(aleck64_state,aleck64) { UINT8 *rom = memregion("user2")->base(); @@ -1082,7 +1112,7 @@ GAME( 1998, aleck64, 0, aleck64, aleck64, aleck64_state, aleck64, ROT0, // games GAME( 1998, 11beat, aleck64, aleck64, 11beat, aleck64_state, aleck64, ROT0, "Hudson", "Eleven Beat", GAME_NOT_WORKING ) // crashes at kick off / during attract with DRC -GAME( 1998, mtetrisc, aleck64, aleck64, mtetrisc, aleck64_state, aleck64, ROT0, "Capcom", "Magical Tetris Challenge (981009 Japan)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) +GAME( 1998, mtetrisc, aleck64, a64_e90, mtetrisc, aleck64_state, aleck64, ROT0, "Capcom", "Magical Tetris Challenge (981009 Japan)", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) GAME( 1998, starsldr, aleck64, aleck64, starsldr, aleck64_state, aleck64, ROT0, "Hudson / Seta", "Star Soldier: Vanishing Earth", GAME_IMPERFECT_GRAPHICS ) GAME( 1998, vivdolls, aleck64, aleck64, aleck64, aleck64_state, aleck64, ROT0, "Visco", "Vivid Dolls", GAME_IMPERFECT_GRAPHICS ) GAME( 1999, srmvs, aleck64, aleck64, srmvs, aleck64_state, aleck64, ROT0, "Seta", "Super Real Mahjong VS", GAME_NOT_WORKING|GAME_IMPERFECT_GRAPHICS ) diff --git a/src/mame/drivers/chihiro.c b/src/mame/drivers/chihiro.c index 4046ca10ba3..a95c47ff57e 100644 --- a/src/mame/drivers/chihiro.c +++ b/src/mame/drivers/chihiro.c @@ -369,7 +369,6 @@ Thanks to Alex, Mr Mudkips, and Philip Burke for this info. #include "debug/debugcon.h" #include "debug/debugcmd.h" #include "debug/debugcpu.h" -#include "osdcore.h" #include "includes/chihiro.h" #define LOG_PCI diff --git a/src/mame/drivers/naomi.c b/src/mame/drivers/naomi.c index 20763dea10b..3a8a8b3e33b 100644 --- a/src/mame/drivers/naomi.c +++ b/src/mame/drivers/naomi.c @@ -521,8 +521,8 @@ Star Horse (big screens) 840-0054C 23625 4 (128Mb) 3 Star Horse (satellite) 840-0056C 23627 6 (128Mb)* 315-6319 315-6213 not present * +1 (64Mb), requires 837-13785 ARCNET&IO BD Star Horse Progress (satellite) (Rev A) 840-0123C 24122A 7 (128Mb) 315-6319A 315-6213 not present requires 837-13785 ARCNET&IO BD The King of Route 66 (Rev A) 840-0087C 23819A 10 (128Mb) 315-6319A 315-6213 not present +Virtua Striker 3 840-0061C 23663 11 (128Mb) 315-6319A 315-6213 317-0310-COM Virtua Striker 3 (Rev B) 840-0061C 23663B 11 (128Mb) 315-6319A 315-6213 317-0310-COM -Virtua Striker 3 (Rev C) 840-0061C 23663C 11 (128Mb) 315-6319A 315-6213 317-0310-COM Wave Runner GP 840-0064C 24059 6 (128Mb) 315-6319A 315-6213 not present Wild Riders 840-0046C 23622 10 (128Mb) 315-6319A 315-6213 317-0301-COM WWF Royal Rumble 840-0040C 22261 8 (128Mb) 315-6319 315-6213 317-0285-COM @@ -7790,7 +7790,8 @@ ROM_START( vstrik3c ) NAOMI_DEFAULT_EEPROM ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF) - ROM_LOAD( "epr-23663c.ic22",0x0000000, 0x0400000, CRC(7007fec7) SHA1(523168f0b218d0bd5c815d65bf0caba2c8468c9d) ) + // rom was handmade from 2 damaged dumps, needs to be verified + ROM_LOAD( "epr-23663.ic22", 0x0000000, 0x0400000, BAD_DUMP CRC(6910a008) SHA1(865affff1cf31321725ef727a17be384555e3aae) ) ROM_LOAD( "mpr-23652.ic1", 0x0800000, 0x1000000, CRC(992758a2) SHA1(5e2a25c520c1795128e5026fc00d355c24852ded) ) ROM_LOAD( "mpr-23653.ic2", 0x1800000, 0x1000000, CRC(e210e932) SHA1(2f6f0a31c3e98b21f1ff3af1680e50b3535b130f) ) ROM_LOAD( "mpr-23654.ic3", 0x2800000, 0x1000000, CRC(91335971) SHA1(fc7599b836fb7995dd7da940e64b08b3c09cb180) ) @@ -9034,7 +9035,7 @@ GAME( 2003, puyofevp, naomi, naomim1, naomi, naomi_state, naomi, ROT0, "Sega", " /* 840-xxxxx (Sega Naomi 2 cart games) */ /* 0046 */ GAME( 2001, wldrider, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) -/* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev C)", GAME_FLAGS ) +/* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart)", GAME_FLAGS ) /* 0061 */ GAME( 2001, vstrik3cb,vstrik3c,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev B)", GAME_FLAGS ) /* 0062 */ GAME( 2001, clubkrte, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS ) /* 0062 */ GAME( 2001, clubkrtd, clubkrte,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS ) diff --git a/src/mame/drivers/peplus.c b/src/mame/drivers/peplus.c index 60b37a366aa..eac67e30e00 100644 --- a/src/mame/drivers/peplus.c +++ b/src/mame/drivers/peplus.c @@ -3687,7 +3687,7 @@ NOTE: Will work with the standard CG740 + CAP740 graphics for a non-localized ga ROM_REGION( 0x020000, "gfx1", 0 ) ROM_LOAD( "mro-cg2153.u72", 0x00000, 0x8000, CRC(004c9c8e) SHA1(ec3fa9d2c658de59e722d9979513d6b0c71d5742) ) /* 05/01/95 @ IGT L95-1123 */ ROM_LOAD( "mgo-cg2153.u73", 0x08000, 0x8000, CRC(e6843b35) SHA1(2d5219a3cb054ce8b470797c0496c7e24e94ed81) ) - ROM_LOAD( "mbo-cg2153.u74", 0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino graphics */ + ROM_LOAD( "mbo-cg2153.u74", 0x10000, 0x8000, CRC(e3e28611) SHA1(d040f1df6203dc0bd6a79a391fb90fb930f8dd1a) ) /* Custom Arizona Charlie's Casino card backs */ ROM_LOAD( "mxo-cg2153.u75", 0x18000, 0x8000, CRC(3ae44f7e) SHA1(00d625b60bffef6ce622cb50a3aa93b92131f578) ) ROM_REGION( 0x100, "proms", 0 ) @@ -4772,6 +4772,8 @@ MG0183 has 4 poker games: Four of a Kind Bonus Poker Deuces Wild Poker +Also uses a Dallas (Maxim) DS1216 SmartWatch RAM for RTC (Real Time Clock) functions + Came out of an IGT machine with belly glass calling it Montana Choice */ ROM_REGION( 0x10000, "maincpu", 0 ) @@ -5391,7 +5393,7 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ROM_LOAD( "x000055p.u66", 0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */ ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD( "mro-cg2291.u77", 0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans graphics */ + ROM_LOAD( "mro-cg2291.u77", 0x00000, 0x8000, CRC(db4e491c) SHA1(e371e7b236962a0f30640c683d3a0a302c51aee9) ) /* Custom The Orleans card backs */ ROM_LOAD( "mgo-cg2291.u78", 0x08000, 0x8000, CRC(17bb35f8) SHA1(ba9e8aa3ff42b17c7be6ee46c70db22d8e60e52c) ) /* Compatible with most "standard" game sets */ ROM_LOAD( "mbo-cg2291.u79", 0x10000, 0x8000, CRC(de1036e4) SHA1(774bbcda301754dc4a606974248847a2264c3827) ) ROM_LOAD( "mxo-cg2291.u80", 0x18000, 0x8000, CRC(7049403c) SHA1(3a29a00fb8dfdb30dba757c1536151827ea09068) ) @@ -5416,7 +5418,7 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ROM_LOAD( "x000055p.u66", 0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */ ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD( "mro-cg2399.u72", 0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships graphics */ + ROM_LOAD( "mro-cg2399.u72", 0x00000, 0x8000, CRC(0424f4ba) SHA1(c8b192a6f63c8c9937cb3923d27b9ba2c39823cd) ) /* Custom The Fun Ships card backs */ ROM_LOAD( "mgo-cg2399.u73", 0x08000, 0x8000, CRC(5848a2fa) SHA1(4173a473016b7a776d2b59bf3ded0be35bd43721) ) ROM_LOAD( "mbo-cg2399.u74", 0x10000, 0x8000, CRC(5c3e16f6) SHA1(a4aa457f239527bffa6472e0d6f9d836f796b326) ) ROM_LOAD( "mxo-cg2399.u75", 0x18000, 0x8000, CRC(bd7669d5) SHA1(4343a9764fd563e2e1cdd8558f2f53f77006b159) ) @@ -5441,13 +5443,13 @@ PayTable 3K STR FL FH 4K SF 5K RF 4D RF (Bonus) ROM_LOAD( "x000055p.u66", 0x00000, 0x10000, CRC(e06819df) SHA1(36590c4588b8036908e63714fbb3e77d23e60eae) ) /* Deuces Wild Poker */ ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD( "mro-cg2185.u77", 0x00000, 0x8000, CRC(7e64bd1a) SHA1(e988a380ee58078bf5bdc7747e83aed1393cfad8) ) /* 07/10/95 @ IGT L95-1506 */ - ROM_LOAD( "mgo-cg2185.u78", 0x08000, 0x8000, CRC(d4127893) SHA1(75039c45ba6fd171a66876c91abc3191c7feddfc) ) - ROM_LOAD( "mbo-cg2185.u79", 0x10000, 0x8000, CRC(17dba955) SHA1(5f77379c88839b3a04e235e4fb0120c77e17b60e) ) - ROM_LOAD( "mxo-cg2185.u80", 0x18000, 0x8000, CRC(583eb3b1) SHA1(4a2952424969917fb1594698a779fe5a1e99bff5) ) + ROM_LOAD( "mro-cg2374.u72", 0x00000, 0x8000, CRC(ceeb714d) SHA1(6de908d04bcaa243195943affa9ad0d725de5c81) ) /* Custom Horseshoe Casino card backs */ + ROM_LOAD( "mgo-cg2374.u73", 0x08000, 0x8000, CRC(d0fabad5) SHA1(438ebe074fa3eaa3073ef042f481449f416d0665) ) + ROM_LOAD( "mbo-cg2374.u74", 0x10000, 0x8000, CRC(9a0fbc8d) SHA1(aa39f47cbeaf8218fd2d753c9a350e9eab5df5d3) ) + ROM_LOAD( "mxo-cg2374.u75", 0x18000, 0x8000, CRC(99814562) SHA1(2d8e132f4cc4edd06332c0327927219513b22832) ) ROM_REGION( 0x200, "proms", 0 ) - ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) + ROM_LOAD( "capx2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) ) ROM_END ROM_START( pex0055pd ) /* Superboard : Deuces Wild Poker (X000055P+XP000035) */ @@ -7938,13 +7940,13 @@ PayTable Js+ 2PR 3K STR FL FH 4K 4K 4A SF RF (Bonus) ROM_LOAD( "x002374p.u66", 0x00000, 0x10000, CRC(fc4b6c8d) SHA1(b101f9042bd54dbfdeed4c7a3acf3798096f6857) ) /* Super Aces Poker */ ROM_REGION( 0x020000, "gfx1", 0 ) - ROM_LOAD( "mro-cg2374.u72", 0x00000, 0x8000, CRC(ceeb714d) SHA1(6de908d04bcaa243195943affa9ad0d725de5c81) ) /* Custom Horseshoe Casino card backs */ - ROM_LOAD( "mgo-cg2374.u73", 0x08000, 0x8000, CRC(d0fabad5) SHA1(438ebe074fa3eaa3073ef042f481449f416d0665) ) - ROM_LOAD( "mbo-cg2374.u74", 0x10000, 0x8000, CRC(9a0fbc8d) SHA1(aa39f47cbeaf8218fd2d753c9a350e9eab5df5d3) ) - ROM_LOAD( "mxo-cg2374.u75", 0x18000, 0x8000, CRC(99814562) SHA1(2d8e132f4cc4edd06332c0327927219513b22832) ) + ROM_LOAD( "mro-cg2324.u77", 0x00000, 0x8000, CRC(6eceef42) SHA1(a2ddd2a3290c41e510f483c6b633fe0002694d0b) ) + ROM_LOAD( "mgo-cg2324.u78", 0x08000, 0x8000, CRC(26d0acbe) SHA1(09a9127deb88185cd5b748bac657461eadb2f48f) ) + ROM_LOAD( "mbo-cg2324.u79", 0x10000, 0x8000, CRC(47baee32) SHA1(d8af09022ccb5fc06aa3aa4c200a734b66cbee00) ) + ROM_LOAD( "mxo-cg2324.u80", 0x18000, 0x8000, CRC(60449fc0) SHA1(251d1e04786b70c1d2bc7b02f3b69cd58ac76398) ) ROM_REGION( 0x200, "proms", 0 ) - ROM_LOAD( "cap2374.u43", 0x0000, 0x0200, CRC(f922e1b8) SHA1(4aa5291c59431c022dc0561a6e3b38209f60286a) ) + ROM_LOAD( "capx1321.u43", 0x0000, 0x0200, CRC(4b57569f) SHA1(fa29c0f627e7ce79951ec6dadec114864144f37d) ) ROM_END ROM_START( pex2377p ) /* Superboard : Super Double Bonus Poker (X002377P+XP000112) */ @@ -9263,7 +9265,7 @@ GAMEL(1995, pex0054p, 0, peplus, peplus_poker, peplus_state, peplussb, GAMEL(1995, pex0055p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000019) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pa, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000022) Deuces Wild Poker (The Orleans)", 0, layout_pe_poker ) GAMEL(1995, pex0055pb, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000023) Deuces Wild Poker (The Fun Ships)", 0, layout_pe_poker ) -GAMEL(1995, pex0055pc, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker", 0, layout_pe_poker ) +GAMEL(1995, pex0055pc, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000028) Deuces Wild Poker (Horseshoe)", 0, layout_pe_poker ) GAMEL(1995, pex0055pd, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000035) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pe, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000038) Deuces Wild Poker", 0, layout_pe_poker ) GAMEL(1995, pex0055pf, pex0055p, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X000055P+XP000040) Deuces Wild Poker", 0, layout_pe_poker ) @@ -9361,7 +9363,7 @@ GAMEL(1995, pex2307p, 0, peplus, peplus_poker, peplus_state, peplussb, GAMEL(1995, pex2308p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002308P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2310p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002310P+XP000112) Triple Double Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2314p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002314P+XP000112) Triple Bonus Poker Plus", 0, layout_pe_poker ) -GAMEL(1995, pex2374p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002374P+XP000112) Super Aces Poker (Horseshoe)", 0, layout_pe_poker ) +GAMEL(1995, pex2374p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002374P+XP000112) Super Aces Poker", 0, layout_pe_poker ) GAMEL(1995, pex2377p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002377P+XP000112) Super Double Bonus Poker", 0, layout_pe_poker ) GAMEL(1995, pex2419p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002419P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker ) GAMEL(1995, pex2420p, 0, peplus, peplus_poker, peplus_state, peplussb, ROT0, "IGT - International Game Technology", "Player's Edge Plus (X002420P+XP000064) Deuces Wild Bonus Poker - French", 0, layout_pe_poker ) diff --git a/src/mame/drivers/stfight.c b/src/mame/drivers/stfight.c index 3c17a67b817..1116e2600ec 100644 --- a/src/mame/drivers/stfight.c +++ b/src/mame/drivers/stfight.c @@ -247,7 +247,6 @@ TODO: #include "cpu/z80/z80.h" #include "cpu/m6805/m6805.h" #include "sound/2203intf.h" -#include "sound/msm5205.h" #include "includes/stfight.h" static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, stfight_state ) @@ -1037,11 +1036,11 @@ ROM_START( cshooter ) ROM_END // Note: Marked GAME_IMPERFECT_SOUND due to YM2203 clock issue -GAME( 1986, empcity, 0, stfight, stfight, stfight_state, empcity, ROT0, "Seibu Kaihatsu", "Empire City: 1931 (bootleg?)", GAME_IMPERFECT_SOUND ) -GAME( 1986, empcityu, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito / Romstar license)", "Empire City: 1931 (US)", GAME_IMPERFECT_SOUND ) // different title logo -GAME( 1986, empcityj, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito license)", "Empire City: 1931 (Japan)", GAME_IMPERFECT_SOUND ) -GAME( 1986, empcityi, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Eurobed license)", "Empire City: 1931 (Italy)", GAME_IMPERFECT_SOUND ) -GAME( 1986, stfight, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Tuning license)", "Street Fight (Germany)", GAME_IMPERFECT_SOUND ) -GAME( 1986, stfighta, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu", "Street Fight (bootleg?)", GAME_IMPERFECT_SOUND ) +GAME( 1986, empcity, 0, stfight, stfight, stfight_state, empcity, ROT0, "Seibu Kaihatsu", "Empire City: 1931 (bootleg?)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1986, empcityu, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito / Romstar license)", "Empire City: 1931 (US)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) // different title logo +GAME( 1986, empcityj, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Taito license)", "Empire City: 1931 (Japan)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1986, empcityi, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Eurobed license)", "Empire City: 1931 (Italy)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1986, stfight, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu (Tuning license)", "Street Fight (Germany)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) +GAME( 1986, stfighta, empcity, stfight, stfight, stfight_state, stfight, ROT0, "Seibu Kaihatsu", "Street Fight (bootleg?)", GAME_IMPERFECT_SOUND | GAME_SUPPORTS_SAVE ) /* Cross Shooter runs on a slightly modified PCB, with a different text tilemap and gfx blobs (see also cshooter.c) */ -GAME( 1987, cshooter, 0, cshooter,cshooter, stfight_state, cshooter,ROT270,"Seibu Kaihatsu (Taito license)", "Cross Shooter (not encrypted)", GAME_NOT_WORKING ) +GAME( 1987, cshooter, 0, cshooter,cshooter, stfight_state, cshooter,ROT270,"Seibu Kaihatsu (Taito license)", "Cross Shooter (not encrypted)", GAME_NOT_WORKING | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/stlforce.c b/src/mame/drivers/stlforce.c index 4aee58362f8..c105a8185e0 100644 --- a/src/mame/drivers/stlforce.c +++ b/src/mame/drivers/stlforce.c @@ -370,6 +370,6 @@ DRIVER_INIT_MEMBER(stlforce_state,twinbrat) } -GAME( 1994, stlforce, 0, stlforce, stlforce, stlforce_state, stlforce, ROT0, "Electronic Devices Italy / Ecogames S.L. Spain", "Steel Force", 0 ) -GAME( 1995, twinbrat, 0, twinbrat, stlforce, stlforce_state, twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 1)", 0 ) -GAME( 1995, twinbrata,twinbrat, twinbrat, stlforce, stlforce_state, twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 2)", 0 ) +GAME( 1994, stlforce, 0, stlforce, stlforce, stlforce_state, stlforce, ROT0, "Electronic Devices Italy / Ecogames S.L. Spain", "Steel Force", GAME_SUPPORTS_SAVE ) +GAME( 1995, twinbrat, 0, twinbrat, stlforce, stlforce_state, twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1995, twinbrata,twinbrat, twinbrat, stlforce, stlforce_state, twinbrat, ROT0, "Elettronica Video-Games S.R.L.", "Twin Brats (set 2)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/strnskil.c b/src/mame/drivers/strnskil.c index caa62cc8b6c..e5429cdc072 100644 --- a/src/mame/drivers/strnskil.c +++ b/src/mame/drivers/strnskil.c @@ -22,6 +22,14 @@ Notes: #include "sound/sn76496.h" #include "includes/strnskil.h" + + +void strnskil_state::machine_start() +{ + save_item(NAME(m_scrl_ctrl)); + save_item(NAME(m_irq_source)); +} + /****************************************************************************/ READ8_MEMBER(strnskil_state::strnskil_d800_r) @@ -533,7 +541,7 @@ DRIVER_INIT_MEMBER(strnskil_state,banbam) m_maincpu->space(AS_PROGRAM).install_write_handler(0xd80d, 0xd80d, write8_delegate(FUNC(strnskil_state::protection_w),this)); } -GAME( 1984, strnskil, 0, strnskil, strnskil, driver_device, 0, ROT0, "Sun Electronics", "Strength & Skill", 0 ) -GAME( 1984, guiness, strnskil, strnskil, strnskil, driver_device, 0, ROT0, "Sun Electronics", "The Guiness (Japan)", 0 ) -GAME( 1984, banbam, 0, banbam, banbam, strnskil_state, banbam, ROT0, "Sun Electronics", "BanBam", GAME_UNEMULATED_PROTECTION ) -GAME( 1984, pettanp, banbam, strnskil, banbam, strnskil_state, pettanp, ROT0, "Sun Electronics", "Pettan Pyuu (Japan)", GAME_UNEMULATED_PROTECTION ) +GAME( 1984, strnskil, 0, strnskil, strnskil, driver_device, 0, ROT0, "Sun Electronics", "Strength & Skill", GAME_SUPPORTS_SAVE ) +GAME( 1984, guiness, strnskil, strnskil, strnskil, driver_device, 0, ROT0, "Sun Electronics", "The Guiness (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1984, banbam, 0, banbam, banbam, strnskil_state, banbam, ROT0, "Sun Electronics", "BanBam", GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE ) +GAME( 1984, pettanp, banbam, strnskil, banbam, strnskil_state, pettanp, ROT0, "Sun Electronics", "Pettan Pyuu (Japan)", GAME_UNEMULATED_PROTECTION | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/tourtabl.c b/src/mame/drivers/tourtabl.c index e1aa9487644..bc74e8d2a05 100644 --- a/src/mame/drivers/tourtabl.c +++ b/src/mame/drivers/tourtabl.c @@ -20,11 +20,12 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu") { } + required_device<cpu_device> m_maincpu; + DECLARE_WRITE8_MEMBER(tourtabl_led_w); DECLARE_READ16_MEMBER(tourtabl_read_input_port); DECLARE_READ8_MEMBER(tourtabl_get_databus_contents); DECLARE_WRITE8_MEMBER(watchdog_w); - required_device<cpu_device> m_maincpu; }; @@ -201,5 +202,5 @@ ROM_START( tourtab2 ) ROM_END -GAME( 1978, tourtabl, 0, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 1)", 0 ) -GAME( 1978, tourtab2, tourtabl, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 2)", 0 ) +GAME( 1978, tourtabl, 0, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 1)", GAME_SUPPORTS_SAVE ) +GAME( 1978, tourtab2, tourtabl, tourtabl, tourtabl, driver_device, 0, ROT0, "Atari", "Tournament Table (set 2)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/mario.h b/src/mame/includes/mario.h index 6d723d0a2ba..9ddca2ae51c 100644 --- a/src/mame/includes/mario.h +++ b/src/mame/includes/mario.h @@ -1,9 +1,17 @@ #ifndef MARIO_H_ #define MARIO_H_ -#include "sound/discrete.h" #include "machine/z80dma.h" +#define OLD_SOUND (1) + +#if !OLD_SOUND +#include "machine/netlist.h" +#include "netlist/devices/net_lib.h" +#else +#include "sound/discrete.h" +#endif + /* * From the schematics: * @@ -42,7 +50,13 @@ public: m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette"), m_z80dma(*this, "z80dma"), +#if OLD_SOUND m_discrete(*this, "discrete"), +#else + m_audio_snd0(*this, "snd_nl:snd0"), + m_audio_snd7(*this, "snd_nl:snd7"), + m_audio_dac(*this, "snd_nl:dac"), +#endif m_spriteram(*this, "spriteram"), m_videoram(*this, "videoram"), m_monitor(0) { } @@ -53,7 +67,13 @@ public: required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; optional_device<z80dma_device> m_z80dma; +#if OLD_SOUND optional_device<discrete_device> m_discrete; +#else + optional_device<netlist_mame_logic_input_t> m_audio_snd0; + optional_device<netlist_mame_logic_input_t> m_audio_snd7; + optional_device<netlist_mame_logic_input_t> m_audio_dac; +#endif /* memory pointers */ required_shared_ptr<UINT8> m_spriteram; diff --git a/src/mame/includes/stfight.h b/src/mame/includes/stfight.h index 48fde38066e..b534261c629 100644 --- a/src/mame/includes/stfight.h +++ b/src/mame/includes/stfight.h @@ -10,29 +10,30 @@ public: stfight_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_text_char_ram(*this, "text_char_ram"), - m_text_attr_ram(*this, "text_attr_ram"), - m_tx_vram(*this, "tx_vram"), - m_vh_latch_ram(*this, "vh_latch_ram"), - m_sprite_ram(*this, "sprite_ram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), m_mcu(*this, "mcu"), m_msm(*this, "msm"), m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_palette(*this, "palette"), + m_text_char_ram(*this, "text_char_ram"), + m_text_attr_ram(*this, "text_attr_ram"), + m_tx_vram(*this, "tx_vram"), + m_vh_latch_ram(*this, "vh_latch_ram"), + m_sprite_ram(*this, "sprite_ram") { } - optional_shared_ptr<UINT8> m_text_char_ram; - optional_shared_ptr<UINT8> m_text_attr_ram; - optional_shared_ptr<UINT8> m_tx_vram; - required_shared_ptr<UINT8> m_vh_latch_ram; - required_shared_ptr<UINT8> m_sprite_ram; required_device<cpu_device> m_maincpu; required_device<cpu_device> m_audiocpu; required_device<cpu_device> m_mcu; required_device<msm5205_device> m_msm; required_device<gfxdecode_device> m_gfxdecode; required_device<palette_device> m_palette; + + optional_shared_ptr<UINT8> m_text_char_ram; + optional_shared_ptr<UINT8> m_text_attr_ram; + optional_shared_ptr<UINT8> m_tx_vram; + required_shared_ptr<UINT8> m_vh_latch_ram; + required_shared_ptr<UINT8> m_sprite_ram; UINT8 *m_decrypt; UINT8 m_fm_data; @@ -79,6 +80,7 @@ public: DECLARE_VIDEO_START(stfight); DECLARE_VIDEO_START(cshooter); + virtual void machine_start(); virtual void machine_reset(); DECLARE_PALETTE_INIT(stfight); UINT32 screen_update_stfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); @@ -106,7 +108,6 @@ public: UINT8 m_portB_out, m_portB_in; UINT8 m_portC_out, m_portC_in; UINT8 m_ddrA, m_ddrB, m_ddrC; - UINT8 m_from_main, m_main_sent; protected: virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); diff --git a/src/mame/includes/stlforce.h b/src/mame/includes/stlforce.h index 21efd8d6dc4..cb11d73b52c 100644 --- a/src/mame/includes/stlforce.h +++ b/src/mame/includes/stlforce.h @@ -6,6 +6,11 @@ class stlforce_state : public driver_device public: stlforce_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_oki(*this, "oki"), + m_eeprom(*this, "eeprom"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), m_bg_videoram(*this, "bg_videoram"), m_mlow_videoram(*this, "mlow_videoram"), m_mhigh_videoram(*this, "mhigh_videoram"), @@ -14,17 +19,13 @@ public: m_mlow_scrollram(*this, "mlow_scrollram"), m_mhigh_scrollram(*this, "mhigh_scrollram"), m_vidattrram(*this, "vidattrram"), - m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu"), - m_oki(*this, "oki"), - m_eeprom(*this, "eeprom"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_spriteram(*this, "spriteram") { } - tilemap_t *m_bg_tilemap; - tilemap_t *m_mlow_tilemap; - tilemap_t *m_mhigh_tilemap; - tilemap_t *m_tx_tilemap; + required_device<cpu_device> m_maincpu; + required_device<okim6295_device> m_oki; + required_device<eeprom_serial_93cxx_device> m_eeprom; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; required_shared_ptr<UINT16> m_bg_videoram; required_shared_ptr<UINT16> m_mlow_videoram; @@ -34,28 +35,31 @@ public: required_shared_ptr<UINT16> m_mlow_scrollram; required_shared_ptr<UINT16> m_mhigh_scrollram; required_shared_ptr<UINT16> m_vidattrram; - required_shared_ptr<UINT16> m_spriteram; + + tilemap_t *m_bg_tilemap; + tilemap_t *m_mlow_tilemap; + tilemap_t *m_mhigh_tilemap; + tilemap_t *m_tx_tilemap; int m_sprxoffs; + DECLARE_WRITE16_MEMBER(stlforce_bg_videoram_w); DECLARE_WRITE16_MEMBER(stlforce_mlow_videoram_w); DECLARE_WRITE16_MEMBER(stlforce_mhigh_videoram_w); DECLARE_WRITE16_MEMBER(stlforce_tx_videoram_w); DECLARE_WRITE16_MEMBER(eeprom_w); DECLARE_WRITE16_MEMBER(oki_bank_w); + DECLARE_DRIVER_INIT(twinbrat); DECLARE_DRIVER_INIT(stlforce); + TILE_GET_INFO_MEMBER(get_stlforce_bg_tile_info); TILE_GET_INFO_MEMBER(get_stlforce_mlow_tile_info); TILE_GET_INFO_MEMBER(get_stlforce_mhigh_tile_info); TILE_GET_INFO_MEMBER(get_stlforce_tx_tile_info); + virtual void video_start(); UINT32 screen_update_stlforce(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); - required_device<cpu_device> m_maincpu; - required_device<okim6295_device> m_oki; - required_device<eeprom_serial_93cxx_device> m_eeprom; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; }; diff --git a/src/mame/includes/strnskil.h b/src/mame/includes/strnskil.h index 35d9f3aa7c3..be662c3af21 100644 --- a/src/mame/includes/strnskil.h +++ b/src/mame/includes/strnskil.h @@ -5,23 +5,26 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_subcpu(*this,"sub"), + m_gfxdecode(*this, "gfxdecode"), + m_palette(*this, "palette"), m_videoram(*this, "videoram"), m_xscroll(*this, "xscroll"), - m_spriteram(*this, "spriteram"), - m_gfxdecode(*this, "gfxdecode"), - m_palette(*this, "palette") { } + m_spriteram(*this, "spriteram") { } required_device<cpu_device> m_maincpu; required_device<cpu_device> m_subcpu; + required_device<gfxdecode_device> m_gfxdecode; + required_device<palette_device> m_palette; + required_shared_ptr<UINT8> m_videoram; required_shared_ptr<UINT8> m_xscroll; required_shared_ptr<UINT8> m_spriteram; - required_device<gfxdecode_device> m_gfxdecode; - required_device<palette_device> m_palette; UINT8 m_scrl_ctrl; tilemap_t *m_bg_tilemap; UINT8 m_irq_source; + + TIMER_DEVICE_CALLBACK_MEMBER(strnskil_irq); DECLARE_READ8_MEMBER(strnskil_d800_r); DECLARE_READ8_MEMBER(pettanp_protection_r); @@ -29,12 +32,15 @@ public: DECLARE_WRITE8_MEMBER(protection_w); DECLARE_WRITE8_MEMBER(strnskil_videoram_w); DECLARE_WRITE8_MEMBER(strnskil_scrl_ctrl_w); + DECLARE_DRIVER_INIT(banbam); DECLARE_DRIVER_INIT(pettanp); + TILE_GET_INFO_MEMBER(get_bg_tile_info); + + virtual void machine_start(); virtual void video_start(); DECLARE_PALETTE_INIT(strnskil); UINT32 screen_update_strnskil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - TIMER_DEVICE_CALLBACK_MEMBER(strnskil_irq); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); }; diff --git a/src/mame/machine/stfight.c b/src/mame/machine/stfight.c index 2bb45761558..a55d45e2f6e 100644 --- a/src/mame/machine/stfight.c +++ b/src/mame/machine/stfight.c @@ -1,6 +1,6 @@ /*************************************************************************** - machine.c + stfight.c Functions to emulate general aspects of the machine (RAM, ROM, interrupts, I/O ports) @@ -63,6 +63,7 @@ DRIVER_INIT_MEMBER(stfight_state,empcity) ( ( ( src ^ A ) >> 1 ) & 0x08 ) | ( ~( ( src >> 6 ) ^ A ) & 0x01 ); } + } DRIVER_INIT_MEMBER(stfight_state,stfight) @@ -74,6 +75,27 @@ DRIVER_INIT_MEMBER(stfight_state,cshooter) { } +void stfight_state::machine_start() +{ + save_item(NAME(m_fm_data)); + save_item(NAME(m_cpu_to_mcu_data)); + save_item(NAME(m_cpu_to_mcu_empty)); + save_item(NAME(m_adpcm_data_offs)); + save_item(NAME(m_adpcm_nibble)); + save_item(NAME(m_adpcm_reset)); + save_item(NAME(m_coin_state)); + save_item(NAME(m_sprite_base)); + save_item(NAME(m_portA_out)); + save_item(NAME(m_portA_in)); + save_item(NAME(m_portB_out)); + save_item(NAME(m_portB_in)); + save_item(NAME(m_portC_out)); + save_item(NAME(m_portC_in)); + save_item(NAME(m_ddrA)); + save_item(NAME(m_ddrB)); + save_item(NAME(m_ddrC)); +} + void stfight_state::machine_reset() { m_fm_data = 0; diff --git a/src/mame/mame.lst b/src/mame/mame.lst index ed2dafd3926..f113ff6113d 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -5447,7 +5447,6 @@ puyofev // 2003.11 Puyo Puyo Fever starhrsp // 2003.12.01 Star Horse Progress (satellite) (Rev A) puyofevp // 2003.?? Puyo Puyo Fever (prototype) // 2003.?? Dragon Treasure - // 2003.?? Rabbit 2 cfield // 2004.06 Chaos Field tetkiwam // 2004.06 Tetris Kiwamemichi (Arcade TV Game List - P.88, Right, 11 from bottom) trizeal // 2004.09 Trizeal @@ -5514,13 +5513,13 @@ starhrpr // 2009.07.27 Star Horse Progress Returns (satellite) // NAOMI 2 naomi2 // 2001.?? Naomi 2 BIOS -vstrik3 // 2001.04.06 Virtua Striker 3 Ver. 2002 +vstrik3c // 2001.04 Virtua Striker 3 (cartridge) vstrik3cb // 2001.04 Virtua Striker 3 (Rev B) (cartridge) -vstrik3c // 2001.04 Virtua Striker 3 (Rev C) (cartridge) +vstrik3 // 2001.04.06 Virtua Striker 3 Ver. 2002 wldrider // 2001.05 Wild Riders clubkrte // 2001.06 Club Kart: European Session -clubkrtd // 2001.06 Club Kart: European Session (Rev D) clubkrtc // 2001.?? Club Kart: European Session (Rev C) +clubkrtd // 2001.06 Club Kart: European Session (Rev D) beachspi // 2001.07 Beach Spikers vf4cart // 2001.08.02 Virtua Fighter 4 (cartridge) vf4 // 2001.08.02 Virtua Fighter 4 (GD-ROM) diff --git a/src/mame/video/strnskil.c b/src/mame/video/strnskil.c index 84c7743e5e4..d7523a755e0 100644 --- a/src/mame/video/strnskil.c +++ b/src/mame/video/strnskil.c @@ -41,8 +41,7 @@ PALETTE_INIT_MEMBER(strnskil_state, strnskil) WRITE8_MEMBER(strnskil_state::strnskil_videoram_w) { - UINT8 *videoram = m_videoram; - videoram[offset] = data; + m_videoram[offset] = data; m_bg_tilemap->mark_tile_dirty(offset / 2); } @@ -59,9 +58,8 @@ WRITE8_MEMBER(strnskil_state::strnskil_scrl_ctrl_w) TILE_GET_INFO_MEMBER(strnskil_state::get_bg_tile_info) { - UINT8 *videoram = m_videoram; - int attr = videoram[tile_index * 2]; - int code = videoram[(tile_index * 2) + 1] + ((attr & 0x60) << 3); + int attr = m_videoram[tile_index * 2]; + int code = m_videoram[(tile_index * 2) + 1] + ((attr & 0x60) << 3); int color = (attr & 0x1f) | ((attr & 0x80) >> 2); SET_TILE_INFO_MEMBER(0, code, color, 0); @@ -77,18 +75,17 @@ void strnskil_state::video_start() void strnskil_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) { - UINT8 *spriteram = m_spriteram; int offs; for (offs = 0x60; offs < 0x100; offs += 4) { - int code = spriteram[offs + 1]; - int color = spriteram[offs + 2] & 0x3f; + int code = m_spriteram[offs + 1]; + int color = m_spriteram[offs + 2] & 0x3f; int flipx = flip_screen_x(); int flipy = flip_screen_y(); - int sx = spriteram[offs + 3]; - int sy = spriteram[offs]; + int sx = m_spriteram[offs + 3]; + int sy = m_spriteram[offs]; int px, py; if (flip_screen()) @@ -118,10 +115,9 @@ void strnskil_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprec UINT32 strnskil_state::screen_update_strnskil(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int row; const UINT8 *usr1 = memregion("user1")->base(); - for (row = 0; row < 32; row++) + for (int row = 0; row < 32; row++) { if (m_scrl_ctrl != 0x07) { diff --git a/src/mame/video/tia.c b/src/mame/video/tia.c index 384a3773ddc..70f246ea999 100644 --- a/src/mame/video/tia.c +++ b/src/mame/video/tia.c @@ -430,6 +430,8 @@ void tia_video_device::device_start() helper[0] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT); helper[1] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT); helper[2] = auto_bitmap_ind16_alloc(machine(), cx, TIA_MAX_SCREEN_HEIGHT); + + register_save_state(); } @@ -665,13 +667,13 @@ int tia_video_device::collision_check(UINT8* p1, UINT8* p2, int x1, int x2) int tia_video_device::current_x() { - return 3 * ((machine().firstcpu->total_cycles() - frame_cycles) % 76) - 68; + return 3 * ((machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles) % 76) - 68; } int tia_video_device::current_y() { - return (machine().firstcpu->total_cycles() - frame_cycles) / 76; + return (machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles) / 76; } @@ -1010,7 +1012,7 @@ void tia_video_device::update_bitmap(int next_x, int next_y) WRITE8_MEMBER( tia_video_device::WSYNC_w ) { - int cycles = machine().firstcpu->total_cycles() - frame_cycles; + int cycles = machine().device<cpu_device>("maincpu")->total_cycles() - frame_cycles; if (cycles % 76) { @@ -1051,7 +1053,7 @@ WRITE8_MEMBER( tia_video_device::VBLANK_w ) { if (data & 0x80) { - paddle_start = machine().firstcpu->total_cycles(); + paddle_start = machine().device<cpu_device>("maincpu")->total_cycles(); } if ( ! ( VBLANK & 0x40 ) ) { INPT4 = 0x80; @@ -1804,7 +1806,7 @@ WRITE8_MEMBER( tia_video_device::GRP1_w ) READ8_MEMBER( tia_video_device::INPT_r ) { - UINT64 elapsed = machine().firstcpu->total_cycles() - paddle_start; + UINT64 elapsed = machine().device<cpu_device>("maincpu")->total_cycles() - paddle_start; UINT16 input = TIA_INPUT_PORT_ALWAYS_ON; if ( !m_read_input_port_cb.isnull() ) { @@ -2177,3 +2179,90 @@ void tia_video_device::device_reset() COLUBK = 0; COLUPF = 0; } + + +void tia_video_device::register_save_state() +{ + save_item(NAME(p0gfx.start_pixel)); + save_item(NAME(p0gfx.start_drawing)); + save_item(NAME(p0gfx.size)); + save_item(NAME(p0gfx.skipclip)); + save_item(NAME(p1gfx.start_pixel)); + save_item(NAME(p1gfx.start_drawing)); + save_item(NAME(p1gfx.size)); + save_item(NAME(p1gfx.skipclip)); + save_item(NAME(frame_cycles)); + save_item(NAME(paddle_start)); + save_item(NAME(horzP0)); + save_item(NAME(horzP1)); + save_item(NAME(horzM0)); + save_item(NAME(horzM1)); + save_item(NAME(horzBL)); + save_item(NAME(motclkP0)); + save_item(NAME(motclkP1)); + save_item(NAME(motclkM0)); + save_item(NAME(motclkM1)); + save_item(NAME(motclkBL)); + save_item(NAME(startP0)); + save_item(NAME(startP1)); + save_item(NAME(startM0)); + save_item(NAME(startM1)); + save_item(NAME(skipclipP0)); + save_item(NAME(skipclipP1)); + save_item(NAME(skipM0delay)); + save_item(NAME(skipM1delay)); + save_item(NAME(current_bitmap)); + save_item(NAME(prev_x)); + save_item(NAME(prev_y)); + save_item(NAME(VSYNC)); + save_item(NAME(VBLANK)); + save_item(NAME(COLUP0)); + save_item(NAME(COLUP1)); + save_item(NAME(COLUBK)); + save_item(NAME(COLUPF)); + save_item(NAME(CTRLPF)); + save_item(NAME(GRP0)); + save_item(NAME(GRP1)); + save_item(NAME(REFP0)); + save_item(NAME(REFP1)); + save_item(NAME(HMP0)); + save_item(NAME(HMP1)); + save_item(NAME(HMM0)); + save_item(NAME(HMM1)); + save_item(NAME(HMBL)); + save_item(NAME(VDELP0)); + save_item(NAME(VDELP1)); + save_item(NAME(VDELBL)); + save_item(NAME(NUSIZ0)); + save_item(NAME(NUSIZ1)); + save_item(NAME(ENAM0)); + save_item(NAME(ENAM1)); + save_item(NAME(ENABL)); + save_item(NAME(CXM0P)); + save_item(NAME(CXM1P)); + save_item(NAME(CXP0FB)); + save_item(NAME(CXP1FB)); + save_item(NAME(CXM0FB)); + save_item(NAME(CXM1FB)); + save_item(NAME(CXBLPF)); + save_item(NAME(CXPPMM)); + save_item(NAME(RESMP0)); + save_item(NAME(RESMP1)); + save_item(NAME(PF0)); + save_item(NAME(PF1)); + save_item(NAME(PF2)); + save_item(NAME(INPT4)); + save_item(NAME(INPT5)); + save_item(NAME(prevGRP0)); + save_item(NAME(prevGRP1)); + save_item(NAME(prevENABL)); + save_item(NAME(HMOVE_started)); + save_item(NAME(HMOVE_started_previous)); + save_item(NAME(HMP0_latch)); + save_item(NAME(HMP1_latch)); + save_item(NAME(HMM0_latch)); + save_item(NAME(HMM1_latch)); + save_item(NAME(HMBL_latch)); + save_item(NAME(REFLECT)); + save_item(NAME(NUSIZx_changed)); +} diff --git a/src/mame/video/tia.h b/src/mame/video/tia.h index cc321f5bd7a..4dcf107977d 100644 --- a/src/mame/video/tia.h +++ b/src/mame/video/tia.h @@ -199,6 +199,8 @@ private: bitmap_ind16 *helper[3]; UINT16 screen_height; + + void register_save_state(); }; class tia_pal_video_device : public tia_video_device diff --git a/src/mess/drivers/a2600.c b/src/mess/drivers/a2600.c index 1d0d6a47d5d..44a94ebd043 100644 --- a/src/mess/drivers/a2600.c +++ b/src/mess/drivers/a2600.c @@ -209,7 +209,7 @@ WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback) if ( supported_screen_heights[i] != m_current_screen_height ) { m_current_screen_height = supported_screen_heights[i]; -// machine.first_screen()->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height ); +// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_NTSC ) * 228 * m_current_screen_height ); } } } @@ -226,7 +226,7 @@ WRITE16_MEMBER(a2600_state::a2600_tia_vsync_callback_pal) if ( supported_screen_heights[i] != m_current_screen_height ) { m_current_screen_height = supported_screen_heights[i]; -// machine.first_screen()->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height ); +// m_screen->configure(228, m_current_screen_height, &visarea[i], HZ_TO_ATTOSECONDS( MASTER_CLOCK_PAL ) * 228 * m_current_screen_height ); } } } @@ -316,6 +316,8 @@ MACHINE_START_MEMBER(a2600_state,a2600) /* Banks may have changed, reset the cpu so it uses the correct reset vector */ m_maincpu->reset(); + + save_item(NAME(m_current_screen_height)); } @@ -541,5 +543,5 @@ ROM_END #define rom_a2600p rom_a2600 /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -CONS( 1977, a2600, 0, 0, a2600, a2600, driver_device, 0, "Atari", "Atari 2600 (NTSC)" , 0) -CONS( 1978, a2600p, a2600, 0, a2600p, a2600, driver_device, 0, "Atari", "Atari 2600 (PAL)", 0) +CONS( 1977, a2600, 0, 0, a2600, a2600, driver_device, 0, "Atari", "Atari 2600 (NTSC)" , GAME_SUPPORTS_SAVE ) +CONS( 1978, a2600p, a2600, 0, a2600p, a2600, driver_device, 0, "Atari", "Atari 2600 (PAL)", GAME_SUPPORTS_SAVE ) diff --git a/src/mess/drivers/comp4.c b/src/mess/drivers/comp4.c index 240f259cef1..90dd25dcfed 100644 --- a/src/mess/drivers/comp4.c +++ b/src/mess/drivers/comp4.c @@ -141,20 +141,20 @@ WRITE16_MEMBER(comp4_state::write_o) static INPUT_PORTS_START( comp4 ) PORT_START("IN.0") // O1 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_R) PORT_CODE(KEYCODE_DEL) PORT_CODE(KEYCODE_DEL_PAD) PORT_NAME("R") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_1) PORT_CODE(KEYCODE_1_PAD) PORT_NAME("1") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CODE(KEYCODE_4_PAD) PORT_NAME("4") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CODE(KEYCODE_7_PAD) PORT_NAME("7") PORT_START("IN.1") // O2 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_0) PORT_CODE(KEYCODE_0_PAD) PORT_NAME("0") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2) PORT_CODE(KEYCODE_2_PAD) PORT_NAME("2") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CODE(KEYCODE_5_PAD) PORT_NAME("5") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CODE(KEYCODE_8_PAD) PORT_NAME("8") PORT_START("IN.2") // O3 PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_E) PORT_CODE(KEYCODE_ENTER) PORT_CODE(KEYCODE_ENTER_PAD) PORT_NAME("E") - PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") - PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_3) PORT_CODE(KEYCODE_3_PAD) PORT_NAME("3") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CODE(KEYCODE_6_PAD) PORT_NAME("6") PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_9) PORT_CODE(KEYCODE_9_PAD) PORT_NAME("9") INPUT_PORTS_END diff --git a/src/mess/drivers/elecdet.c b/src/mess/drivers/elecdet.c index 506236a4096..edfa2fa71ef 100644 --- a/src/mess/drivers/elecdet.c +++ b/src/mess/drivers/elecdet.c @@ -7,8 +7,9 @@ hardware (and concept) is very similar to Parker Bros Stop Thief This is an electronic board game. It requires game cards with suspect info, - and good old pen and paper to record game progress. Refer to the manual - on how to play it. + and good old pen and paper to record game progress. To start the game, enter + difficulty(1-3), then number of players(1-4), then [ENTER]. Refer to the + manual for more information. TODO: @@ -296,7 +297,7 @@ MACHINE_CONFIG_END ROM_START( elecdet ) ROM_REGION( 0x1000, "maincpu", 0 ) - ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(f33f02ae) SHA1(a978d9cc1ba7897f6e8997715da265eb8c4a0c34) ) + ROM_LOAD( "tms0980nll_mp6100a", 0x0000, 0x1000, CRC(8160a081) SHA1(14cbfc0529ad83a58e0dc15fe8ba594947e49f08) ) ROM_REGION( 1246, "maincpu:ipla", 0 ) ROM_LOAD( "tms0980_default_ipla.pla", 0, 1246, CRC(42db9a38) SHA1(2d127d98028ec8ec6ea10c179c25e447b14ba4d0) ) diff --git a/src/mess/drivers/ngen.c b/src/mess/drivers/ngen.c index ca8bf96fea8..9bfbf0120c2 100644 --- a/src/mess/drivers/ngen.c +++ b/src/mess/drivers/ngen.c @@ -87,7 +87,9 @@ public: m_vram(*this,"vram"), m_fontram(*this,"fontram"), m_fdc(*this,"fdc"), - m_fd0(*this,"fdc:0") + m_fd0(*this,"fdc:0"), + m_fdc_timer(*this,"fdc_timer"), + m_hdc_timer(*this,"hdc_timer") {} DECLARE_WRITE_LINE_MEMBER(pit_out0_w); @@ -98,8 +100,8 @@ public: DECLARE_WRITE16_MEMBER(cpu_peripheral_cb); DECLARE_WRITE16_MEMBER(peripheral_w); DECLARE_READ16_MEMBER(peripheral_r); - DECLARE_WRITE16_MEMBER(port00_w); - DECLARE_READ16_MEMBER(port00_r); + DECLARE_WRITE16_MEMBER(xbus_w); + DECLARE_READ16_MEMBER(xbus_r); DECLARE_WRITE_LINE_MEMBER(dma_hrq_changed); DECLARE_WRITE_LINE_MEMBER(dma_eop_changed); DECLARE_WRITE_LINE_MEMBER(dack0_w); @@ -118,6 +120,9 @@ public: DECLARE_WRITE8_MEMBER( dma_1_dack_w ){ } DECLARE_WRITE8_MEMBER( dma_2_dack_w ){ } DECLARE_WRITE8_MEMBER( dma_3_dack_w ){ popmessage("IOW3: data %02x",data); } + + DECLARE_WRITE16_MEMBER(hfd_w); + DECLARE_READ16_MEMBER(fhd_r); DECLARE_WRITE_LINE_MEMBER(fdc_irq_w); DECLARE_WRITE_LINE_MEMBER(fdc_drq_w); DECLARE_WRITE8_MEMBER(fdc_control_w); @@ -141,9 +146,12 @@ private: optional_shared_ptr<UINT16> m_fontram; optional_device<wd2797_t> m_fdc; optional_device<floppy_connector> m_fd0; + optional_device<pit8253_device> m_fdc_timer; + optional_device<pit8253_device> m_hdc_timer; void set_dma_channel(int channel, int state); + UINT8 m_xbus_current; // currently selected X-Bus module UINT16 m_peripheral; UINT16 m_upper; UINT16 m_middle; @@ -265,6 +273,9 @@ WRITE16_MEMBER(ngen_state::peripheral_w) if(mem_mask & 0x00ff) m_dma_offset[offset-0x80] = data & 0xff; break; + case 0xc0: // X-Bus modules reset + m_xbus_current = 0; + break; case 0x10c: if(mem_mask & 0x00ff) m_pic->write(space,0,data & 0xff); @@ -386,23 +397,141 @@ READ16_MEMBER(ngen_state::peripheral_r) // X-bus module select // The bootstrap ROM creates a table at 0:FC9h, with a count, followed by the module IDs of each -// expansion module. The base I/O address for each module is 0x100*module number. -// Module 0 is the main processor module, module 1 is the next module attached, and so on. -WRITE16_MEMBER(ngen_state::port00_w) +// expansion module. The base I/O address for the currently selected module is set by writing to +// this register (bits 0-7 are ignored) +// TODO: make expansion modules slot devices +WRITE16_MEMBER(ngen_state::xbus_w) +{ + UINT16 addr = (data & 0x00ff) << 8; + address_space& io = m_maincpu->device_t::memory().space(AS_IO); + switch(m_xbus_current) + { + case 0x00: // Floppy/Hard disk module + io.install_readwrite_handler(addr,addr+0xff,0,0,read16_delegate(FUNC(ngen_state::fhd_r),this),write16_delegate(FUNC(ngen_state::hfd_w),this)); + break; + default: + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // reached end of the modules + break; + } + if(addr != 0) + logerror("SYS: X-Bus module %i address set %04x\n",m_xbus_current+1,addr); + m_xbus_current++; +} + +// returns X-bus module ID and info in the low byte (can indicate if the device is bootable, has a boot ROM (needs to be written to RAM via DMA), or if it supports a non-80186 CPU) +// bit 6, I think, indicates a bootable device +// Known module IDs: +// 0x1070 - Floppy/Hard disk module +// 0x3141 - QIC Tape module +READ16_MEMBER(ngen_state::xbus_r) +{ + UINT16 ret = 0xffff; + + switch(m_xbus_current) + { + case 0x00: + ret = 0x1070; // Floppy/Hard disk module + break; + default: + m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); // reached the end of the modules + ret = 0x0080; + break; + } + return ret; +} + + +// Floppy/Hard disk module +WRITE16_MEMBER(ngen_state::hfd_w) { - m_port00 = data; - logerror("SYS: X-Bus module select %04x\n",data); + switch(offset) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + if(mem_mask & 0x00ff) + m_fdc->write(space,offset,data & 0xff); + break; + case 0x04: + if(mem_mask & 0x00ff) + fdc_control_w(space,offset,data & 0xff); + break; + case 0x05: + if(mem_mask & 0x00ff) + hdc_control_w(space,offset,data & 0xff); + break; + case 0x07: + if(mem_mask & 0x00ff) + disk_addr_ext(space,offset,data & 0xff); + break; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + if(mem_mask & 0x00ff) + m_fdc_timer->write(space,offset,data & 0xff); + break; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + logerror("WD1010 register %i write %02x mask %04x\n",offset-0x10,data & 0xff,mem_mask); + break; + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + if(mem_mask & 0x00ff) + m_hdc_timer->write(space,offset,data & 0xff); + break; + } } -// returns X-bus module ID (what is the low byte for?) -READ16_MEMBER(ngen_state::port00_r) +READ16_MEMBER(ngen_state::fhd_r) { - if(m_port00 > 0) - m_maincpu->set_input_line(INPUT_LINE_NMI,PULSE_LINE); - if(m_port00 == 0) - return 0x1070; // module ID of 0x1070, according to the floppy/hard disk tech manual - else - return 0x0080; // invalid device? + UINT16 ret = 0xffff; + + switch(offset) + { + case 0x00: + case 0x01: + case 0x02: + case 0x03: + if(mem_mask & 0x00ff) + ret = m_fdc->read(space,offset); + break; + case 0x08: + case 0x09: + case 0x0a: + case 0x0b: + if(mem_mask & 0x00ff) + ret = m_fdc_timer->read(space,offset); + break; + case 0x10: + case 0x11: + case 0x12: + case 0x13: + case 0x14: + case 0x15: + case 0x16: + case 0x17: + logerror("WD1010 register %i read, mask %04x\n",offset-0x10,mem_mask); + break; + case 0x18: + case 0x19: + case 0x1a: + case 0x1b: + if(mem_mask & 0x00ff) + ret = m_hdc_timer->read(space,offset); + break; + } + + return ret; } WRITE_LINE_MEMBER(ngen_state::fdc_irq_w) @@ -564,6 +693,7 @@ void ngen_state::machine_reset() { m_port00 = 0; m_control = 0; + m_xbus_current = 0; m_viduart->write_dsr(0); m_viduart->write_cts(0); m_fd0->get_device()->set_rpm(300); @@ -578,17 +708,16 @@ static ADDRESS_MAP_START( ngen_mem, AS_PROGRAM, 16, ngen_state ) ADDRESS_MAP_END static ADDRESS_MAP_START( ngen_io, AS_IO, 16, ngen_state ) - AM_RANGE(0x0000, 0x0001) AM_READWRITE(port00_r,port00_w) + AM_RANGE(0x0000, 0x0001) AM_READWRITE(xbus_r,xbus_w) - // TODO: allow for expansion modules to be allocated where asked to // Floppy/Hard disk module - AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff) // a guess for now - AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff) - AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff) - AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff) // X-Bus extended address register - AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff) +// AM_RANGE(0x0100, 0x0107) AM_DEVREADWRITE8("fdc",wd2797_t,read,write,0x00ff) // a guess for now +// AM_RANGE(0x0108, 0x0109) AM_WRITE8(fdc_control_w,0x00ff) +// AM_RANGE(0x010a, 0x010b) AM_WRITE8(hdc_control_w,0x00ff) +// AM_RANGE(0x010e, 0x010f) AM_WRITE8(disk_addr_ext,0x00ff) // X-Bus extended address register +// AM_RANGE(0x0110, 0x0117) AM_DEVREADWRITE8("fdc_timer",pit8253_device,read,write,0x00ff) // 0x0120-0x012f - WD1010 Winchester disk controller (unemulated) - AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff) +// AM_RANGE(0x0130, 0x0137) AM_DEVREADWRITE8("hdc_timer",pit8253_device,read,write,0x00ff) ADDRESS_MAP_END diff --git a/src/mess/drivers/splitsec.c b/src/mess/drivers/splitsec.c new file mode 100644 index 00000000000..30ed07f08cf --- /dev/null +++ b/src/mess/drivers/splitsec.c @@ -0,0 +1,242 @@ +// license:BSD-3-Clause +// copyright-holders:hap +/*************************************************************************** + + Parker Brothers Split Second + * TMS1400NLL MP7314-N2 (die labeled MP7314) + + +***************************************************************************/ + +#include "emu.h" +#include "cpu/tms0980/tms0980.h" +#include "sound/speaker.h" + +#include "splitsec.lh" + +// master clock is a single stage RC oscillator: R=24K, C=100pf, +// according to the TMS 1000 series data manual this is around 375kHz +#define MASTER_CLOCK (375000) + + +class splitsec_state : public driver_device +{ +public: + splitsec_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_button_matrix(*this, "IN"), + m_speaker(*this, "speaker") + { } + + required_device<cpu_device> m_maincpu; + required_ioport_array<2> m_button_matrix; + required_device<speaker_sound_device> m_speaker; + + UINT16 m_r; + UINT16 m_o; + + UINT16 m_leds_state[0x10]; + UINT16 m_leds_cache[0x10]; + UINT8 m_leds_decay[0x100]; + + DECLARE_READ8_MEMBER(read_k); + DECLARE_WRITE16_MEMBER(write_o); + DECLARE_WRITE16_MEMBER(write_r); + + TIMER_DEVICE_CALLBACK_MEMBER(leds_decay_tick); + void leds_update(); + + virtual void machine_start(); +}; + + + +/*************************************************************************** + + LEDs + +***************************************************************************/ + +// The device strobes the outputs very fast, it is unnoticeable to the user. +// To prevent flickering here, we need to simulate a decay. + +// decay time, in steps of 10ms +#define LEDS_DECAY_TIME 4 + +void splitsec_state::leds_update() +{ + UINT16 active_state[0x10]; + + for (int i = 0; i < 0x10; i++) + { + // update current state + if (m_r >> i & 1) + m_leds_state[i] = m_o; + + active_state[i] = 0; + + for (int j = 0; j < 0x10; j++) + { + int di = j << 4 | i; + + // turn on powered leds + if (m_leds_state[i] >> j & 1) + m_leds_decay[di] = LEDS_DECAY_TIME; + + // determine active state + int ds = (m_leds_decay[di] != 0) ? 1 : 0; + active_state[i] |= (ds << j); + } + } + + // on difference, send to output + for (int i = 0; i < 0x10; i++) + if (m_leds_cache[i] != active_state[i]) + { + for (int j = 0; j < 8; j++) + output_set_lamp_value(i*10 + j, active_state[i] >> j & 1); + } + + memcpy(m_leds_cache, active_state, sizeof(m_leds_cache)); +} + +TIMER_DEVICE_CALLBACK_MEMBER(splitsec_state::leds_decay_tick) +{ + // slowly turn off unpowered leds + for (int i = 0; i < 0x100; i++) + if (!(m_leds_state[i & 0xf] >> (i>>4) & 1) && m_leds_decay[i]) + m_leds_decay[i]--; + + leds_update(); +} + + + +/*************************************************************************** + + I/O + +***************************************************************************/ + +READ8_MEMBER(splitsec_state::read_k) +{ + UINT8 k = 0; + + // read selected button rows + for (int i = 0; i < 2; i++) + if (m_r >> (i+9) & 1) + k |= m_button_matrix[i]->read(); + + return k; +} + +WRITE16_MEMBER(splitsec_state::write_r) +{ + // R8: speaker out + m_speaker->level_w(data >> 8 & 1); + + // R9,R10: input mux + // R0-R7: led columns + m_r = data; + leds_update(); +} + +WRITE16_MEMBER(splitsec_state::write_o) +{ + // O0-O6: led rows + // O7: N/C + m_o = data; + leds_update(); +} + + + +/*************************************************************************** + + Inputs + +***************************************************************************/ + +static INPUT_PORTS_START( splitsec ) + PORT_START("IN.0") // R9 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) + + PORT_START("IN.1") // R10 + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Select") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Start") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) +INPUT_PORTS_END + + + +/*************************************************************************** + + Machine Config + +***************************************************************************/ + +void splitsec_state::machine_start() +{ + // zerofill + memset(m_leds_state, 0, sizeof(m_leds_state)); + memset(m_leds_cache, 0, sizeof(m_leds_cache)); + memset(m_leds_decay, 0, sizeof(m_leds_decay)); + + m_r = 0; + m_o = 0; + + // register for savestates + save_item(NAME(m_leds_state)); + save_item(NAME(m_leds_cache)); + save_item(NAME(m_leds_decay)); + + save_item(NAME(m_r)); + save_item(NAME(m_o)); +} + + +static MACHINE_CONFIG_START( splitsec, splitsec_state ) + + /* basic machine hardware */ + MCFG_CPU_ADD("maincpu", TMS1400, MASTER_CLOCK) + MCFG_TMS1XXX_READ_K_CB(READ8(splitsec_state, read_k)) + MCFG_TMS1XXX_WRITE_O_CB(WRITE16(splitsec_state, write_o)) + MCFG_TMS1XXX_WRITE_R_CB(WRITE16(splitsec_state, write_r)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("leds_decay", splitsec_state, leds_decay_tick, attotime::from_msec(10)) + + MCFG_DEFAULT_LAYOUT(layout_splitsec) + + /* no video! */ + + /* sound hardware */ + MCFG_SPEAKER_STANDARD_MONO("mono") + MCFG_SOUND_ADD("speaker", SPEAKER_SOUND, 0) + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) +MACHINE_CONFIG_END + + + +/*************************************************************************** + + Game driver(s) + +***************************************************************************/ + +ROM_START( splitsec ) + ROM_REGION( 0x1000, "maincpu", 0 ) + ROM_LOAD( "tms1400nll_mp7314", 0x0000, 0x1000, CRC(0cccdf59) SHA1(06a533134a433aaf856b80f0ca239d0498b98d5f) ) + + ROM_REGION( 867, "maincpu:mpla", 0 ) + ROM_LOAD( "tms1100_default_mpla.pla", 0, 867, CRC(62445fc9) SHA1(d6297f2a4bc7a870b76cc498d19dbb0ce7d69fec) ) + ROM_REGION( 557, "maincpu:opla", 0 ) + ROM_LOAD( "tms1400_splitsec_opla.pla", 0, 557, CRC(7539283b) SHA1(f791fa98259fc10c393ff1961d4c93040f1a2932) ) +ROM_END + + +CONS( 1980, splitsec, 0, 0, splitsec, splitsec, driver_device, 0, "Parker Brothers", "Split Second", GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) diff --git a/src/mess/includes/msx.h b/src/mess/includes/msx.h index 4274bafeabe..b2e73582297 100644 --- a/src/mess/includes/msx.h +++ b/src/mess/includes/msx.h @@ -24,7 +24,6 @@ #include "formats/basicdsk.h" #include "formats/fmsx_cas.h" #include "formats/msx_dsk.h" -//#include "osdepend.h" #include "hashfile.h" #include "machine/wd_fdc.h" #include "imagedev/floppy.h" diff --git a/src/mess/layout/splitsec.lay b/src/mess/layout/splitsec.lay new file mode 100644 index 00000000000..a6151599d87 --- /dev/null +++ b/src/mess/layout/splitsec.lay @@ -0,0 +1,93 @@ +<?xml version="1.0"?> +<mamelayout version="2"> + +<!-- define elements --> + + <element name="static_black"><rect><color red="0.0" green="0.0" blue="0.0" /></rect></element> + + <element name="lamp_disk" defstate="0"> + <disk state="1"><color red="1.0" green="0.24" blue="0.26" /></disk> + <disk state="0"><color red="0.15" green="0.043" blue="0.047" /></disk> + </element> + <element name="lamp_rect" defstate="0"> + <rect state="1"><color red="1.0" green="0.24" blue="0.26" /></rect> + <rect state="0"><color red="0.15" green="0.043" blue="0.047" /></rect> + </element> + + +<!-- build screen --> + + <view name="Internal Layout"> + <bounds left="0" right="18" top="0" bottom="28" /> + <bezel element="static_black"> + <bounds left="0" right="18" top="0" bottom="28" /> + </bezel> + + <!-- maze of lamps --> + + <bezel name="lamp6" element="lamp_rect"><bounds x="2" y="1" width="4" height="1" /></bezel> + <bezel name="lamp4" element="lamp_rect"><bounds x="7" y="1" width="4" height="1" /></bezel> + <bezel name="lamp2" element="lamp_rect"><bounds x="12" y="1" width="4" height="1" /></bezel> + + <bezel name="lamp16" element="lamp_rect"><bounds x="1" y="2" width="1" height="4" /></bezel> + <bezel name="lamp5" element="lamp_disk"><bounds x="3" y="3" width="2" height="2" /></bezel> + <bezel name="lamp14" element="lamp_rect"><bounds x="6" y="2" width="1" height="4" /></bezel> + <bezel name="lamp3" element="lamp_disk"><bounds x="8" y="3" width="2" height="2" /></bezel> + <bezel name="lamp12" element="lamp_rect"><bounds x="11" y="2" width="1" height="4" /></bezel> + <bezel name="lamp1" element="lamp_disk"><bounds x="13" y="3" width="2" height="2" /></bezel> + <bezel name="lamp10" element="lamp_rect"><bounds x="16" y="2" width="1" height="4" /></bezel> + + <bezel name="lamp15" element="lamp_rect"><bounds x="2" y="6" width="4" height="1" /></bezel> + <bezel name="lamp13" element="lamp_rect"><bounds x="7" y="6" width="4" height="1" /></bezel> + <bezel name="lamp11" element="lamp_rect"><bounds x="12" y="6" width="4" height="1" /></bezel> + + <bezel name="lamp26" element="lamp_rect"><bounds x="1" y="7" width="1" height="4" /></bezel> + <bezel name="lamp25" element="lamp_disk"><bounds x="3" y="8" width="2" height="2" /></bezel> + <bezel name="lamp24" element="lamp_rect"><bounds x="6" y="7" width="1" height="4" /></bezel> + <bezel name="lamp23" element="lamp_disk"><bounds x="8" y="8" width="2" height="2" /></bezel> + <bezel name="lamp22" element="lamp_rect"><bounds x="11" y="7" width="1" height="4" /></bezel> + <bezel name="lamp21" element="lamp_disk"><bounds x="13" y="8" width="2" height="2" /></bezel> + <bezel name="lamp20" element="lamp_rect"><bounds x="16" y="7" width="1" height="4" /></bezel> + + <bezel name="lamp35" element="lamp_rect"><bounds x="2" y="11" width="4" height="1" /></bezel> + <bezel name="lamp33" element="lamp_rect"><bounds x="7" y="11" width="4" height="1" /></bezel> + <bezel name="lamp31" element="lamp_rect"><bounds x="12" y="11" width="4" height="1" /></bezel> + + <bezel name="lamp36" element="lamp_rect"><bounds x="1" y="12" width="1" height="4" /></bezel> + <bezel name="lamp45" element="lamp_disk"><bounds x="3" y="13" width="2" height="2" /></bezel> + <bezel name="lamp34" element="lamp_rect"><bounds x="6" y="12" width="1" height="4" /></bezel> + <bezel name="lamp43" element="lamp_disk"><bounds x="8" y="13" width="2" height="2" /></bezel> + <bezel name="lamp32" element="lamp_rect"><bounds x="11" y="12" width="1" height="4" /></bezel> + <bezel name="lamp41" element="lamp_disk"><bounds x="13" y="13" width="2" height="2" /></bezel> + <bezel name="lamp30" element="lamp_rect"><bounds x="16" y="12" width="1" height="4" /></bezel> + + <bezel name="lamp55" element="lamp_rect"><bounds x="2" y="16" width="4" height="1" /></bezel> + <bezel name="lamp53" element="lamp_rect"><bounds x="7" y="16" width="4" height="1" /></bezel> + <bezel name="lamp51" element="lamp_rect"><bounds x="12" y="16" width="4" height="1" /></bezel> + + <bezel name="lamp46" element="lamp_rect"><bounds x="1" y="17" width="1" height="4" /></bezel> + <bezel name="lamp65" element="lamp_disk"><bounds x="3" y="18" width="2" height="2" /></bezel> + <bezel name="lamp44" element="lamp_rect"><bounds x="6" y="17" width="1" height="4" /></bezel> + <bezel name="lamp63" element="lamp_disk"><bounds x="8" y="18" width="2" height="2" /></bezel> + <bezel name="lamp42" element="lamp_rect"><bounds x="11" y="17" width="1" height="4" /></bezel> + <bezel name="lamp61" element="lamp_disk"><bounds x="13" y="18" width="2" height="2" /></bezel> + <bezel name="lamp40" element="lamp_rect"><bounds x="16" y="17" width="1" height="4" /></bezel> + + <bezel name="lamp75" element="lamp_rect"><bounds x="2" y="21" width="4" height="1" /></bezel> + <bezel name="lamp73" element="lamp_rect"><bounds x="7" y="21" width="4" height="1" /></bezel> + <bezel name="lamp71" element="lamp_rect"><bounds x="12" y="21" width="4" height="1" /></bezel> + + <bezel name="lamp56" element="lamp_rect"><bounds x="1" y="22" width="1" height="4" /></bezel> + <bezel name="lamp66" element="lamp_disk"><bounds x="3" y="23" width="2" height="2" /></bezel> + <bezel name="lamp54" element="lamp_rect"><bounds x="6" y="22" width="1" height="4" /></bezel> + <bezel name="lamp64" element="lamp_disk"><bounds x="8" y="23" width="2" height="2" /></bezel> + <bezel name="lamp52" element="lamp_rect"><bounds x="11" y="22" width="1" height="4" /></bezel> + <bezel name="lamp62" element="lamp_disk"><bounds x="13" y="23" width="2" height="2" /></bezel> + <bezel name="lamp50" element="lamp_rect"><bounds x="16" y="22" width="1" height="4" /></bezel> + + <bezel name="lamp76" element="lamp_rect"><bounds x="2" y="26" width="4" height="1" /></bezel> + <bezel name="lamp74" element="lamp_rect"><bounds x="7" y="26" width="4" height="1" /></bezel> + <bezel name="lamp72" element="lamp_rect"><bounds x="12" y="26" width="4" height="1" /></bezel> + + </view> +</mamelayout> diff --git a/src/mess/mess.lst b/src/mess/mess.lst index 333d0c1ede3..63dc3a62701 100644 --- a/src/mess/mess.lst +++ b/src/mess/mess.lst @@ -2269,6 +2269,7 @@ starwbc starwbcp stopthie stopthiep +splitsec amico2k jtc jtces88 diff --git a/src/mess/mess.mak b/src/mess/mess.mak index 459c397b142..10f96f0cd16 100644 --- a/src/mess/mess.mak +++ b/src/mess/mess.mak @@ -1490,6 +1490,7 @@ $(MESSOBJ)/palm.a: \ $(MESSOBJ)/parker.a: \ $(MESS_DRIVERS)/cnsector.o \ $(MESS_DRIVERS)/merlin.o \ + $(MESS_DRIVERS)/splitsec.o \ $(MESS_DRIVERS)/stopthie.o \ $(MESSOBJ)/pitronic.a: \ @@ -2171,6 +2172,7 @@ $(MESS_DRIVERS)/simon.o: $(MESS_LAYOUT)/simon.lh $(MESS_DRIVERS)/sitcom.o: $(MESS_LAYOUT)/sitcom.lh $(MESS_DRIVERS)/slc1.o: $(MESS_LAYOUT)/slc1.lh $(MESS_DRIVERS)/sms.o: $(MESS_LAYOUT)/sms1.lh +$(MESS_DRIVERS)/splitsec.o: $(MESS_LAYOUT)/splitsec.lh $(MESS_DRIVERS)/starwbc.o: $(MESS_LAYOUT)/starwbc.lh $(MESS_DRIVERS)/stopthie.o: $(MESS_LAYOUT)/stopthie.lh $(MESS_DRIVERS)/super80.o: $(MESS_LAYOUT)/super80.lh diff --git a/src/osd/modules/lib/osdobj_common.c b/src/osd/modules/lib/osdobj_common.c index 2395fa461df..74de4ec4540 100644 --- a/src/osd/modules/lib/osdobj_common.c +++ b/src/osd/modules/lib/osdobj_common.c @@ -346,7 +346,7 @@ void osd_common_t::customize_input_type_list(simple_list<input_type_entry> &type // font with the given name //------------------------------------------------- -osd_font osd_common_t::font_open(const char *name, int &height) +osd_font *osd_common_t::font_open(const char *name, int &height) { return NULL; } @@ -357,7 +357,7 @@ osd_font osd_common_t::font_open(const char *name, int &height) // a given OSD font //------------------------------------------------- -void osd_common_t::font_close(osd_font font) +void osd_common_t::font_close(osd_font *font) { } @@ -370,7 +370,7 @@ void osd_common_t::font_close(osd_font font) // pixel of a black & white font //------------------------------------------------- -bool osd_common_t::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) +bool osd_common_t::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) { return false; } diff --git a/src/osd/modules/lib/osdobj_common.h b/src/osd/modules/lib/osdobj_common.h index 3a9ee4d9783..42e211853d6 100644 --- a/src/osd/modules/lib/osdobj_common.h +++ b/src/osd/modules/lib/osdobj_common.h @@ -153,9 +153,9 @@ public: virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); // font overridables - virtual osd_font font_open(const char *name, int &height); - virtual void font_close(osd_font font); - virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); + virtual osd_font *font_open(const char *name, int &height); + virtual void font_close(osd_font *font); + virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); // video overridables virtual void *get_slider_list(); diff --git a/src/osd/osdcore.c b/src/osd/osdcore.c index 41214b3c852..5079f8be2d6 100644 --- a/src/osd/osdcore.c +++ b/src/osd/osdcore.c @@ -53,8 +53,10 @@ static output_delegate output_cb[OSD_OUTPUT_CHANNEL_COUNT] = output_delegate osd_set_output_channel(output_channel channel, output_delegate callback) { - assert(channel < OSD_OUTPUT_CHANNEL_COUNT); - assert(!callback.isnull()); + if (!(channel < OSD_OUTPUT_CHANNEL_COUNT) || callback.isnull()) + { + throw std::exception(); + } /* return the originals if requested */ output_delegate prevcb = output_cb[channel]; diff --git a/src/osd/osdepend.h b/src/osd/osdepend.h index 9e18bc9691f..4a1de30af1e 100644 --- a/src/osd/osdepend.h +++ b/src/osd/osdepend.h @@ -27,7 +27,7 @@ class input_type_entry; // FIXME: including emu.h does not work because emu. //============================================================ // FIXME: We can do better than this -typedef void *osd_font; +class osd_font; // ======================> osd_interface @@ -53,9 +53,9 @@ public: virtual void customize_input_type_list(simple_list<input_type_entry> &typelist) = 0; // font overridables - virtual osd_font font_open(const char *name, int &height) = 0; - virtual void font_close(osd_font font) = 0; - virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0; + virtual osd_font *font_open(const char *name, int &height) = 0; + virtual void font_close(osd_font *font) = 0; + virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) = 0; // video overridables virtual void *get_slider_list() = 0; // FIXME: returns slider_state * diff --git a/src/osd/osdmini/minimain.c b/src/osd/osdmini/minimain.c index 98964fc546f..c0598e65dfd 100644 --- a/src/osd/osdmini/minimain.c +++ b/src/osd/osdmini/minimain.c @@ -55,6 +55,16 @@ static INT32 keyboard_get_state(void *device_internal, void *item_internal); //============================================================ +// mini_osd_options +//============================================================ + +mini_osd_options::mini_osd_options() +: osd_options() +{ + //add_entries(s_option_entries); +} + +//============================================================ // main //============================================================ @@ -62,9 +72,9 @@ int main(int argc, char *argv[]) { // cli_frontend does the heavy lifting; if we have osd-specific options, we // create a derivative of cli_options and add our own - cli_options options; - mini_osd_interface osd; - osd.register_options(options); + mini_osd_options options; + mini_osd_interface osd(options); + osd.register_options(); cli_frontend frontend(options, osd); return frontend.execute(argc, argv); } @@ -74,7 +84,8 @@ int main(int argc, char *argv[]) // constructor //============================================================ -mini_osd_interface::mini_osd_interface() +mini_osd_interface::mini_osd_interface(mini_osd_options &options) +: osd_common_t(options) { } @@ -95,7 +106,7 @@ mini_osd_interface::~mini_osd_interface() void mini_osd_interface::init(running_machine &machine) { // call our parent - osd_interface::init(machine); + osd_common_t::init(machine); // initialize the video system by allocating a rendering target our_target = machine.render().target_alloc(); diff --git a/src/osd/osdmini/osdmini.h b/src/osd/osdmini/osdmini.h index 35db06c881c..c0519c98b12 100644 --- a/src/osd/osdmini/osdmini.h +++ b/src/osd/osdmini/osdmini.h @@ -8,17 +8,26 @@ #include "options.h" #include "osdepend.h" +#include "modules/lib/osdobj_common.h" +class mini_osd_options : public osd_options +{ +public: + // construction/destruction + mini_osd_options(); + +}; + //============================================================ // TYPE DEFINITIONS //============================================================ -class mini_osd_interface : public osd_interface +class mini_osd_interface : public osd_common_t { public: // construction/destruction - mini_osd_interface(); + mini_osd_interface(mini_osd_options &options); virtual ~mini_osd_interface(); // general overridables diff --git a/src/osd/osdmini/osdmini.mak b/src/osd/osdmini/osdmini.mak index db78f4fce78..4ce98edbcd0 100644 --- a/src/osd/osdmini/osdmini.mak +++ b/src/osd/osdmini/osdmini.mak @@ -50,9 +50,10 @@ MINIOBJ = $(OBJ)/osd/$(OSD) OSDSRC = $(SRC)/osd OSDOBJ = $(OBJ)/osd -OBJDIRS += $(MINIOBJ) $(OSDOBJ)/modules/sync - - +OBJDIRS += $(MINIOBJ) \ + $(OSDOBJ)/modules/sync \ + $(OSDOBJ)/modules/lib \ + $(OSDOBJ)/modules/midi #------------------------------------------------- # OSD core library @@ -64,14 +65,16 @@ OSDCOREOBJS = \ $(MINIOBJ)/minimisc.o \ $(MINIOBJ)/minisync.o \ $(MINIOBJ)/minitime.o \ - $(OSDOBJ)/modules/sync/work_mini.o \ #------------------------------------------------- # OSD mini library #------------------------------------------------- OSDOBJS = \ - $(MINIOBJ)/minimain.o + $(MINIOBJ)/minimain.o \ + $(OSDOBJ)/modules/sync/work_mini.o \ + $(OSDOBJ)/modules/lib/osdobj_common.o \ + $(OSDOBJ)/modules/midi/none.o \ ifeq ($(OS),Windows_NT) LIBS += -lwinmm -lwsock32 diff --git a/src/osd/sdl/draw13.c b/src/osd/sdl/draw13.c index 57b21f8f02e..c6cc098592d 100644 --- a/src/osd/sdl/draw13.c +++ b/src/osd/sdl/draw13.c @@ -134,11 +134,12 @@ public: const HashT hash() const { return m_hash; } const UINT32 flags() const { return m_flags; } const bool is_pixels_owned() const { // do we own / allocated it ? - return m_sdl_access == SDL_TEXTUREACCESS_STATIC - && m_copyinfo->func != NULL ; + return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC) + && (m_copyinfo->func != NULL)) ; } private: + Uint32 m_sdl_access; SDL_Renderer * m_renderer; render_texinfo m_texinfo; // copy of the texture info HashT m_hash; // hash value for the texture (must be >= pointer size) @@ -149,7 +150,6 @@ private: int m_format; // texture format SDL_BlendMode m_sdl_blendmode; - Uint32 m_sdl_access; texture_info * m_next; // next texture in the list }; @@ -490,6 +490,7 @@ static void expand_copy_info(copy_info_t *list) } } +// FIXME: machine only used to access options. int drawsdl2_init(running_machine &machine, sdl_draw_info *callbacks) { const char *stemp; @@ -1007,9 +1008,9 @@ texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsour texture_info::~texture_info() { - SDL_DestroyTexture(m_texture_id); - if ( is_pixels_owned() && m_pixels != NULL ) + if ( is_pixels_owned() && (m_pixels != NULL) ) free(m_pixels); + SDL_DestroyTexture(m_texture_id); } //============================================================ diff --git a/src/osd/sdl/osdsdl.h b/src/osd/sdl/osdsdl.h index 2203f2c1a03..24c8d94703a 100644 --- a/src/osd/sdl/osdsdl.h +++ b/src/osd/sdl/osdsdl.h @@ -115,12 +115,6 @@ // TYPE DEFINITIONS //============================================================ -typedef void *osd_font; - -//============================================================ -// TYPE DEFINITIONS -//============================================================ - class sdl_options : public osd_options { public: @@ -193,9 +187,9 @@ public: virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); // font overridables - virtual osd_font font_open(const char *name, int &height); - virtual void font_close(osd_font font); - virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); + virtual osd_font *font_open(const char *name, int &height); + virtual void font_close(osd_font *font); + virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); virtual void video_register(); virtual void sound_register(); diff --git a/src/osd/sdl/sdlmain.c b/src/osd/sdl/sdlmain.c index fc402337a4a..d367e1d6d50 100644 --- a/src/osd/sdl/sdlmain.c +++ b/src/osd/sdl/sdlmain.c @@ -717,7 +717,13 @@ void sdl_osd_interface::init(running_machine &machine) // font with the given name //------------------------------------------------- -osd_font sdl_osd_interface::font_open(const char *_name, int &height) +class osd_font +{ +public: + CTFontRef m_font; +}; + +osd_font *sdl_osd_interface::font_open(const char *_name, int &height) { CFStringRef font_name = NULL; CTFontRef ct_font = NULL; @@ -770,7 +776,9 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height) line_height += CTFontGetLeading(ct_font); height = ceilf(line_height * EXTRA_HEIGHT); - return (osd_font)ct_font; + osd_font *ret = global_alloc(osd_font); + ret->m_font = ct_font; + return ret; } //------------------------------------------------- @@ -778,14 +786,15 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height) // a given OSD font //------------------------------------------------- -void sdl_osd_interface::font_close(osd_font font) +void sdl_osd_interface::font_close(osd_font *font) { - CTFontRef ct_font = (CTFontRef)font; + CTFontRef ct_font = font->m_font; if( ct_font != NULL ) { CFRelease( ct_font ); } + global_free(font); } //------------------------------------------------- @@ -796,11 +805,11 @@ void sdl_osd_interface::font_close(osd_font font) // pixel of a black & white font //------------------------------------------------- -bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) +bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) { UniChar uni_char; CGGlyph glyph; - CTFontRef ct_font = (CTFontRef)font; + CTFontRef ct_font = font->m_font; const CFIndex count = 1; CGRect bounding_rect, success_rect; CGContextRef context_ref; @@ -1009,7 +1018,13 @@ static TTF_Font *search_font_config(astring name, bool bold, bool italic, bool u // font with the given name //------------------------------------------------- -osd_font sdl_osd_interface::font_open(const char *_name, int &height) +class osd_font +{ +public: + TTF_Font *m_font; +}; + +osd_font *sdl_osd_interface::font_open(const char *_name, int &height) { TTF_Font *font = (TTF_Font *)NULL; bool bakedstyles = false; @@ -1081,7 +1096,9 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height) height = TTF_FontLineSkip(font); - return (osd_font)font; + osd_font *ret = global_alloc(osd_font); + ret->m_font = font; + return ret; } //------------------------------------------------- @@ -1089,13 +1106,10 @@ osd_font sdl_osd_interface::font_open(const char *_name, int &height) // a given OSD font //------------------------------------------------- -void sdl_osd_interface::font_close(osd_font font) +void sdl_osd_interface::font_close(osd_font *font) { - TTF_Font *ttffont; - - ttffont = (TTF_Font *)font; - - TTF_CloseFont(ttffont); + TTF_CloseFont(font->m_font); + global_free(font); } //------------------------------------------------- @@ -1106,14 +1120,14 @@ void sdl_osd_interface::font_close(osd_font font) // pixel of a black & white font //------------------------------------------------- -bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) +bool sdl_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) { TTF_Font *ttffont; SDL_Surface *drawsurf; SDL_Color fcol = { 0xff, 0xff, 0xff }; UINT16 ustr[16]; - ttffont = (TTF_Font *)font; + ttffont = font->m_font; memset(ustr,0,sizeof(ustr)); ustr[0] = (UINT16)chnum; diff --git a/src/osd/windows/winmain.c b/src/osd/windows/winmain.c index 149adff2271..ef16debd34b 100644 --- a/src/osd/windows/winmain.c +++ b/src/osd/windows/winmain.c @@ -719,7 +719,7 @@ void windows_osd_interface::osd_exit() // font with the given name //------------------------------------------------- -osd_font windows_osd_interface::font_open(const char *_name, int &height) +osd_font *windows_osd_interface::font_open(const char *_name, int &height) { // accept qualifiers from the name astring name(_name); @@ -751,7 +751,7 @@ osd_font windows_osd_interface::font_open(const char *_name, int &height) // create the font height = logfont.lfHeight; - osd_font font = reinterpret_cast<osd_font>(CreateFontIndirect(&logfont)); + osd_font *font = reinterpret_cast<osd_font *>(CreateFontIndirect(&logfont)); if (font == NULL) return NULL; @@ -783,7 +783,7 @@ osd_font windows_osd_interface::font_open(const char *_name, int &height) // a given OSD font //------------------------------------------------- -void windows_osd_interface::font_close(osd_font font) +void windows_osd_interface::font_close(osd_font *font) { // delete the font ojbect if (font != NULL) @@ -799,7 +799,7 @@ void windows_osd_interface::font_close(osd_font font) // pixel of a black & white font //------------------------------------------------- -bool windows_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) +bool windows_osd_interface::font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) { // create a dummy DC to work with HDC dummyDC = CreateCompatibleDC(NULL); diff --git a/src/osd/windows/winmain.h b/src/osd/windows/winmain.h index f7db5752864..9d398286cbd 100644 --- a/src/osd/windows/winmain.h +++ b/src/osd/windows/winmain.h @@ -253,9 +253,9 @@ public: virtual void customize_input_type_list(simple_list<input_type_entry> &typelist); // font overridables - virtual osd_font font_open(const char *name, int &height); - virtual void font_close(osd_font font); - virtual bool font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); + virtual osd_font *font_open(const char *name, int &height); + virtual void font_close(osd_font *font); + virtual bool font_get_bitmap(osd_font *font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs); virtual void video_register(); virtual void sound_register(); diff --git a/src/tools/chdman.c b/src/tools/chdman.c index e9919bc9625..a824c701d74 100644 --- a/src/tools/chdman.c +++ b/src/tools/chdman.c @@ -2923,8 +2923,14 @@ int CLIB_DECL main(int argc, char *argv[]) (*s_commands[cmdnum].handler)(parameters); return 0; } + catch (chd_error &err) + { + fprintf(stderr, "CHD error occured (main): %s\n", chd_file::error_string(err)); + return 1; + } catch (fatal_error &err) { + fprintf(stderr, "Fatal error occured: %d\n", err.error()); return err.error(); } catch (std::exception& ex) |