/*************************************************************************** Super Real Mahjong P2 ------------------------------------- driver by Yochizo and Takahiro Nogi Yochizo took charge of video and I/O part. Takahiro Nogi took charge of sound, I/O and NVRAM part. ... and this is based on "seta.c" driver written by Luca Elia. Thanks for your reference, Takahiro Nogi and Luca Elia. Supported games : ================== Super Real Mahjong Part2 (C) 1987 Seta Super Real Mahjong Part3 (C) 1988 Seta Mahjong Yuugi (set 1) (C) 1990 Visco Mahjong Yuugi (set 2) (C) 1990 Visco Mahjong Pon Chin Kan (set 1) (C) 1991 Visco Mahjong Pon Chin Kan (set 2) (C) 1991 Visco Not supported game : ===================== Super Real Mahjong Part1 (not dumped) System specs : =============== CPU : 68000 (8MHz) Sound : AY8910 + MSM5205 Chips : X1-001, X1-002A, X1-003, X1-004x2, X0-005 x2 X1-001, X1-002A : Sprites X1-003 : Video output X1-004 : ??? X1-005 : ??? Known issues : =============== - I/O port isn't fully analized. Currently avoid I/O error message with hack. - AY-3-8910 sound may be wrong. - CPU clock of srmp3 does not match the real machine. - MSM5205 clock frequency in srmp3 is wrong. Note: ====== - In mjyuugi and mjyuugia, DSW3 (Debug switch) is available if you turn on the cheat switch. ****************************************************************************/ #include "driver.h" #include "cpu/z80/z80.h" #include "cpu/m68000/m68000.h" #include "deprecat.h" #include "sound/ay8910.h" #include "sound/msm5205.h" /*************************************************************************** Variables ***************************************************************************/ PALETTE_INIT( srmp2 ); VIDEO_UPDATE( srmp2 ); PALETTE_INIT( srmp3 ); VIDEO_UPDATE( srmp3 ); VIDEO_UPDATE( mjyuugi ); extern int srmp2_color_bank; extern int srmp3_gfx_bank; extern int mjyuugi_gfx_bank; static int srmp2_adpcm_bank; static int srmp2_adpcm_data; static UINT32 srmp2_adpcm_sptr; static UINT32 srmp2_adpcm_eptr; static int srmp2_port_select; /*************************************************************************** Interrupt(s) ***************************************************************************/ static INTERRUPT_GEN( srmp2_interrupt ) { switch (cpu_getiloops(device)) { case 0: cpu_set_input_line(device, 4, HOLD_LINE); break; /* vblank */ default: cpu_set_input_line(device, 2, HOLD_LINE); break; /* sound */ } } static DRIVER_INIT( srmp2 ) { UINT16 *RAM = (UINT16 *) memory_region(machine, "main"); /* Fix "ERROR BACK UP" and "ERROR IOX" */ RAM[0x20c80 / 2] = 0x4e75; // RTS } static DRIVER_INIT( srmp3 ) { UINT8 *RAM = memory_region(machine, "main"); /* BANK ROM (0x08000 - 0x1ffff) Check skip [MAIN ROM side] */ RAM[0x00000 + 0x7b69] = 0x00; // NOP RAM[0x00000 + 0x7b6a] = 0x00; // NOP /* MAIN ROM (0x00000 - 0x07fff) Check skip [BANK ROM side] */ RAM[0x08000 + 0xc10b] = 0x00; // NOP RAM[0x08000 + 0xc10c] = 0x00; // NOP RAM[0x08000 + 0xc10d] = 0x00; // NOP RAM[0x08000 + 0xc10e] = 0x00; // NOP RAM[0x08000 + 0xc10f] = 0x00; // NOP RAM[0x08000 + 0xc110] = 0x00; // NOP RAM[0x08000 + 0xc111] = 0x00; // NOP /* "ERR IOX" Check skip [MAIN ROM side] */ RAM[0x00000 + 0x784e] = 0x00; // NOP RAM[0x00000 + 0x784f] = 0x00; // NOP RAM[0x00000 + 0x7850] = 0x00; // NOP } static MACHINE_RESET( srmp2 ) { srmp2_port_select = 0; } static MACHINE_RESET( srmp3 ) { srmp2_port_select = 0; } /*************************************************************************** Memory Handler(s) ***************************************************************************/ static WRITE16_HANDLER( srmp2_flags_w ) { /* ---- ---x : Coin Counter ---x ---- : Coin Lock Out --x- ---- : ADPCM Bank x--- ---- : Palette Bank */ coin_counter_w( 0, ((data & 0x01) >> 0) ); coin_lockout_w( 0, (((~data) & 0x10) >> 4) ); srmp2_adpcm_bank = ( (data & 0x20) >> 5 ); srmp2_color_bank = ( (data & 0x80) >> 7 ); } static WRITE16_HANDLER( mjyuugi_flags_w ) { /* ---- ---x : Coin Counter ---x ---- : Coin Lock Out */ coin_counter_w( 0, ((data & 0x01) >> 0) ); coin_lockout_w( 0, (((~data) & 0x10) >> 4) ); } static WRITE16_HANDLER( mjyuugi_adpcm_bank_w ) { /* ---- xxxx : ADPCM Bank --xx ---- : GFX Bank */ srmp2_adpcm_bank = (data & 0x0f); mjyuugi_gfx_bank = ((data >> 4) & 0x03); } static WRITE16_HANDLER( srmp2_adpcm_code_w ) { /* - Received data may be playing ADPCM number. - 0x000000 - 0x0000ff and 0x010000 - 0x0100ff are offset table. - When the hardware receives the ADPCM number, it refers the offset table and plays the ADPCM for itself. */ UINT8 *ROM = memory_region(space->machine, "adpcm"); srmp2_adpcm_sptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8); srmp2_adpcm_eptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8); srmp2_adpcm_eptr = (srmp2_adpcm_eptr - 1) & 0x0ffff; srmp2_adpcm_sptr += (srmp2_adpcm_bank * 0x10000); srmp2_adpcm_eptr += (srmp2_adpcm_bank * 0x10000); msm5205_reset_w(0, 0); srmp2_adpcm_data = -1; } static WRITE8_HANDLER( srmp3_adpcm_code_w ) { /* - Received data may be playing ADPCM number. - 0x000000 - 0x0000ff and 0x010000 - 0x0100ff are offset table. - When the hardware receives the ADPCM number, it refers the offset table and plays the ADPCM for itself. */ UINT8 *ROM = memory_region(space->machine, "adpcm"); srmp2_adpcm_sptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 0)] << 8); srmp2_adpcm_eptr = (ROM[((srmp2_adpcm_bank * 0x10000) + (data << 2) + 1)] << 8); srmp2_adpcm_eptr = (srmp2_adpcm_eptr - 1) & 0x0ffff; srmp2_adpcm_sptr += (srmp2_adpcm_bank * 0x10000); srmp2_adpcm_eptr += (srmp2_adpcm_bank * 0x10000); msm5205_reset_w(0, 0); srmp2_adpcm_data = -1; } static void srmp2_adpcm_int(const device_config *device) { UINT8 *ROM = memory_region(device->machine, "adpcm"); if (srmp2_adpcm_sptr) { if (srmp2_adpcm_data == -1) { srmp2_adpcm_data = ROM[srmp2_adpcm_sptr]; if (srmp2_adpcm_sptr >= srmp2_adpcm_eptr) { msm5205_reset_w(0, 1); srmp2_adpcm_data = 0;
/*
* bjt.c
*
*/
#include "netlist/devices/net_lib.h"
NETLIST_START(bjt)
/* Standard stuff */
CLOCK(clk, 1000) // 1000 Hz
SOLVER(Solver, 48000)
ANALOG_INPUT(V5, 5)
ANALOG_INPUT(V3, 3.5)
/* NPN - example */
QBJT_SW(Q, "BC237B")
RES(RB, 1000)
RES(RC, 1000)
NET_C(RC.1, V5)
NET_C(RC.2, Q.C)
NET_C(RB.1, clk)
NET_C(RB.2, Q.B)
NET_C(Q.E, GND)
/* PNP - example */
QBJT_SW(Q1, "BC556B")
RES(RB1, 1000)
RES(RC1, 1000)
NET_C(RC1.1, GND)
NET_C(RC1.2, Q1.C)
NET_C(RB1.1, clk)
NET_C(RB1.2, Q1.B)
NET_C(Q1.E, V3)
LOG(logB, Q.B)
LOG(logC, Q.C)
NETLIST_END()