Previous 199869 Revisions Next

r17506 Monday 27th August, 2012 at 17:09:54 UTC by Angelo Salese
Some improvements, some base SNES bug(s) prevents this to work like expected tho
[src/mame/drivers]nss.c
[src/mame/includes]snes.h
[src/mame/machine]snes.c

trunk/src/mame/machine/snes.c
r17505r17506
561561      case RDMPYH:      /* Product/Remainder of mult/div result (high) */
562562         return snes_ram[offset];
563563      case JOY1L:         /* Joypad 1 status register (low) */
564         if(state->m_is_nss && state->m_input_disabled)
565            return 0;
566
564567         return state->m_joy1l;
565568      case JOY1H:         /* Joypad 1 status register (high) */
569         if(state->m_is_nss && state->m_input_disabled)
570            return 0;
571
566572         return state->m_joy1h;
567573      case JOY2L:         /* Joypad 2 status register (low) */
574         if(state->m_is_nss && state->m_input_disabled)
575            return 0;
576
568577         return state->m_joy2l;
569578      case JOY2H:         /* Joypad 2 status register (high) */
579         if(state->m_is_nss && state->m_input_disabled)
580            return 0;
581
570582         return state->m_joy2h;
571583      case JOY3L:         /* Joypad 3 status register (low) */
584         if(state->m_is_nss && state->m_input_disabled)
585            return 0;
586
572587         return state->m_joy3l;
573588      case JOY3H:         /* Joypad 3 status register (high) */
589         if(state->m_is_nss && state->m_input_disabled)
590            return 0;
591
574592         return state->m_joy3h;
575593      case JOY4L:         /* Joypad 4 status register (low) */
594         if(state->m_is_nss && state->m_input_disabled)
595            return 0;
596
576597         return state->m_joy4l;
577598      case JOY4H:         /* Joypad 4 status register (high) */
599         if(state->m_is_nss && state->m_input_disabled)
600            return 0;
601
578602         return state->m_joy4h;
579603
580604      case 0x4100:      /* NSS Dip-Switches */
r17505r17506
584608
585609            return snes_open_bus_r(space, 0);
586610         }
587//      case 0x4101: //PC: a104 - a10e - a12a   //only nss_actr
611//      case 0x4101: //PC: a104 - a10e - a12a   //only nss_actr (DSW actually reads in word units ...)
588612
589613      default:
590614//          mame_printf_debug("snes_r: offset = %x pc = %x\n",offset,cpu_get_pc(&space->device()));
r17505r17506
592616                        break;
593617   }
594618
595   //printf("unsupported read: offset == %08x\n", offset);
619//   printf("unsupported read: offset == %08x\n", offset);
596620
597621   /* Unsupported reads returns open bus */
598622//  printf("%02x %02x\n",offset,snes_open_bus_r(space, 0));
r17505r17506
695719            state->m_read_idx[0] = 0;
696720            state->m_read_idx[1] = 0;
697721         }
698
722         if(state->m_is_nss)
723         {
724            state->m_game_over_flag = (data & 4) >> 2;
725         }
699726         break;
700727      case NMITIMEN:   /* Flag for v-blank, timer int. and joy read */
701728         if((data & 0x30) == 0x00)
r17505r17506
15271554   // this actually works like reading the first 16bits from oldjoy1/2 in reverse order
15281555   if (snes_ram[NMITIMEN] & 1)
15291556   {
1530      state->m_joy1l = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data1[0] & 0x00ff) >> 0;
1531      state->m_joy1h = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data1[0] & 0xff00) >> 8;
1532      state->m_joy2l = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data1[1] & 0x00ff) >> 0;
1533      state->m_joy2h = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data1[1] & 0xff00) >> 8;
1534      state->m_joy3l = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data2[0] & 0x00ff) >> 0;
1535      state->m_joy3h = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data2[0] & 0xff00) >> 8;
1536      state->m_joy4l = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data2[1] & 0x00ff) >> 0;
1537      state->m_joy4h = (state->m_is_nss && state->m_input_disabled) ? 0 : (state->m_data2[1] & 0xff00) >> 8;
1557      state->m_joy1l = (state->m_data1[0] & 0x00ff) >> 0;
1558      state->m_joy1h = (state->m_data1[0] & 0xff00) >> 8;
1559      state->m_joy2l = (state->m_data1[1] & 0x00ff) >> 0;
1560      state->m_joy2h = (state->m_data1[1] & 0xff00) >> 8;
1561      state->m_joy3l = (state->m_data2[0] & 0x00ff) >> 0;
1562      state->m_joy3h = (state->m_data2[0] & 0xff00) >> 8;
1563      state->m_joy4l = (state->m_data2[1] & 0x00ff) >> 0;
1564      state->m_joy4h = (state->m_data2[1] & 0xff00) >> 8;
15381565
15391566      // make sure read_idx starts returning all 1s because the auto-read reads it :-)
15401567      state->m_read_idx[0] = 16;
15411568      state->m_read_idx[1] = 16;
15421569   }
15431570
1571   if(state->m_is_nss)
1572      state->m_joy_flag = 0;
15441573}
15451574
1575/*
1576      if(state->m_is_nss)
1577         state->m_joy_flag = 0;
1578
1579*/
1580
15461581static UINT8 nss_oldjoy1_read( running_machine &machine )
15471582{
15481583   snes_state *state = machine.driver_data<snes_state>();
trunk/src/mame/includes/snes.h
r17505r17506
430430   /* HW flags */
431431   UINT8                 m_is_nss;
432432   UINT8              m_input_disabled;
433   UINT8              m_game_over_flag;
434   UINT8                 m_joy_flag;
433435//   UINT8                 m_is_sfcbox;
434436
435437   /* timers */
trunk/src/mame/drivers/nss.c
r17505r17506
77   TODO:
88   - Fix sound CPU halt / reset lines, particularly needed by this to work
99     correctly;
10   - Fix continue behaviour, might be the same issue as the one above.
1011   - Various M50458 bits
1112   - OSD should actually super-impose with the SNES video somehow;
1213
r17505r17506
322323   DECLARE_WRITE8_MEMBER(port_02_w);
323324   DECLARE_WRITE8_MEMBER(port_03_w);
324325   DECLARE_WRITE8_MEMBER(port_04_w);
326   DECLARE_WRITE8_MEMBER(port_07_w);
325327
326328   DECLARE_DRIVER_INIT(nss);
327   bitmap_rgb32 *m_tmpbitmap;
328329
330   DECLARE_CUSTOM_INPUT_MEMBER(game_over_flag_r);
329331};
330332
331333
r17505r17506
333335UINT32 nss_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
334336{
335337   m_m50458->screen_update(screen,bitmap,cliprect);
336
337338   return 0;
338339}
339340
r17505r17506
518519*/
519520   UINT8 res;
520521
521   res = 0 << 7;
522   res = (m_joy_flag) << 7;
522523   res|= (machine().primary_screen->vblank() & 1) << 6;
523524   res|= (((ioport("SERIAL1_DATA1_H")->read() & 0x80) >> 7) << 5);
524525   res|= (((ioport("SERIAL1_DATA1_L")->read() & 0x80) >> 7) << 4);
525   res|= (((ioport("SERIAL1_DATA1_L")->read() & 0x08) >> 3) << 3);
526   res|= (((ioport("SERIAL1_DATA1_L")->read() & 0x04) >> 2) << 2);
527   res|= (((ioport("SERIAL1_DATA1_L")->read() & 0x02) >> 1) << 1);
528   res|= (((ioport("SERIAL1_DATA1_L")->read() & 0x01) >> 0) << 0);
526   res|= (((ioport("SERIAL1_DATA1_H")->read() & 0x04) >> 2) << 3);
527   res|= (((ioport("SERIAL1_DATA1_H")->read() & 0x08) >> 3) << 2);
528   res|= (((ioport("SERIAL1_DATA1_H")->read() & 0x02) >> 1) << 1);
529   res|= (((ioport("SERIAL1_DATA1_H")->read() & 0x01) >> 0) << 0);
529530
530531   return res;
531532}
r17505r17506
604605   coin_counter_w(machine(), 1, (data >> 1) & 1);
605606}
606607
608WRITE8_MEMBER(nss_state::port_07_w)
609{
610   m_joy_flag = 1;
611}
612
607613static ADDRESS_MAP_START( bios_io_map, AS_IO, 8, nss_state )
608614   ADDRESS_MAP_GLOBAL_MASK(0x7)
609615   AM_RANGE(0x00, 0x00) AM_READ(port_00_r) AM_WRITE(port_00_w)
r17505r17506
611617   AM_RANGE(0x02, 0x02) AM_READ_PORT("SYSTEM") AM_WRITE(port_02_w)
612618   AM_RANGE(0x03, 0x03) AM_READ_PORT("RTC") AM_WRITE(port_03_w)
613619   AM_RANGE(0x04, 0x04) AM_WRITE(port_04_w)
614   AM_RANGE(0x07, 0x07) AM_WRITENOP // Pad watchdog
620   AM_RANGE(0x07, 0x07) AM_WRITE(port_07_w)
615621ADDRESS_MAP_END
616622
617623static MACHINE_START( nss )
r17505r17506
622628
623629   state->m_is_nss = 1;
624630   state->m_wram = auto_alloc_array_clear(machine, UINT8, 0x1000);
625   state->m_tmpbitmap = auto_bitmap_rgb32_alloc(machine,24*12,12*18);
626631}
627632
633
634CUSTOM_INPUT_MEMBER(nss_state::game_over_flag_r)
635{
636   return m_game_over_flag;
637}
638
628639static INPUT_PORTS_START( snes )
629640   PORT_START("SYSTEM")
630641   PORT_BIT( 0xf8, IP_ACTIVE_HIGH, IPT_UNKNOWN )
r17505r17506
633644   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_COIN1 )
634645
635646   PORT_START("FP")
636   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Game Over Flag, TODO
647   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, nss_state,game_over_flag_r, NULL)
637648   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_BUTTON13 ) PORT_NAME("Restart Button")
638649   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON12 ) PORT_NAME("Page Up Button")
639650   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON11 ) PORT_NAME("Page Down Button")
r17505r17506
826837   /* start with both CPUs disabled */
827838   device_set_input_line(state->m_maincpu, INPUT_LINE_RESET, ASSERT_LINE);
828839   device_set_input_line(state->m_soundcpu, INPUT_LINE_RESET, ASSERT_LINE);
840
841   state->m_game_over_flag = 1;
842   state->m_joy_flag = 1;
829843}
830844
831845static MACHINE_CONFIG_DERIVED( nss, snes )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team