Exemplo n.º 1
0
/**
 * Initialize the WPC I/O.  Map WPC I/O addresses to functions that will
 * simulate them.
 */
void io_wpc_init (void)
{
	/* TODO: Continue breaking this up into multiple adds below */
	io_add (MIN_IO_ADDR, MAX_IO_ADDR, wpc_read, wpc_write, NULL);

	/* Install miscellaneous I/O handlers */
	io_add_rw (WPC_ZEROCROSS_IRQ_CLEAR, wpc_misc_read, wpc_misc_write, NULL);

	/* Install switch handlers */
	io_add_direct_switches (WPC_SW_CABINET_INPUT, SW_LEFT_COIN);

	/* Install lamp handlers */
	io_add_lamp_matrix (WPC_LAMP_COL_STROBE, WPC_LAMP_ROW_OUTPUT, 0);

	/* Install solenoid I/O handlers */
	io_add_sol_bank (WPC_SOL_HIGHPOWER_OUTPUT, SOL_BASE_HIGH);
	io_add_sol_bank (WPC_SOL_LOWPOWER_OUTPUT, SOL_BASE_LOW);
	io_add_sol_bank (WPC_SOL_FLASHER_OUTPUT, SOL_BASE_GENERAL);
	io_add_sol_bank (WPC_SOL_GEN_OUTPUT, SOL_BASE_AUXILIARY);
#if (MACHINE_WPC95 == 1)
	io_add_sol_bank (WPC95_FLIPPER_COIL_OUTPUT, 32);
#endif
#if (MACHINE_FLIPTRONIC == 1)
	io_add_sol_bank (WPC_FLIPTRONIC_PORT_A, 32);
#endif
#ifdef MACHINE_SOL_EXTBOARD1
	io_add_sol_bank (WPC_EXTBOARD1, SOL_BASE_EXTENDED);
#endif

	/* Install dot matrix register handlers */
#if (MACHINE_DMD == 1)
	io_add_dmd_visible_reg (WPC_DMD_ACTIVE_PAGE);
	io_add_dmd_mapping_reg (WPC_DMD_LOW_PAGE, 0);
	io_add_dmd_mapping_reg (WPC_DMD_HIGH_PAGE, 1);
#if (MACHINE_WPC95 == 1)
	io_add_dmd_mapping_reg (WPC95_DMD_3000_PAGE, 2);
	io_add_dmd_mapping_reg (WPC95_DMD_3200_PAGE, 3);
	io_add_dmd_mapping_reg (WPC95_DMD_3400_PAGE, 4);
	io_add_dmd_mapping_reg (WPC95_DMD_3600_PAGE, 5);
#endif
	/* WPC_DMD_FIRQ_ROW_VALUE is not handled in simulation */
#endif

	/* Install parallel/serial port handlers */
	wpc_io_debug_init (&wpc_debug_port);
	io_add_wo (WPC_PARALLEL_DATA_PORT, wpc_write_debug, &wpc_debug_port);
	io_add_rw (WPC_DEBUG_DATA_PORT, wpc_read_debug, wpc_write_debug, &wpc_debug_port);
	io_add_rw (WPC_DEBUG_CONTROL_PORT, wpc_read_debug_status, io_null_writer, &wpc_debug_port);

	/* Install diagnostic LED handler */
	io_add_wo (WPC_LEDS, wpc_write_led, NULL);

	/* Install jumper/DIP switch handler */
	sim_jumpers = LC_USA_CANADA << 2;
	conf_add ("jumpers", &sim_jumpers);
	io_add_ro (WPC_SW_JUMPER_INPUT, io_conf_reader, &sim_jumpers);

	/* TODO - install hwtimer read/write */

	/* Install sound board read/write */
	io_add (WPCS_DATA, 2, sound_ext_read, sound_ext_write, NULL);

	/* Install clock handler.  Since clock time comes from the native OS,
	it cannot be changed and so these are read-only registers */
	io_add (WPC_CLK_HOURS_DAYS, 2, wpc_clock_reader, wpc_clock_writer, NULL);

	/* Install the internal timer handler */
	io_add_ro (WPC_PERIPHERAL_TIMER_FIRQ_CLEAR, wpc_timer_reader, NULL);

	/* TODO : If a ribbon cable is disconnected, then that I/O will not work. */
}
Exemplo n.º 2
0
static void io_add_dmd_visible_reg (IOPTR addr)
{
	asciidmd_set_visible (0);
	io_add_wo (addr, io_dmd_write_visible, NULL);
}
Exemplo n.º 3
0
static void io_add_lamp_matrix (IOPTR addr_strobe, IOPTR addr_output, U8 lampno)
{
	io_add_wo (addr_output, io_matrix_writer, &sim_lamp_matrix.header);
	io_add_wo (addr_strobe, io_lamp_matrix_strobe, &sim_lamp_matrix.header);
}
Exemplo n.º 4
0
static void io_add_dmd_mapping_reg (IOPTR addr, unsigned int window)
{
	asciidmd_map_page (window, 0);
	io_add_wo (addr, io_dmd_write_map, (void *)window);
}
Exemplo n.º 5
0
/**
 * Map a range of solenoid sets.
 * ADDR gives the CPU's register that it uses to write to the set.
 * SOLNO gives the solenoid number of the first solenoid in the set.
 */
static void io_add_sol_bank (IOPTR addr, U8 solno)
{
	io_add_wo (addr, wpc_write_sol, &sim_sols[solno / 8]);
}