예제 #1
0
파일: thayers.cpp 프로젝트: goofwear/mame
void thayers_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_INTRQ_TICK:
		m_maincpu->set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE);
		break;
	case TIMER_SSI263_PHONEME_TICK:
		m_ssi_data_request = 0;
		check_interrupt();
		break;
	default:
		assert_always(false, "Unknown id in thayers_state::device_timer");
	}
}
예제 #2
0
void simpsons_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
    switch (id)
    {
    case TIMER_NMI:
        m_audiocpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE);
        break;
    case TIMER_DMAEND:
        if (m_firq_enabled)
            m_maincpu->set_input_line(KONAMI_FIRQ_LINE, HOLD_LINE);
        break;
    default:
        assert_always(FALSE, "Unknown id in simpsons_state::device_timer");
    }
}
예제 #3
0
파일: image.c 프로젝트: broftkd/mess-cvs
void image_battery_save(mess_image *image, const void *buffer, int length)
{
	mame_file_error filerr;
	mame_file *file;

	assert_always(buffer && (length > 0), "Must specify sensical buffer/length");

	/* try to open the battery file and write it out, if possible */
	filerr = open_battery_file(image, OPEN_FLAG_WRITE | OPEN_FLAG_CREATE, &file);
	if (filerr == FILERR_NONE)
	{
		mame_fwrite(file, buffer, length);
		mame_fclose(file);
	}
}
예제 #4
0
파일: dai.cpp 프로젝트: Robbbert/store1
void dai_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
    switch (id)
    {
    case TIMER_BOOTSTRAP:
        m_maincpu->set_pc(0xc000);
        break;
    case TIMER_TMS5501:
        m_tms5501->xi7_w((ioport("IN8")->read() & 0x04) ? 1:0);
        timer_set(attotime::from_hz(100), TIMER_TMS5501);
        break;
    default:
        assert_always(false, "Unknown id in dai_state::device_timer");
    }
}
예제 #5
0
void stepper_config(running_machine *machine, int which, const stepper_interface *intf)
{
	assert_always(machine->phase() == MACHINE_PHASE_INIT, "Can only call stepper_config at init time!");
	assert_always((which >= 0) && (which < MAX_STEPPERS), "stepper_config called on an invalid stepper motor!");
	assert_always(intf, "stepper_config called with an invalid interface!");

	step[which].intf = intf;

	step[which].type = intf->type;
	step[which].index_start = intf->index_start;/* location of first index value in half steps */
	step[which].index_end	= intf->index_end;	/* location of last index value in half steps */
	step[which].index_patt	= intf->index_patt; /* hex value of coil pattern (0 if not needed)*/
	step[which].pattern     = 0;
	step[which].old_pattern = 0;
	step[which].step_pos    = 0;

	switch ( step[which].type )
	{
		case STARPOINT_48STEP_REEL:  /* STARPOINT RMxxx */
		case BARCREST_48STEP_REEL :  /* Barcrest Reel unit */
		step[which].max_steps = (48*2);
		break;
		case STARPOINT_144STEPS_DICE :/* STARPOINT 1DCU DICE mechanism */
		step[which].max_steps = (144*2);
		break;
	}

	state_save_register_item(machine, "stepper", NULL, which, step[which].index_start);
	state_save_register_item(machine, "stepper", NULL, which, step[which].index_end);
	state_save_register_item(machine, "stepper", NULL, which, step[which].index_patt);
	state_save_register_item(machine, "stepper", NULL, which, step[which].pattern);
	state_save_register_item(machine, "stepper", NULL, which, step[which].old_pattern);
	state_save_register_item(machine, "stepper", NULL, which, step[which].step_pos);
	state_save_register_item(machine, "stepper", NULL, which, step[which].max_steps);
	state_save_register_item(machine, "stepper", NULL, which, step[which].type);
}
예제 #6
0
void add_pause_callback(void (*callback)(int))
{
	callback_item *cb, **cur;

	assert_always(mame_get_phase() == MAME_PHASE_INIT, "Can only call add_pause_callback at init time!");

	/* allocate memory */
	cb = malloc_or_die(sizeof(*cb));

	/* add us to the end of the list */
	cb->func.pause = callback;
	cb->next = NULL;
	for (cur = &pause_callback_list; *cur; cur = &(*cur)->next) ;
	*cur = cb;
}
예제 #7
0
파일: motor_pwm.c 프로젝트: JarryChou/sapog
static void start_timers(void)
{
	const irqstate_t irqstate = irq_primask_save();

	// Make sure the timers are not running
	assert_always(!(TIM1->CR1 & TIM_CR1_CEN));
	assert_always(!(TIM2->CR1 & TIM_CR1_CEN));

	// Start synchronously
	TIM1->CR2 |= TIM_CR2_MMS_0;                   // TIM1 is master
	TIM2->SMCR = TIM_SMCR_SMS_1 | TIM_SMCR_SMS_2; // TIM2 is slave

	TIM1->CR1 |= TIM_CR1_CEN;                     // Start all

	// Make sure the timers have started now
	assert_always(TIM1->CR1 & TIM_CR1_CEN);
	assert_always(TIM2->CR1 & TIM_CR1_CEN);

	// Configure the synchronous reset - TIM1 master, TIM2 slave
	TIM1->CR2 &= ~TIM_CR2_MMS;                    // Master, UG bit triggers TRGO
	TIM2->SMCR = TIM_SMCR_SMS_2;                  // Slave, TRGI triggers UG

	irq_primask_restore(irqstate);
}
예제 #8
0
INPUT_PORTS_END


void argo_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_BOOT:
		/* after the first 4 bytes have been read from ROM, switch the ram back in */
		membank("boot")->set_entry(0);
		break;
	default:
		assert_always(FALSE, "Unknown id in argo_state::device_timer");
	}
}
예제 #9
0
파일: 2608intf.c 프로젝트: LeWoY/MAMEHub
void ym2608_device::device_start()
{
	static const ay8910_interface default_ay8910_config =
	{
		AY8910_LEGACY_OUTPUT | AY8910_SINGLE_OUTPUT,
		AY8910_DEFAULT_LOADS,
		DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL
	};

	int rate = clock()/72;
	void *pcmbufa;
	int  pcmsizea;

	const ay8910_interface *ay8910_config = m_ay8910_config != NULL ? m_ay8910_config : &default_ay8910_config;

	m_irq_handler.resolve();
	/* FIXME: Force to use single output */
	m_psg = ay8910_start_ym(this, ay8910_config);
	assert_always(m_psg != NULL, "Error creating YM2608/AY8910 chip");

	/* Timer Handler set */
	m_timer[0] = timer_alloc(0);
	m_timer[1] = timer_alloc(1);

	/* stream system initialize */
	m_stream = machine().sound().stream_alloc(*this,0,2,rate);
	/* setup adpcm buffers */
	pcmbufa  = *region();
	pcmsizea = region()->bytes();

	/* initialize YM2608 */
	m_chip = ym2608_init(this,this,clock(),rate,
					pcmbufa,pcmsizea,
					timer_handler,IRQHandler,&psgintf);
	assert_always(m_chip != NULL, "Error creating YM2608 chip");
}
예제 #10
0
파일: tmc1800.c 프로젝트: mbcoguno/mame
ROM_END

/* Driver Initialization */

void tmc1800_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_SETUP_BEEP:
		m_beeper->set_state(0);
		m_beeper->set_frequency(0);
		break;
	default:
		assert_always(FALSE, "Unknown id in tmc1800_state::device_timer");
	}
}
예제 #11
0
파일: ut88.cpp 프로젝트: MASHinfo/mame
void ut88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_RESET:
		m_bank1->set_entry(0);
		break;
	case TIMER_UPDATE_DISPLAY:
		for (int i=0;i<6;i++)
			m_digits[i] = hex_to_7seg[m_lcd_digit[i]];
		timer_set(attotime::from_hz(60), TIMER_UPDATE_DISPLAY);
		break;
	default:
		assert_always(false, "Unknown id in ut88_state::device_timer");
	}
}
예제 #12
0
파일: dectalk.c 프로젝트: Ilgrim/MAMEHub
INPUT_PORTS_END

/******************************************************************************
 Machine Drivers
******************************************************************************/
void dectalk_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_OUTFIFO_READ:
		outfifo_read_cb(ptr, param);
		break;
	default:
		assert_always(FALSE, "Unknown id in dectalk_state::device_timer");
	}
}
예제 #13
0
/* clock sound channel effect counters */
void flower_sound_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
		case TIMER_CLOCK_EFFECT:
		flower_sound_channel *voice;
		m_stream->update();

		for (voice = m_channel_list; voice < m_last_channel; voice++)
			voice->ecount += (voice->ecount < (1<<22));
		break;

		default:
			assert_always(FALSE, "Unknown id in flower_sound_device::device_timer");
	}
}
예제 #14
0
파일: osi.cpp 프로젝트: Robbbert/store1
ROM_END

/* Driver Initialization */

void sb2m600_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_SETUP_BEEP:
		m_beeper->set_state(0);
		m_beeper->set_clock(300);
		break;
	default:
		assert_always(false, "Unknown id in sb2m600_state::device_timer");
	}
}
예제 #15
0
파일: image.c 프로젝트: bdidier/MAME-OS-X
void image_battery_load_by_name(emu_options &options, const char *filename, void *buffer, int length, int fill)
{
    file_error filerr;
    int bytes_read = 0;

    assert_always(buffer && (length > 0), "Must specify sensical buffer/length");

    /* try to open the battery file and read it in, if possible */
    emu_file file(options.nvram_directory(), OPEN_FLAG_READ);
    filerr = file.open(filename);
    if (filerr == FILERR_NONE)
        bytes_read = file.read(buffer, length);

    /* fill remaining bytes (if necessary) */
    memset(((char *) buffer) + bytes_read, fill, length - bytes_read);
}
예제 #16
0
void begin_resource_tracking(void)
{
	memory_pool *new_pool;

	/* sanity check */
	assert_always(resource_tracking_tag < ARRAY_LENGTH(pools), "Too many memory pools");

	/* create a new pool */
	new_pool = pool_create(memory_error);
	if (!new_pool)
		fatalerror("Failed to allocate new memory pool");
	pools[resource_tracking_tag] = new_pool;

	/* increment the tag counter */
	resource_tracking_tag++;
}
예제 #17
0
Value* Builder::createFDiv(Value* lhs, Value* rhs) {
    ASSERT_TYPE_FLOAT(lhs);
    ASSERT_TYPE_EQUAL(lhs, rhs);

    if (lhs->isConstant() && rhs->isConstant()) {
        Value* dest = cloneValue(lhs);
        assert_always("Unimplemented");
        //dest->doDiv(rhs);
        return dest;
    }

    Instruction* i = appendInstr(OPCODE_FDIV, 0, allocValue(lhs->type));
    i->src1.setValue(lhs);
    i->src2.setValue(rhs);
    return i->dest;
}
예제 #18
0
파일: mame.c 프로젝트: broftkd/mess-cvs
void add_pause_callback(running_machine *machine, void (*callback)(running_machine *, int))
{
	mame_private *mame = machine->mame_data;
	callback_item *cb, **cur;

	assert_always(mame_get_phase(machine) == MAME_PHASE_INIT, "Can only call add_pause_callback at init time!");

	/* allocate memory */
	cb = malloc_or_die(sizeof(*cb));

	/* add us to the end of the list */
	cb->func.pause = callback;
	cb->next = NULL;
	for (cur = &mame->pause_callback_list; *cur; cur = &(*cur)->next) ;
	*cur = cb;
}
예제 #19
0
void pmd85_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_CASSETTE:
		pmd85_cassette_timer_callback(ptr, param);
		break;
	case TIMER_RESET:
		pmd_reset(ptr, param);
		break;
	case TIMER_SETUP_MACHINE_STATE:
		setup_machine_state(ptr, param);
		break;
	default:
		assert_always(FALSE, "Unknown id in pmd85_state::device_timer");
	}
}
예제 #20
0
void device_network_interface::recv_cb(u8 *buf, int len)
{
	assert_always(!m_recv_timer->enabled(), "attempted to receive while receive already in progress");

	// process the received data
	int result = recv_start_cb(buf, len);

	if (result)
	{
		// stop receiving more data from the network
		if (m_dev)
			m_dev->stop();

		// schedule receive complete callback
		m_recv_timer->adjust(attotime::from_ticks(len, m_bandwidth * 1'000'000 / 8), result);
	}
}
예제 #21
0
파일: gameplan.c 프로젝트: dinkc64/mame
void gameplan_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_CLEAR_SCREEN_DONE:
		clear_screen_done_callback(ptr, param);
		break;
	case TIMER_VIA_IRQ_DELAYED:
		via_irq_delayed(ptr, param);
		break;
	case TIMER_VIA_0_CAL:
		via_0_ca1_timer_callback(ptr, param);
		break;
	default:
		assert_always(FALSE, "Unknown id in gameplan_state::device_timer");
	}
}
예제 #22
0
파일: diimage.cpp 프로젝트: RalfVB/mame
void device_image_interface::battery_load(void *buffer, int length, int fill)
{
	assert_always(buffer && (length > 0), "Must specify sensical buffer/length");

	osd_file::error filerr;
	int bytes_read = 0;
	std::string fname = std::string(device().machine().system().name).append(PATH_SEPARATOR).append(m_basename_noext.c_str()).append(".nv");

	/* try to open the battery file and read it in, if possible */
	emu_file file(device().machine().options().nvram_directory(), OPEN_FLAG_READ);
	filerr = file.open(fname);
	if (filerr == osd_file::error::NONE)
		bytes_read = file.read(buffer, length);

	// fill remaining bytes (if necessary)
	memset(((char *)buffer) + bytes_read, fill, length - bytes_read);
}
예제 #23
0
파일: electron.cpp 프로젝트: ursine/mame
void electron_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_TAPE_HANDLER:
		electron_tape_timer_handler(ptr, param);
		break;
	case TIMER_SETUP_BEEP:
		setup_beep(ptr, param);
		break;
	case TIMER_SCANLINE_INTERRUPT:
		electron_scanline_interrupt(ptr, param);
		break;
	default:
		assert_always(FALSE, "Unknown id in electron_state::device_timer");
	}
}
예제 #24
0
void samcoupe_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_IRQ_OFF:
		irq_off(ptr, param);
		break;
	case TIMER_MOUSE_RESET:
		samcoupe_mouse_reset(ptr, param);
		break;
	case TIMER_VIDEO_UPDATE:
		sam_video_update_callback(ptr, param);
		break;
	default:
		assert_always(false, "Unknown id in samcoupe_state::device_timer");
	}
}
예제 #25
0
void *auto_realloc_file_line(void *ptr, size_t size, const char *file, int line)
{
	object_pool *pool = current_pool();
	if (ptr != NULL)
	{
		int tag = resource_tracking_tag;
		for (; tag > 0; tag--)
		{
			pool = pools[tag - 1];
			if (pool_object_exists(pool, OBJTYPE_MEMORY, ptr))
				break;
		}
		assert_always(tag > 0, "Failed to find alloc in pool");
	}

	return pool_realloc_file_line(pool, ptr, size, file, line);
}
예제 #26
0
gfx::PrimitiveTopologyType convertPrimitiveTopologyType(Primitive primitive) {
    switch (primitive) {
    case RSX_PRIMITIVE_POINTS:          return gfx::TOPOLOGY_TYPE_POINT;
    case RSX_PRIMITIVE_LINES:           return gfx::TOPOLOGY_TYPE_LINE;
    case RSX_PRIMITIVE_LINE_LOOP:       return gfx::TOPOLOGY_TYPE_LINE;
    case RSX_PRIMITIVE_LINE_STRIP:      return gfx::TOPOLOGY_TYPE_LINE;
    case RSX_PRIMITIVE_TRIANGLES:       return gfx::TOPOLOGY_TYPE_TRIANGLE;
    case RSX_PRIMITIVE_TRIANGLE_STRIP:  return gfx::TOPOLOGY_TYPE_TRIANGLE;
    case RSX_PRIMITIVE_TRIANGLE_FAN:    return gfx::TOPOLOGY_TYPE_TRIANGLE;
    case RSX_PRIMITIVE_QUADS:           return gfx::TOPOLOGY_TYPE_TRIANGLE; // TODO: Is this correct?
    case RSX_PRIMITIVE_QUAD_STRIP:      return gfx::TOPOLOGY_TYPE_TRIANGLE; // TODO: Is this correct?
    case RSX_PRIMITIVE_POLYGON:         return gfx::TOPOLOGY_TYPE_TRIANGLE; // TODO: Is this correct?
    default:
        assert_always("Unexpected");
        return gfx::TOPOLOGY_TYPE_TRIANGLE;
    }
}
예제 #27
0
void mbee_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_MBEE256_KBD:
		mbee256_kbd(ptr, param);
		break;
	case TIMER_MBEE_RTC_IRQ:
		mbee_rtc_irq(ptr, param);
		break;
	case TIMER_MBEE_RESET:
		mbee_reset(ptr, param);
		break;
	default:
		assert_always(FALSE, "Unknown id in mbee_state::device_timer");
	}
}
예제 #28
0
파일: image.c 프로젝트: Ojousama/MAMEHub
void image_battery_load_by_name(emu_options &options, const char *filename, void *buffer, int length, void *def_buffer)
{
	file_error filerr;
	int bytes_read = 0;

	assert_always(buffer && (length > 0), "Must specify sensical buffer/length");

	/* try to open the battery file and read it in, if possible */
	emu_file file(options.nvram_directory(), OPEN_FLAG_READ);
	filerr = file.open(filename);
	if (filerr == FILERR_NONE)
		bytes_read = file.read(buffer, length);

	/* if no file was present, copy the default battery */
	if (bytes_read == 0 && def_buffer)
		memcpy((char *) buffer, (char *) def_buffer, length);
}
예제 #29
0
void poly88_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
	switch (id)
	{
	case TIMER_USART:
		poly88_usart_timer_callback(ptr, param);
		break;
	case TIMER_KEYBOARD:
		keyboard_callback(ptr, param);
		break;
	case TIMER_CASSETTE:
		poly88_cassette_timer_callback(ptr, param);
		break;
	default:
		assert_always(FALSE, "Unknown id in poly88_state::device_timer");
	}
}
예제 #30
0
파일: bublbobl.c 프로젝트: hstampfl/mame
void bublbobl_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
{
    switch (id)
    {
    case TIMER_NMI:
        if (m_sound_nmi_enable)
            m_audiocpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE);
        else
            m_pending_nmi = 1;
        break;
    case TIMER_M68705_IRQ_ACK:
        m_mcu->set_input_line(0, CLEAR_LINE);
        break;
    default:
        assert_always(FALSE, "Unknown id in bublbobl_state::device_timer");
    }
}