Previous 15994 Revisions Next

r5458 Tuesday 18th August, 2009 at 14:36:48 UTC by Angelo Salese
[SNES]: improved joypad read/write handling and fixed a serial port quirk.
[src/mame/machine]snes.c

src/mame/machine/snes.c
r5457r5458
190190   }
191191
192192   /* three lines after start of vblank we update the controllers (value from snes9x) */
193   if (snes_ppu.beam.current_vert == snes_ppu.beam.last_visible_line + 3)
193   if (snes_ppu.beam.current_vert == snes_ppu.beam.last_visible_line + 2)
194194   {
195195      int i;
196196
r5457r5458
559559            {
560560               return 0 | (snes_open_bus_r(space,0) & 0xfc); //correct?
561561            }
562            value = ((joypad[0].low | (joypad[0].high << 8) | 0x10000) >> (15 - (joypad[0].oldrol++ % 16))) & 0x1;
562            value = ((joy1l | (joy1h << 8) | 0x10000) >> (16 - (joypad[0].oldrol & 0xf))) & 0x1;
563            joypad[0].oldrol++;
564            joypad[0].oldrol&=0xf;
563565            if( !(joypad[0].oldrol % 17) )
564566               value = 0x1;
565567            return (value & 0x03) | (snes_open_bus_r(space,0) & 0xfc); //correct?
r5457r5458
603605      case RDMPYH:      /* Product/Remainder of mult/div result (high) */
604606         return snes_ram[offset];
605607      case JOY1L:         /* Joypad 1 status register (low) */
606         return joypad[0].low;
608         return joy1l;
607609      case JOY1H:         /* Joypad 1 status register (high) */
608         return joypad[0].high;
610         return joy1h;
609611      case JOY2L:         /* Joypad 2 status register (low) */
610         return joypad[1].low;
612         return joy2l;
611613      case JOY2H:         /* Joypad 2 status register (high) */
612         return joypad[1].high;
614         return joy2h;
613615      case JOY3L:         /* Joypad 3 status register (low) */
614         return joypad[2].low;
616         return joy3l;
615617      case JOY3H:         /* Joypad 3 status register (high) */
616         return joypad[2].high;
618         return joy3h;
617619      case JOY4L:         /* Joypad 4 status register (low) */
618         return joypad[3].low;
620         return joy4l;
619621      case JOY4H:         /* Joypad 4 status register (high) */
620         return joypad[3].high;
622         return joy4h;
621623      case DMAP0:
622624      case DMAP1:
623625      case DMAP2:
r5457r5458
11781180      case WMADDH:   /* Address to read/write to wram (high) */
11791181         break;
11801182      case OLDJOY1:   /* Old NES joystick support */
1181         if( (data & 0x1) && !(snes_ram[offset] & 0x1) )
1183         if( ((data & 0x1) && !(snes_ram[offset] & 0x1)) || ((!(data & 0x1)) && (snes_ram[offset] & 0x1)) )
11821184         {
11831185            joypad[0].oldrol = 0;
11841186            joypad[1].oldrol = 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team