Previous 199869 Revisions Next

r17492 Monday 27th August, 2012 at 01:36:55 UTC by Angelo Salese
Various hook-ups for reset/halt lines and the like, all games but F-Zero doesn't boot now
[src/emu/video]m50458.c
[src/mame/drivers]nss.c
[src/mame/includes]snes.h
[src/mame/machine]snes.c

trunk/src/mame/machine/snes.c
r17491r17492
579579
580580      case 0x4100:      /* NSS Dip-Switches */
581581         {
582            ioport_port *port = state->ioport("DSW");
583            if (port != NULL)
582            if (state->m_is_nss)
584583               return space->machine().root_device().ioport("DSW")->read();
585            else
586               return snes_open_bus_r(space, 0);
584
585            return snes_open_bus_r(space, 0);
587586         }
588587//      case 0x4101: //PC: a104 - a10e - a12a   //only nss_actr
589//      case 0x420c: //PC: 9c7d - 8fab          //only nss_ssoc
590588
591589      default:
592590//          mame_printf_debug("snes_r: offset = %x pc = %x\n",offset,cpu_get_pc(&space->device()));
r17491r17492
697695            state->m_read_idx[0] = 0;
698696            state->m_read_idx[1] = 0;
699697         }
698
700699         break;
701700      case NMITIMEN:   /* Flag for v-blank, timer int. and joy read */
702701         if((data & 0x30) == 0x00)
r17491r17492
15281527   // this actually works like reading the first 16bits from oldjoy1/2 in reverse order
15291528   if (snes_ram[NMITIMEN] & 1)
15301529   {
1531      state->m_joy1l = (state->m_data1[0] & 0x00ff) >> 0;
1532      state->m_joy1h = (state->m_data1[0] & 0xff00) >> 8;
1533      state->m_joy2l = (state->m_data1[1] & 0x00ff) >> 0;
1534      state->m_joy2h = (state->m_data1[1] & 0xff00) >> 8;
1535      state->m_joy3l = (state->m_data2[0] & 0x00ff) >> 0;
1536      state->m_joy3h = (state->m_data2[0] & 0xff00) >> 8;
1537      state->m_joy4l = (state->m_data2[1] & 0x00ff) >> 0;
1538      state->m_joy4h = (state->m_data2[1] & 0xff00) >> 8;
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;
15391538
15401539      // make sure read_idx starts returning all 1s because the auto-read reads it :-)
15411540      state->m_read_idx[0] = 16;
r17491r17492
18161815      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].fire_lock);
18171816      state_save_register_item(machine, "snes_dma", NULL, i, state->m_scope[i].offscreen);
18181817   }
1818
1819   state->m_is_nss = 0;
18191820}
18201821
18211822MACHINE_RESET( snes )
trunk/src/mame/includes/snes.h
r17491r17492
405405{
406406public:
407407   snes_state(const machine_config &mconfig, device_type type, const char *tag)
408      : driver_device(mconfig, type, tag) { }
408      : driver_device(mconfig, type, tag)
409      { }
409410
411
410412   /* misc */
411413   UINT16                m_htmult;      /* in 512 wide, we run HTOTAL double and halve it on latching */
412414   UINT16                m_cgram_address;   /* CGRAM address */
r17491r17492
425427   UINT16                m_vtime;
426428   UINT16                m_vmadd;
427429
428   UINT32 snes_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
430   /* HW flags */
431   UINT8                 m_is_nss;
432   UINT8              m_input_disabled;
433//   UINT8                 m_is_sfcbox;
429434
430435   /* timers */
431436   emu_timer             *m_scanline_timer;
r17491r17492
525530   inline void snes_draw_blend( UINT16 offset, UINT16 *colour, UINT8 prevent_color_math, UINT8 black_pen_clip, int switch_screens );
526531   void snes_refresh_scanline( running_machine &machine, bitmap_rgb32 &bitmap, UINT16 curline );
527532
533   UINT32 snes_screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
534
528535   DECLARE_READ8_MEMBER( snes_oam_read );
529536   DECLARE_WRITE8_MEMBER( snes_oam_write );
530537   DECLARE_READ8_MEMBER( snes_cgram_read );
trunk/src/mame/drivers/nss.c
r17491r17492
55   driver by Angelo Salese, based off info from Noca$h
66
77   TODO:
8   - EEPROM
8   - EEPROM defaults / fix EEPROM hook-up, all games but F-Zero doesn't
9     boot at current stage
10   - Fix sound CPU halt / reset lines, particularly needed by this to work
11     correctly;
912   - Various M50458 bits
10   - Still dies at a cart check, why?
1113   - OSD should actually super-impose with the SNES video somehow;
1214
1315***************************************************************************
r17491r17492
307309
308310   DECLARE_READ8_MEMBER(spc_ram_100_r);
309311   DECLARE_WRITE8_MEMBER(spc_ram_100_w);
310   DECLARE_READ8_MEMBER(port_00_r);
311   DECLARE_WRITE8_MEMBER(port_00_w);
312312   DECLARE_READ8_MEMBER(ram_wp_r);
313313   DECLARE_WRITE8_MEMBER(ram_wp_w);
314   DECLARE_WRITE8_MEMBER(rtc_osd_w);
315   DECLARE_WRITE8_MEMBER(port_01_w);
316314   DECLARE_READ8_MEMBER(nss_prot_r);
317315   DECLARE_WRITE8_MEMBER(nss_prot_w);
318316
317   DECLARE_READ8_MEMBER(port_00_r);
318   DECLARE_WRITE8_MEMBER(port_00_w);
319   DECLARE_WRITE8_MEMBER(port_01_w);
320   DECLARE_WRITE8_MEMBER(port_02_w);
321   DECLARE_WRITE8_MEMBER(port_03_w);
322   DECLARE_WRITE8_MEMBER(port_04_w);
323
319324   DECLARE_DRIVER_INIT(nss);
320325   bitmap_rgb32 *m_tmpbitmap;
321326
r17491r17492
427432Output
4284330x00/0x80 NMI Control and RAM protect
4294340x01/0x81 Unknown and Slot Select
430  7     Maybe SNES Joypad Enable? (0=Disable/Demo, 1=Enable/Game)
431  6   Unknown/unused        (should be always 0)
432  5   SNES Sound Mute       (0=Normal, 1=Mute) (for optional mute in demo mode)
433  4   Unknown  ;from INST-ROM flag! (Lo/HiROM, 2-player, zapper, volume or so?)
434  3-2 Slot Select        (0..2 for Slot 1..3) (mapping to both SNES and Z80)
435  1     Maybe SNES CPU pause?  (cleared on deposit coin to continue) (1=Run)
436  0     Maybe SNES CPU/PPU reset?   (0=Reset, 1=Run)
4374350x02/0x82 RTC and OSD
4384360x03/0x83 Unknown and LED control
439  7     Layer SNES Enable?             (used by token proc, see 7A46h) SNES?
440  6     Layer OSD Enable?
441  5-4 Unknown/unused (should be always 0)
442  3   LED Instructions (0=Off, 1=On)  ;-glows in demo (prompt for INST button)
443  2   LED Game 3       (0=Off, 1=On)  ;\
444  1   LED Game 2       (0=Off, 1=On)  ; blinked when enough credits inserted
445  0   LED Game 1       (0=Off, 1=On)  ;/
4464370x84 Coin Counter Outputs
447  7-2 Unknown/unused (should be always 0)
448  1   Coin Counter 2 (0=No change, 1=Increment external counter)
449  0   Coin Counter 1 (0=No change, 1=Increment external counter)
4504380x05 Unknown
4514390x07 SNES Watchdog / Acknowledge SNES Joypad Read Flag
452440
r17491r17492
505493   AM_RANGE(0x9000, 0x9fff) AM_READWRITE(ram_wp_r,ram_wp_w)
506494   AM_RANGE(0xa000, 0xa000) AM_READ_PORT("EEPROMIN")
507495   AM_RANGE(0xc000, 0xdfff) AM_ROM AM_REGION("ibios_rom", 0x6000 )
508   AM_RANGE(0xe000, 0xffff) AM_READ(nss_prot_r)
509   AM_RANGE(0xe000, 0xffff) AM_WRITE(nss_prot_w)
496   AM_RANGE(0xe000, 0xffff) AM_READWRITE(nss_prot_r,nss_prot_w)
510497ADDRESS_MAP_END
511498
512499READ8_MEMBER(nss_state::port_00_r)
r17491r17492
549536
550537}
551538
552WRITE8_MEMBER(nss_state::rtc_osd_w)
539WRITE8_MEMBER(nss_state::port_01_w)
553540{
554541/*
542   x--- ---- Maybe SNES Joypad Enable? (0=Disable/Demo, 1=Enable/Game)
543   -x-- ---- Unknown/unused        (should be always 0)
544   --x- ---- SNES Sound Mute       (0=Normal, 1=Mute) (for optional mute in demo mode)
545   ---x ---- Unknown  ;from INST-ROM flag! (Lo/HiROM, 2-player, zapper, volume or so?)
546   ---- xx-- Slot Select        (0..2 for Slot 1..3) (mapping to both SNES and Z80)
547   ---- --x- Maybe SNES CPU pause?  (cleared on deposit coin to continue) (1=Run)
548   ---- ---x Maybe SNES CPU/PPU reset?   (0=Reset, 1=Run)
549*/
550   m_input_disabled = ((data & 0x80) >> 7) ^ 1;
551
552   m_cart_sel = (data & 0xc) >> 2;
553
554   device_set_input_line(m_maincpu, INPUT_LINE_HALT, (data & 2) ? CLEAR_LINE : ASSERT_LINE);
555   device_set_input_line(m_soundcpu, INPUT_LINE_HALT, (data & 2) ? CLEAR_LINE : ASSERT_LINE);
556   device_set_input_line(m_maincpu, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
557   device_set_input_line(m_soundcpu, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
558
559//   printf("%02x\n",data);
560}
561
562WRITE8_MEMBER(nss_state::port_02_w)
563{
564/*
555565   x--- ----  OSD Clock ?       (usually same as Bit6)  ;\Chip Select when Bit6=Bit7 ?
556566   -x-- ----  OSD Clock ?       (usually same as Bit7)  ;/
557567   --x- ----  OSD Data Out      (0=Low=Zero, 1=High=One)
r17491r17492
565575   ioport("RTC_OSD")->write(data, 0xff);
566576}
567577
568WRITE8_MEMBER(nss_state::port_01_w)
578WRITE8_MEMBER(nss_state::port_03_w)
569579{
570   m_cart_sel = (data & 0xc) >> 2;
580/*
581   x--- ----     Layer SNES Enable?             (used by token proc, see 7A46h) SNES?
582   -x-- ----     Layer OSD Enable?
583   --xx ---- Unknown/unused (should be always 0)
584   ---- x---   LED Instructions (0=Off, 1=On)  ;-glows in demo (prompt for INST button)
585   ---- -x--   LED Game 3       (0=Off, 1=On)  ;\
586   ---- --x-   LED Game 2       (0=Off, 1=On)  ; blinked when enough credits inserted
587   ---- ---x   LED Game 1       (0=Off, 1=On)  ;/
588
589*/
590//   popmessage("%02x",data);
571591}
572592
593WRITE8_MEMBER(nss_state::port_04_w)
594{
595   coin_counter_w(machine(), 0, (data >> 0) & 1);
596   coin_counter_w(machine(), 1, (data >> 1) & 1);
597}
598
573599static ADDRESS_MAP_START( bios_io_map, AS_IO, 8, nss_state )
574600   ADDRESS_MAP_GLOBAL_MASK(0x7)
575601   AM_RANGE(0x00, 0x00) AM_READ(port_00_r) AM_WRITE(port_00_w)
576602   AM_RANGE(0x01, 0x01) AM_READ_PORT("FP")  AM_WRITE(port_01_w)
577   AM_RANGE(0x02, 0x02) AM_READ_PORT("SYSTEM") AM_WRITE(rtc_osd_w)
578   AM_RANGE(0x03, 0x03) AM_READ_PORT("RTC")
603   AM_RANGE(0x02, 0x02) AM_READ_PORT("SYSTEM") AM_WRITE(port_02_w)
604   AM_RANGE(0x03, 0x03) AM_READ_PORT("RTC") AM_WRITE(port_03_w)
605   AM_RANGE(0x04, 0x04) AM_WRITE(port_04_w)
606   AM_RANGE(0x07, 0x07) AM_WRITENOP // Pad watchdog
579607ADDRESS_MAP_END
580608
581609/* Mitsubishi M6M80011 */
r17491r17492
583611{
584612   8,            /* address bits */
585613   16,            /* data bits */
586   "10101000",      /*  read command */
587   "10100100",      /* write command */
614   "*10101000",      /*  read command */
615   "*10100100",      /* write command */
588616   0,            /* erase command */
589   "10100000",      /*  lock command */
590   "10100011"      /* unlock command*/
617   "*10100000",      /*  lock command */
618   "*10100011"      /* unlock command*/
591619   /* "10101001" TODO: status output? */
592620};
593621
r17491r17492
598626
599627   MACHINE_START_CALL(snes);
600628
629   state->m_is_nss = 1;
601630   state->m_wram = auto_alloc_array_clear(machine, UINT8, 0x1000);
602631   state->m_tmpbitmap = auto_bitmap_rgb32_alloc(machine,24*12,12*18);
603632}
r17491r17492
794823      device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE);
795824}
796825
826static MACHINE_RESET( nss )
827{
828   nss_state *state = machine.driver_data<nss_state>();
829
830   MACHINE_RESET_CALL( snes );
831
832   /* start with both CPUs disabled */
833   device_set_input_line(state->m_maincpu, INPUT_LINE_RESET, ASSERT_LINE);
834   device_set_input_line(state->m_soundcpu, INPUT_LINE_RESET, ASSERT_LINE);
835}
836
797837static MACHINE_CONFIG_DERIVED( nss, snes )
798838
799839   MCFG_CPU_ADD("bios", Z80, 4000000)
r17491r17492
808848   /* TODO: the screen should actually superimpose, but for the time being let's just separate outputs for now */
809849   MCFG_DEFAULT_LAYOUT(layout_dualhsxs)
810850
851   MCFG_MACHINE_RESET( nss )
852
811853   MCFG_SCREEN_ADD("osd", RASTER)
812854   MCFG_SCREEN_REFRESH_RATE(60)
813855   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500))
r17491r17492
835877   ROM_LOAD("nss-c.dat"  , 0x00000, 0x8000, CRC(a8e202b3) SHA1(b7afcfe4f5cf15df53452dc04be81929ced1efb2) )   /* bios */ \
836878   ROM_LOAD("nss-ic14.02", 0x10000, 0x8000, CRC(e06cb58f) SHA1(62f507e91a2797919a78d627af53f029c7d81477) )   /* bios */ \
837879   ROM_REGION( 0x2000, "dspprg", ROMREGION_ERASEFF) \
838   ROM_REGION( 0x800, "dspdata", ROMREGION_ERASEFF) \
839   ROM_REGION( 0x200, "eeprom", ROMREGION_ERASEFF )
880   ROM_REGION( 0x800, "dspdata", ROMREGION_ERASEFF)
840881
841882
842883
trunk/src/emu/video/m50458.c
r17491r17492
3333
3434WRITE16_MEMBER( m50458_device::vreg_120_w)
3535{
36   printf("%04x\n",data);
36//   printf("%04x\n",data);
3737}
3838
3939WRITE16_MEMBER( m50458_device::vreg_126_w)
r17491r17492
5252      int i;
5353
5454      for(i=0;i<0x120;i++)
55      {
5556         write_word(i,0);
57      }
5658   }
5759}
5860
r17491r17492
218220   UINT8 bg_r,bg_g,bg_b;
219221
220222   /* TODO: there's probably a way to control the brightness in this */
221   bg_r = m_phase & 1 ? 0xff : 0;
222   bg_g = m_phase & 2 ? 0xff : 0;
223   bg_b = m_phase & 4 ? 0xff : 0;
223   bg_r = m_phase & 1 ? 0xdf : 0;
224   bg_g = m_phase & 2 ? 0xdf : 0;
225   bg_b = m_phase & 4 ? 0xdf : 0;
224226   bitmap.fill(MAKE_ARGB(0xff,bg_r,bg_g,bg_b),cliprect);
225227
226228   for(y=0;y<12;y++)

Previous 199869 Revisions Next


© 1997-2024 The MAME Team