Beispiel #1
0
static WRITE8_HANDLER( blockade_coin_latch_w )
{
    if (data & 0x80)
    {
        if (BLOCKADE_LOG) mame_printf_debug("Reset Coin Latch\n");
        if (just_been_reset)
        {
            just_been_reset = 0;
            coin_latch = 0;
        }
        else
            coin_latch = 1;
    }

    if (data & 0x20)
    {
        if (BLOCKADE_LOG) mame_printf_debug("Pin 19 High\n");
    }
    else
    {
        if (BLOCKADE_LOG) mame_printf_debug("Pin 19 Low\n");
    }

    return;
}
Beispiel #2
0
static WRITE8_HANDLER( blockade_coin_latch_w )
{
	blockade_state *state = space->machine->driver_data<blockade_state>();

	if (data & 0x80)
	{
		if (BLOCKADE_LOG) mame_printf_debug("Reset Coin Latch\n");
		if (state->just_been_reset)
		{
			state->just_been_reset = 0;
			state->coin_latch = 0;
		}
		else
			state->coin_latch = 1;
	}

	if (data & 0x20)
	{
		if (BLOCKADE_LOG) mame_printf_debug("Pin 19 High\n");
	}
	else
	{
		if (BLOCKADE_LOG) mame_printf_debug("Pin 19 Low\n");
	}

    return;
}
Beispiel #3
0
static void data_from_i8031(int data)
{
     M68681.RBB  = data<<8;                         // Put into receive buffer.
     M68681.SRB |= 0x0100;                          // Set Receiver B ready.
     if(M68681.IMR & 0x1000)
     {
     	cpunum_set_input_line_and_vector(Machine, 0,3, HOLD_LINE, M68681.IVR);    // Generate a receiver interrupt.
     	mame_printf_debug("INTERRUPT!!!\n");
     }
   mame_printf_debug("8031 sent data: %x\n",data);
}
Beispiel #4
0
UINT8 BSX_base::read(UINT32 offset)
{
	offset &= 0xffff;
	if (offset < 0x2188 || offset >= 0x21a0)
	{
		mame_printf_debug("BS-X Base Unit reg read outside correct range!\n");
		return 0x00;
	}

	switch (offset)
	{
		// no 218b? no 218d? no 2191? no 2195? no 219a-219f?
		case 0x2192:
		{
			UINT8 counter = r2192_counter++;
			if (r2192_counter >= 18)
				r2192_counter = 0;

			if (counter == 0)
			{
				system_time curtime, *systime = &curtime;
				m_machine.current_datetime(curtime);
				r2192_hour   = systime->local_time.hour;
				r2192_minute = systime->local_time.minute;
				r2192_second = systime->local_time.second;
			}

			switch (counter)
			{
				case  0: return 0x00;  //???
				case  1: return 0x00;  //???
				case  2: return 0x00;  //???
				case  3: return 0x00;  //???
				case  4: return 0x00;  //???
				case  5: return 0x01;
				case  6: return 0x01;
				case  7: return 0x00;
				case  8: return 0x00;
				case  9: return 0x00;
				case 10: return r2192_second;
				case 11: return r2192_minute;
				case 12: return r2192_hour;
				case 13: return 0x00;  //???
				case 14: return 0x00;  //???
				case 15: return 0x00;  //???
				case 16: return 0x00;  //???
				case 17: return 0x00;  //???
			}
		}
			break;

		case 0x2193:
			return regs[offset - 0x2188] & ~0x0c;

		default:
			return regs[offset - 0x2188];
	}

	return 0x00;
}
Beispiel #5
0
static WRITE32_DEVICE_HANDLER( dcr_w )
{
	mame_printf_debug("DCR %03X write = %08X\n", offset, data);
	dm7000_state *state = space.machine().driver_data<dm7000_state>();
	if(offset>=1024) {printf("get %04X\n", offset); } else
	state->dcr[offset] = data;
}
Beispiel #6
0
static WRITE8_HANDLER( speech_clock_dac_w )
{
static int last;
if (data != last)
	mame_printf_debug("clock = %02X\n", data);
last = data;
}
Beispiel #7
0
/* Unknown IO */
static WRITE8_HANDLER( sraider_misc_w )
{
	ladybug_state *state = space->machine().driver_data<ladybug_state>();

	switch(offset)
	{
		/* These 8 bits are stored in the latch at A7 */
		case 0x00:
		case 0x01:
		case 0x02:
		case 0x03:
		case 0x04:
		case 0x05:
		case 0x06:
		case 0x07:
			state->m_weird_value[offset & 7] = data & 1;
			break;
		/* These 6 bits are stored in the latch at N7 */
		case 0x08:
			state->m_sraider_0x30 = data&0x3f;
			break;
		/* These 6 bits are stored in the latch at N8 */
		case 0x10:
			state->m_sraider_0x38 = data&0x3f;
			break;
		default:
			mame_printf_debug("(%04X) write to %02X\n", cpu_get_pc(&space->device()), offset);
			break;
	}
}
Beispiel #8
0
static void sound_exit(running_machine *machine)
{
	int sndnum;

	/* close any open WAV file */
	if (wavfile != NULL)
		wav_close(wavfile);

#ifdef MAME_DEBUG
{
	int spknum;

	/* log the maximum sample values for all speakers */
	for (spknum = 0; spknum < totalspeakers; spknum++)
		if (speaker[spknum].max_sample > 0)
		{
			speaker_info *spk = &speaker[spknum];
			mame_printf_debug("Speaker \"%s\" - max = %d (gain *= %f) - %d%% samples clipped\n", spk->speaker->tag, spk->max_sample, 32767.0 / (spk->max_sample ? spk->max_sample : 1), (int)((double)spk->clipped_samples * 100.0 / spk->total_samples));
		}
}
#endif /* MAME_DEBUG */

	/* stop all the sound chips */
	for (sndnum = 0; sndnum < MAX_SOUND; sndnum++)
		if (Machine->drv->sound[sndnum].type != SOUND_DUMMY)
			sndintrf_exit_sound(sndnum);

	/* reset variables */
	totalspeakers = 0;
	totalsnd = 0;
	memset(&speaker, 0, sizeof(speaker));
	memset(&sound, 0, sizeof(sound));
}
Beispiel #9
0
INLINE void M_UNDEFINED(void)
{
	logerror("ALPHA8201:  PC = %03x,  Unimplemented opcode = %02x\n", PC-1, M_RDMEM(PC-1));
#if SHOW_MESSAGE_CONSOLE
	mame_printf_debug("ALPHA8201:  PC = %03x,  Unimplemented opcode = %02x\n", PC-1, M_RDMEM(PC-1));
#endif
}
Beispiel #10
0
void BSX_base::write(UINT32 offset, UINT8 data)
{
	offset &= 0xffff;
	if (offset < 0x2188 || offset >= 0x21a0)
	{
		mame_printf_debug("BS-X Base Unit reg write outside correct range!\n");
		return;
	}

	switch(offset)
	{
		// no 218d? no 2190? no 2195? no 2196? no 2198? no 219a-219f?
		case 0x218f:
			regs[6] >>= 1;  // 0x218e
			regs[6] = regs[7] - regs[6];    // 0x218f - 0x218e
			regs[7] >>= 1;  // 0x218f
			break;

		case 0x2191:
			regs[offset - 0x2188] = data;
			r2192_counter = 0;
			break;

		case 0x2192:
			regs[8] = data; // sets 0x2190
			break;

		default:
			regs[offset - 0x2188] = data;
			break;
	}
}
Beispiel #11
0
static READ8_HANDLER( laserdisc_r )
{
	dlair_state *state = space->machine->driver_data<dlair_state>();
	UINT8 result = laserdisc_data_r(state->laserdisc);
	mame_printf_debug("laserdisc_r = %02X\n", result);
	return result;
}
Beispiel #12
0
/* this function checks the cache to see if the current state is cached,
   if it is then it copies the cached data to the user region where code is
   executed from, if its not cached then it gets decrypted to the current
   cache position using the functions in s24_fd1094.c */
static void s24_fd1094_setstate_and_decrypt(running_machine *machine, int state)
{
	int i;
	UINT32 addr;

	switch (state & 0x300)
	{
	case 0x000:
	case FD1094_STATE_RESET:
		fd1094_selected_state = state & 0xff;
		break;
	}

	fd1094_state = state;

	cpu_set_reg(machine->device("sub"), M68K_PREF_ADDR, 0x0010);	// force a flush of the prefetch cache

	/* set the s24_fd1094 state ready to decrypt.. */
	state = fd1094_set_state(s24_fd1094_key,state) & 0xff;

	/* first check the cache, if its cached we don't need to decrypt it, just copy */
	for (i = 0; i < S16_NUMCACHE; i++)
	{
		if (fd1094_cached_states[i] == state)
		{
			/* copy cached state */
			s24_fd1094_userregion = s24_fd1094_cacheregion[i];
			machine->device<cpu_device>("sub")->space(AS_PROGRAM)->set_decrypted_region(0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
			m68k_set_encrypted_opcode_range(machine->device("sub"), 0, s24_fd1094_cpuregionsize);

			return;
		}
	}

// mame_printf_debug("new state %04x\n",state);

	/* mark it as cached (because it will be once we decrypt it) */
	fd1094_cached_states[fd1094_current_cacheposition] = state;

	for (addr = 0; addr < s24_fd1094_cpuregionsize / 2; addr++)
	{
		UINT16 dat;
		dat = fd1094_decode(addr, s24_fd1094_cpuregion[addr], s24_fd1094_key, 0);
		s24_fd1094_cacheregion[fd1094_current_cacheposition][addr] = dat;
	}

	/* copy newly decrypted data to user region */
	s24_fd1094_userregion = s24_fd1094_cacheregion[fd1094_current_cacheposition];
	machine->device<cpu_device>("sub")->space(AS_PROGRAM)->set_decrypted_region(0, s24_fd1094_cpuregionsize - 1, s24_fd1094_userregion);
	m68k_set_encrypted_opcode_range(machine->device("sub"), 0, s24_fd1094_cpuregionsize);

	fd1094_current_cacheposition++;

	if (fd1094_current_cacheposition >= S16_NUMCACHE)
	{
		mame_printf_debug("out of cache, performance may suffer, incrase S16_NUMCACHE!\n");
		fd1094_current_cacheposition = 0;
	}
}
Beispiel #13
0
static void need_verify(const char *s)
{
	UINT8 op  = M_RDOP(PC-1);
	logerror("ALPHA8201:  PC = %03x, unknown opcode = %02x is '%s' ??\n",PC-1, op,s);
#if SHOW_MESSAGE_CONSOLE
	mame_printf_debug("ALPHA8201:  PC = %03x, unknown opcode = %02x is '%s' ??\n",PC-1, op,s);
#endif
}
Beispiel #14
0
speaker_device::~speaker_device()
{
#ifdef MAME_DEBUG
	// log the maximum sample values for all speakers
	if (m_max_sample > 0)
		mame_printf_debug("Speaker \"%s\" - max = %d (gain *= %f) - %d%% samples clipped\n", tag(), m_max_sample, 32767.0 / (m_max_sample ? m_max_sample : 1), (int)((double)m_clipped_samples * 100.0 / m_total_samples));
#endif
}
Beispiel #15
0
void gottlieb_sound_r1_device::fake_votrax_data_w(UINT8 data)
{
	static const char *const PhonemeTable[0x40] =
	{
		"EH3", "EH2", "EH1", "PA0", "DT" , "A1" , "A2" , "ZH",
		"AH2", "I3" , "I2" , "I1" , "M"  , "N"  , "B"  , "V",
		"CH" , "SH" , "Z"  , "AW1", "NG" , "AH1", "OO1", "OO",
		"L"  , "K"  , "J"  , "H"  , "G"  , "F"  , "D"  , "S",
		"A"  , "AY" , "Y1" , "UH3", "AH" , "P"  , "O"  , "I",
		"U"  , "Y"  , "T"  , "R"  , "E"  , "W"  , "AE" , "AE1",
		"AW2", "UH2", "UH1", "UH" , "O2" , "O1" , "IU" , "U1",
		"THV", "TH" , "ER" , "EH" , "E1" , "AW" , "PA1", "STOP"
	};

	data ^= 0xff;

logerror("Votrax: intonation %d, phoneme %02x %s\n",data >> 6,data & 0x3f,PhonemeTable[data & 0x3f]);

	m_votrax_queue[m_votrax_queuepos++] = data;

	if ((data & 0x3f) == 0x3f)
	{
		if (m_votrax_queuepos > 1)
		{
			int last = -1;
			int i;
			char phonemes[200];

			phonemes[0] = 0;
			for (i = 0;i < m_votrax_queuepos-1;i++)
			{
				static const char *const inf[4] = { "[0]", "[1]", "[2]", "[3]" };
				int phoneme = m_votrax_queue[i] & 0x3f;
				int inflection = m_votrax_queue[i] >> 6;
				if (inflection != last) strcat(phonemes, inf[inflection]);
				last = inflection;
				if (phoneme == 0x03 || phoneme == 0x3e) strcat(phonemes," ");
				else strcat(phonemes,PhonemeTable[phoneme]);
			}

			mame_printf_debug("Votrax played '%s'\n", phonemes);

			if (strcmp(phonemes, "[0] HEH3LOOW     AH1EH3I3YMTERI2NDAHN") == 0)	  /* Q-Bert & Tylz - Hello, I am turned on */
                                m_samples->start(0, 42);
			else if (strcmp(phonemes, "[0]BAH1EH1Y") == 0)							  /* Q-Bert - Bye, bye */
				m_samples->start(0, 43);
			else if (strcmp(phonemes, "[0]A2YHT LEH2FTTH") == 0)					  /* Reactor - Eight left */
				m_samples->start(0, 0);
			else if (strcmp(phonemes, "[0]SI3KS DTYN LEH2FTTH") == 0)				  /* Reactor - Sixteen left */
				m_samples->start(0, 1);
			else if (strcmp(phonemes, "[0]WO2RNYNG KO2R UH1NSDTABUH1L") == 0)		  /* Reactor - Warning core unstable */
				m_samples->start(0, 5);
			else if (strcmp(phonemes, "[0]CHAMBERR   AE1EH2KTI1VA1I3DTEH1DT ") == 0) /* Reactor - Chamber activated */
				m_samples->start(0, 7);
		}

		m_votrax_queuepos = 0;
	}
Beispiel #16
0
static void sdl_kill(running_machine *machine)
{
    if (initialized_audio)
    {
        mame_printf_debug("sdl_kill: closing audio\n");

        SDL_CloseAudio();
    }
}
Beispiel #17
0
/* this function checks the cache to see if the current state is cached,
   if it is then it copies the cached data to the user region where code is
   executed from, if its not cached then it gets decrypted to the current
   cache position using the functions in fd1094.c */
static void fd1094_setstate_and_decrypt(running_machine &machine, int state)
{
	int i;
	UINT32 addr;

	switch (state & 0x300)
	{
	case 0x000:
	case FD1094_STATE_RESET:
		fd1094_selected_state = state & 0xff;
		break;
	}

	fd1094_state = state;

	cpu_set_reg(machine.device(fd1094_cputag), M68K_PREF_ADDR, 0x0010);	// force a flush of the prefetch cache

	/* set the FD1094 state ready to decrypt.. */
	state = fd1094_set_state(fd1094_key, state) & 0xff;

	/* first check the cache, if its cached we don't need to decrypt it, just copy */
	for (i = 0; i < CACHE_ENTRIES; i++)
	{
		if (fd1094_cached_states[i] == state)
		{
			/* copy cached state */
			fd1094_userregion = fd1094_cacheregion[i];
			set_decrypted_region(machine);
			m68k_set_encrypted_opcode_range(machine.device(fd1094_cputag), 0, fd1094_cpuregionsize);

			return;
		}
	}

	/* mark it as cached (because it will be once we decrypt it) */
	fd1094_cached_states[fd1094_current_cacheposition] = state;

	for (addr = 0; addr < fd1094_cpuregionsize / 2; addr++)
	{
		UINT16 dat;
		dat = fd1094_decode(addr,fd1094_cpuregion[addr],fd1094_key,0);
		fd1094_cacheregion[fd1094_current_cacheposition][addr]=dat;
	}

	/* copy newly decrypted data to user region */
	fd1094_userregion = fd1094_cacheregion[fd1094_current_cacheposition];
	set_decrypted_region(machine);
	m68k_set_encrypted_opcode_range(machine.device(fd1094_cputag), 0, fd1094_cpuregionsize);

	fd1094_current_cacheposition++;

	if (fd1094_current_cacheposition >= CACHE_ENTRIES)
	{
		mame_printf_debug("out of cache, performance may suffer, incrase CACHE_ENTRIES!\n");
		fd1094_current_cacheposition = 0;
	}
}
Beispiel #18
0
void tms9927_device::device_stop()
{
	mame_printf_debug("TMS9937: Final params: (%d, %d, %d, %d, %d, %d, %d)\n",
						m_clock,
						m_total_hpix,
						0, m_visible_hpix,
						m_total_vpix,
						0, m_visible_vpix);
}
Beispiel #19
0
INLINE void M_UNDEFINED2(void)
{
	UINT8 op  = M_RDOP(PC-1);
	UINT8 imm = M_RDMEM_OPCODE();
	logerror("ALPHA8201:  PC = %03x,  Unimplemented opcode = %02x,%02x\n", PC-2, op,imm);
#if SHOW_MESSAGE_CONSOLE
	mame_printf_debug("ALPHA8201:  PC = %03x,  Unimplemented opcode = %02x,%02x\n", PC-2, op,imm);
#endif
}
Beispiel #20
0
/*
static READ8_HANDLER( rom_bank_select_r )
{
    return suprgolf_rom_bank;
}
*/
static WRITE8_HANDLER( rom_bank_select_w )
{
	UINT8 *region_base = memory_region(REGION_USER1);

	suprgolf_rom_bank = data;

	mame_printf_debug("ROM_BANK 0x8000 - %X @%X\n",data,activecpu_get_previouspc());
	memory_set_bankptr(2, region_base + (data&0x3f ) * 0x4000);
}
Beispiel #21
0
static DEVICE_STOP( speaker_output )
{
#ifdef MAME_DEBUG
	speaker_info *info = device->token;

	/* log the maximum sample values for all speakers */
	if (info->max_sample > 0)
		mame_printf_debug("Speaker \"%s\" - max = %d (gain *= %f) - %d%% samples clipped\n", info->tag, info->max_sample, 32767.0 / (info->max_sample ? info->max_sample : 1), (int)((double)info->clipped_samples * 100.0 / info->total_samples));
#endif /* MAME_DEBUG */
}
Beispiel #22
0
void alpha8201_cpu_device::M_UNDEFINED()
{
	logerror("alpha8201:  PC = %03x,  Unimplemented opcode = %02x\n", m_pc.w.l-1, M_RDMEM(m_pc.w.l-1));
#if SHOW_MESSAGE_CONSOLE
	mame_printf_debug("alpha8201:  PC = %03x,  Unimplemented opcode = %02x\n", m_pc.w.l-1, M_RDMEM(m_pc.w.l-1));
#endif
#if BREAK_ON_UNKNOWN_OPCODE
	debugger_break(machine());
#endif
}
Beispiel #23
0
INLINE void M_UNDEFINED(void)
{
	logerror("ALPHA8201:  PC = %03x,  Unimplemented opcode = %02x\n", PC-1, M_RDMEM(PC-1));
#if SHOW_MESSAGE_CONSOLE
	mame_printf_debug("ALPHA8201:  PC = %03x,  Unimplemented opcode = %02x\n", PC-1, M_RDMEM(PC-1));
#endif
#if BREAK_ON_UNKNOWN_OPCODE
	DEBUGGER_BREAK;
#endif
}
Beispiel #24
0
static WRITE16_HANDLER( ti_uart_w )
{
	// Need to initalise values to 0 on reset.
	switch (offset)
	{
		case 0x0:
		{
			ti_uart[TX] = data;
#if VGB_MONITOR_DISPLAY
			mame_printf_debug("%c",data);
#endif
			ti_uart[STATUS] |= 1;
			break;
		}
		case 0x1:
		{
			if (ti_uart_mode_cycle == 0)
			{
				ti_uart[MODE1] = data;
				ti_uart_mode_cycle = 1;
			}
			else
			{
				ti_uart[MODE2] = data;
				ti_uart_mode_cycle = 0;
			}
			break;
		}
		case 0x2:
		{
			if (ti_uart_sync_cycle == 0)
			{
				ti_uart[SYN1] = data;
				ti_uart_mode_cycle = 1;
			}
			else if (ti_uart_sync_cycle == 1)
			{
				ti_uart[SYN2] = data;
				ti_uart_mode_cycle = 2;
			}
			else
			{
				ti_uart[DLE] = data;
				ti_uart_mode_cycle = 0;
			}
			break;
		}
		case 0x3:
		{
			ti_uart[COMMAND] = data;
			ti_uart_mode_cycle = ti_uart_sync_cycle = 0;
			break;
		}
	}
}
Beispiel #25
0
void system18_set_vdp_mixing(running_machine *machine, int mixing)
{
	if (mixing != vdp_mixing)
	{
		video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
		vdp_mixing = mixing;
#if DEBUG_VDP
		mame_printf_debug("VDP mixing = %02X\n", mixing);
#endif
	}
}
Beispiel #26
0
void system18_set_vdp_mixing(int mixing)
{
	if (mixing != vdp_mixing)
	{
		video_screen_update_partial(0, cpu_getscanline());
		vdp_mixing = mixing;
#if DEBUG_VDP
		mame_printf_debug("VDP mixing = %02X\n", mixing);
#endif
	}
}
Beispiel #27
0
static DEVICE_STOP( tms9927 )
{
	tms9927_state *tms = get_safe_token(device);

	mame_printf_debug("TMS9937: Final params: (%d, %d, %d, %d, %d, %d, %d)\n",
						tms->clock,
						tms->total_hpix,
						0, tms->visible_hpix,
						tms->total_vpix,
						0, tms->visible_vpix);
}
Beispiel #28
0
void segas18_state::set_vdp_mixing(UINT8 mixing)
{
	if (mixing != m_vdp_mixing)
	{
		machine().primary_screen->update_partial(machine().primary_screen->vpos());
		m_vdp_mixing = mixing;
#if DEBUG_VDP
		mame_printf_debug("VDP mixing = %02X\n", mixing);
#endif
	}
}
Beispiel #29
0
void segas18_state::set_vdp_enable(bool enable)
{
	if (enable != m_vdp_enable)
	{
		machine().primary_screen->update_partial(machine().primary_screen->vpos());
		m_vdp_enable = enable;
#if DEBUG_VDP
		mame_printf_debug("VDP enable = %02X\n", enable);
#endif
	}
}
Beispiel #30
0
void system18_set_vdp_enable(running_machine *machine, int enable)
{
	enable = (enable != 0);
	if (enable != vdp_enable)
	{
		video_screen_update_partial(machine->primary_screen, video_screen_get_vpos(machine->primary_screen));
		vdp_enable = enable;
#if DEBUG_VDP
		mame_printf_debug("VDP enable = %02X\n", enable);
#endif
	}
}