Previous 15994 Revisions Next

r5439 Saturday 15th August, 2009 at 14:03:11 UTC by Angelo Salese
[SNES]: Made the OAM address reset more accurate.
[src/mame/machine]snes.c

src/mame/machine/snes.c
r5438r5439
103103   snes_hirq_tick(machine);
104104}
105105
106static TIMER_CALLBACK( snes_scanline_tick )
106static TIMER_CALLBACK( snes_reset_oam_address )
107107{
108108   // make sure we're in the 65816's context since we're messing with the OAM and stuff
109109   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
110110
111   if(!(snes_ram[INIDISP]&0x80)) //Reset OAM address, byuu says it happens at H=10
112   {
113      memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low ); /* Reset oam address */
114      memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high );
115   }
116}
117
118static TIMER_CALLBACK( snes_scanline_tick )
119{
111120   /* Increase current line - we want to latch on this line during it, not after it */
112121   snes_ppu.beam.current_vert = video_screen_get_vpos(machine->primary_screen);
113122
r5438r5439
157166   /* Start of VBlank */
158167   if( snes_ppu.beam.current_vert == snes_ppu.beam.last_visible_line )
159168   {
160      if(!(snes_ram[INIDISP]&0x80))
161      {
162         memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low ); /* Reset oam address */
163         memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high );
164      }
169      timer_set(machine, video_screen_get_time_until_pos(machine->primary_screen, snes_ppu.beam.current_vert, 10), NULL, 0, snes_reset_oam_address);
170
165171      snes_ram[HVBJOY] |= 0x81;      /* Set vblank bit to on & indicate controllers being read */
166172      snes_ram[RDNMI] |= 0x80;      /* Set NMI occured bit */
167173
r5438r5439
664670   // APU is mirrored from 2140 to 217f
665671   if (offset >= APU00 && offset < WMDATA)
666672   {
667//          printf("816: %02x to APU @ %d\n", data, offset&3);
668           spc_port_in[offset & 0x3] = data;
673//      printf("816: %02x to APU @ %d\n", data, offset&3);
674      spc_port_in[offset & 0x3] = data;
669675      cpuexec_boost_interleave(space->machine, attotime_zero, ATTOTIME_IN_USEC(20));
670676      return;
671677   }
r5438r5439
674680   switch( offset )
675681   {
676682      case INIDISP:   /* Initial settings for screen */
683         if((snes_ram[INIDISP] & 0x80) && (!(data & 0x80))) //a 1->0 force blank transition causes a reset OAM address
684         {
685            memory_write_byte(space, OAMADDL, snes_ppu.oam.saved_address_low );
686            memory_write_byte(space, OAMADDH, snes_ppu.oam.saved_address_high );
687         }
677688         break;
678689      case OBSEL:      /* Object size and data area designation */
679690         snes_ppu.layer[4].data = ((data & 0x3) * 0x2000) << 1;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team