Previous 15994 Revisions Next

r7683 Saturday 3rd April, 2010 at 15:18:29 UTC by Angelo Salese
[SNES]: Moved the i/o update status inside a timer, this fixes F-1 Grand Prix Part 2 booting
[src/mame/includes]snes.h
[src/mame/machine]snes.c

src/mame/machine/snes.c
r7682r7683
105105   snes_hdma_init(cpu0space);
106106}
107107
108static TIMER_CALLBACK( snes_update_io )
109{
110   snes_state *state = (snes_state *)machine->driver_data;
111   const address_space *cpu0space = cpu_get_address_space(state->maincpu, ADDRESS_SPACE_PROGRAM);
112   state->io_read(cpu0space->machine);
113   snes_ram[HVBJOY] &= 0xfe;      /* Clear busy bit */
114}
115
108116static TIMER_CALLBACK( snes_scanline_tick )
109117{
110118   snes_state *state = (snes_state *)machine->driver_data;
r7682r7683
168176         // NMI goes off about 12 cycles after this (otherwise Chrono Trigger, NFL QB Club, etc. lock up)
169177         timer_adjust_oneshot(state->nmi_timer, cpu_clocks_to_attotime(state->maincpu, 12), 0);
170178      }
179
180      /* three lines after start of vblank we update the controllers (value from snes9x) */
181      timer_adjust_oneshot(state->io_timer, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert + 2, 0), 0);
171182   }
172183
173184   // hdma reset happens at scanline 0, H=~6
r7682r7683
177188      snes_hdma_init(cpu0space);
178189   }
179190
180   /* three lines after start of vblank we update the controllers (value from snes9x) */
181   if (snes_ppu.beam.current_vert == snes_ppu.beam.last_visible_line + 2)
182   {
183      state->io_read(machine);
184      snes_ram[HVBJOY] &= 0xfe;      /* Clear busy bit */
185   }
186
187191   if (snes_ppu.beam.current_vert == 0)
188192   {   /* VBlank is over, time for a new frame */
189193      snes_ram[HVBJOY] &= 0x7f;      /* Clear vblank bit */
r7682r7683
196200
197201   timer_adjust_oneshot(state->scanline_timer, attotime_never, 0);
198202   timer_adjust_oneshot(state->hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert, state->hblank_offset * state->htmult), 0);
203
204//   printf("%02x %d\n",snes_ram[HVBJOY],snes_ppu.beam.current_vert);
199205}
200206
201207/* This is called at the start of hblank *before* the scanline indicated in current_vert! */
r7682r7683
559565         if((snes_ram[NMITIMEN] & 0x30) == 0x00)
560566         {
561567            cpu_set_input_line(state->maincpu, G65816_LINE_IRQ, CLEAR_LINE );
562            snes_ram[TIMEUP] = 0;   // flag is cleared on both read and write
568            snes_ram[TIMEUP] = 0;   // clear pending IRQ if irq is disabled here, 3x3 Eyes - Seima Korin Den behaves on this
563569         }
564570         break;
565571      case OLDJOY2:   /* Old NES joystick support */
r7682r7683
14251431   timer_adjust_oneshot(state->div_timer, attotime_never, 0);
14261432   state->mult_timer = timer_alloc(machine, snes_mult_callback, NULL);
14271433   timer_adjust_oneshot(state->mult_timer, attotime_never, 0);
1434   state->io_timer = timer_alloc(machine, snes_update_io, NULL);
1435   timer_adjust_oneshot(state->io_timer, attotime_never, 0);
14281436
14291437   // SNES hcounter has a 0-339 range.  hblank starts at counter 260.
14301438   // clayfighter sets an HIRQ at 260, apparently it wants it to be before hdma kicks off, so we'll delay 2 pixels.
src/mame/includes/snes.h
r7682r7683
403403   emu_timer             *hirq_timer;
404404   emu_timer             *div_timer;
405405   emu_timer             *mult_timer;
406   emu_timer             *io_timer;
406407
407408   /* DMA/HDMA-related */
408409   struct

Previous 15994 Revisions Next


© 1998-2018 The MESS Team