/*************************************************************************** Lamps The LEDs are turned on and off by two consecutive memory addresses. The first address turns them off, the second address turns them on. This is reversed for the Serve LED, which has a NOT on the signal. ***************************************************************************/ void sbrkout_start_1_led(int offset,int value) { if (offset==0) osd_led_w(0,0); else osd_led_w(0,1); }
void liberator_port_w(int offset, int data) { offset &= 0x0007 ; switch( offset ) { case 0 : /* START LED 1 */ osd_led_w(0,(data & 0x10) ? 1 : 0) ; break; case 1 : /* START LED 2 */ osd_led_w(1,(data & 0x10) ? 1 : 0) ; break; case 2 : /* TBSWP* */ break; case 3 : /* SPARE */ break; case 4 : /* CTRLD* */ ctrld = data ; break; case 5 : /* COINCNTRR */ break; case 6 : /* COINCNTRL */ break; case 7 : /* PLANET */ liberator_planetbit_w( offset, data ) ; break; } }
void sbrkout_serve_led(int offset,int value) { if (offset==0) osd_led_w(2,1); else osd_led_w(2,0); }
/*************************************************************************** subs_lamp2_w ***************************************************************************/ void subs_lamp2_w(int offset, int data) { if ((offset & 0x01) == 1) { osd_led_w(1,0); } else { osd_led_w(1,1); } }
/*************************************************************************** ticket_dispenser_toggle How I think this works: When a ticket dispenses, there is N milliseconds of status = high, and N milliseconds of status = low (a wait cycle?). ***************************************************************************/ static void ticket_dispenser_toggle(int parm) { /* If we still have power, keep toggling ticket states. */ if (power) { status ^= active_bit; timer = timer_set (TIME_IN_MSEC(time_msec), 0, ticket_dispenser_toggle); } if (status == ticketdispensed) { osd_led_w(2,1); dispensed_tickets++; } else { osd_led_w(2,0); } }
/*************************************************************************** ticket_dispenser_w ***************************************************************************/ void ticket_dispenser_w(int offset, int data) { /* On an activate signal, start dispensing! */ if ((data & active_bit) == motoron) { if (!power) { timer = timer_set (TIME_IN_MSEC(time_msec), 0, ticket_dispenser_toggle); power = 1; status = ticketnotdispensed; } } else { if (power) { timer_remove(timer); osd_led_w(2,0); power = 0; } } }
/*************************************************************************** Run the emulation. Start the various subsystems and the CPU emulation. Returns non zero in case of error. ***************************************************************************/ int run_machine(void) { int res = 1; if (vh_open() == 0) { tilemap_init(); sprite_init(); gfxobj_init(); if (drv->vh_start == 0 || (*drv->vh_start)() == 0) /* start the video hardware */ { if (sound_start() == 0) /* start the audio hardware */ { int region; real_scrbitmap = artwork_overlay ? overlay_real_scrbitmap : Machine->scrbitmap; /* free memory regions allocated with REGIONFLAG_DISPOSE (typically gfx roms) */ for (region = 0; region < MAX_MEMORY_REGIONS; region++) { if (Machine->memory_region_type[region] & REGIONFLAG_DISPOSE) { int i; /* invalidate contents to avoid subtle bugs */ for (i = 0;i < memory_region_length(region);i++) memory_region(region)[i] = rand(); free(Machine->memory_region[region]); Machine->memory_region[region] = 0; } } if (settingsloaded == 0) { /* if there is no saved config, it must be first time we run this game, */ /* so show the disclaimer. */ //sq if (showcopyright(real_scrbitmap)) goto userquit; } //sq if (showgamewarnings(real_scrbitmap) == 0) /* show info about incorrect behaviour (wrong colors etc.) */ { /* shut down the leds (work around Allegro hanging bug in the DOS port) */ osd_led_w(0,1); osd_led_w(1,1); osd_led_w(2,1); osd_led_w(3,1); osd_led_w(0,0); osd_led_w(1,0); osd_led_w(2,0); osd_led_w(3,0); init_user_interface(); /* disable cheat if no roms */ if (!gamedrv->rom) options.cheat = 0; if (options.cheat) InitCheat(); if (drv->nvram_handler) { void *f; f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_NVRAM,0); (*drv->nvram_handler)(f,0); if (f) osd_fclose(f); } cpu_run(); /* run the emulation! */ if (drv->nvram_handler) { void *f; if ((f = osd_fopen(Machine->gamedrv->name,0,OSD_FILETYPE_NVRAM,1)) != 0) { (*drv->nvram_handler)(f,1); osd_fclose(f); } } if (options.cheat) StopCheat(); /* save input ports settings */ save_input_port_settings(); } userquit: /* the following MUST be done after hiscore_save() otherwise */ /* some 68000 games will not work */ sound_stop(); if (drv->vh_stop) (*drv->vh_stop)(); overlay_free(); backdrop_free(); res = 0; } else if (!bailing) { bailing = 1; printf("Unable to start audio emulation\n"); } } else if (!bailing) { bailing = 1; printf("Unable to start video emulation\n"); } gfxobj_close(); sprite_close(); tilemap_close(); vh_close(); } else if (!bailing) { bailing = 1; printf("Unable to start video emulation\n"); } return res; }
void sprint2_lamp2(int offset,int value) { osd_led_w(1,(value>0)); }
static WRITE_HANDLER( ccastles_led_w ) { osd_led_w(offset,~data); }
void dominos_lamp2_w(int offset,int value) { /* Address Line 0 is the data passed to LAMP2 */ osd_led_w(1,offset & 0x01); }
static WRITE_HANDLER( rallyx_leds_w ) { osd_led_w(offset,data); }
static WRITE_HANDLER( warpwarp_leds_w ) { osd_led_w(offset,data); }
void canyon_led_w(int offset, int data) { osd_led_w((offset & 0x01), data & 0x01); }