Previous 199869 Revisions Next

r17564 Wednesday 29th August, 2012 at 18:24:02 UTC by Angelo Salese
Basic emulation of the Z180 in Super Famicom Box HW [Angelo Salese, nocash]
[src/emu/video]mb90092.c
[src/mame/drivers]nss.c sfcbox.c
[src/mame/machine]snes.c

trunk/src/mame/machine/snes.c
r17563r17564
15721572      state->m_joy_flag = 0;
15731573}
15741574
1575/*
1576      if(state->m_is_nss)
1577         state->m_joy_flag = 0;
15781575
1579*/
15801576
15811577static UINT8 nss_oldjoy1_read( running_machine &machine )
15821578{
trunk/src/mame/drivers/sfcbox.c
r17563r17564
1212
1313The "To Do" list:
1414-----------------
15-Main CPU banks cartridges via ports $c0/$c1
1516-Consider moving the 3 cartridges of the slot 2 in a sotwware list since they are interchangable
1617-Hook the z180 clone, the DSP 1A/1B and the Super FX
1718-Add the missing GROM4-1
r17563r17564
117118#include "cpu/spc700/spc700.h"
118119#include "cpu/g65816/g65816.h"
119120#include "cpu/z180/z180.h"
121#include "machine/s3520cf.h"
120122#include "video/mb90092.h"
121123#include "includes/snes.h"
122124#include "audio/snes_snd.h"
r17563r17564
128130   sfcbox_state(const machine_config &mconfig, device_type type, const char *tag)
129131      : snes_state(mconfig, type, tag),
130132      m_bios(*this, "bios"),
131      m_mb90092(*this,"mb90092")
133      m_mb90092(*this,"mb90092"),
134      m_s3520cf(*this, "s3520cf")
132135      { }
133136
134   required_device <cpu_device> m_bios;
135   required_device <mb90092_device> m_mb90092;
137   required_device<cpu_device> m_bios;
138   required_device<mb90092_device> m_mb90092;
139   required_device<s3520cf_device> m_s3520cf;
136140
137141   UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
138142
143   DECLARE_READ8_MEMBER( port_81_r );
144   DECLARE_READ8_MEMBER( port_83_r );
145   DECLARE_WRITE8_MEMBER( port_80_w );
139146   DECLARE_WRITE8_MEMBER( port_81_w );
147   DECLARE_WRITE8_MEMBER( port_83_w );
148   DECLARE_WRITE8_MEMBER( snes_map_0_w );
149   DECLARE_WRITE8_MEMBER( snes_map_1_w );
140150};
141151
142152UINT32 sfcbox_state::screen_update( screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect )
r17563r17564
177187static ADDRESS_MAP_START( sfcbox_map, AS_PROGRAM, 8, sfcbox_state )
178188   AM_RANGE(0x00000, 0x0ffff) AM_ROM AM_REGION("krom", 0)
179189   AM_RANGE(0x20000, 0x27fff) AM_RAM
180   AM_RANGE(0x40000, 0x47fff) AM_ROM AM_REGION("grom", 0)
181   AM_RANGE(0x60000, 0x67fff) AM_NOP // grom slot 1
190   AM_RANGE(0x40000, 0x47fff) AM_ROM AM_REGION("grom1", 0)
191   AM_RANGE(0x60000, 0x67fff) AM_ROM AM_REGION("grom2", 0)
182192ADDRESS_MAP_END
183193
194
195WRITE8_MEMBER( sfcbox_state::port_80_w )
196{
197/*
198   x--- ----   (often same as bit5)
199   -x-- ----   Unknown/unused
200   --x- ----     ??         PLENTY used (often same as bit7)
201   ---x ----   ?? pulsed while [C094] is nonzero (0370h timer0 steps)
202   ---- x---   Unknown/unused
203   ---- -x--   SNES Transfer DATA to SNES  (Bit1 of WRIO/RDIO on SNES side)
204   ---- --x-   SNES Transfer CLOCK to SNES (Bit5 of WRIO/RDIO on SNES side)
205   ---- ---x   SNES Transfer STAT to SNES  (Bit2 of WRIO/RDIO on SNES side)
206*/
207   snes_ram[WRIO] = ((data & 4) >> 1) | (snes_ram[WRIO] & ~0x02); // DATA
208   snes_ram[WRIO] = ((data & 2) << 4) | (snes_ram[WRIO] & ~0x20); // CLOCK
209   snes_ram[WRIO] = ((data & 1) << 2) | (snes_ram[WRIO] & ~0x04); // STAT
210}
211
212
213READ8_MEMBER( sfcbox_state::port_81_r )
214{
215/*
216   x--- ----   Vblank, Vsync, or Whatever flag (must toggle on/off at whatever speed)
217   -x-- ----   Int1 Request (Joypad is/was accessed by SNES or so?) (0=IRQ, 1=No)
218   --x- ----   Unknown/unused  ;/(for "joy2/slot1" or so, use [A0].4-5)
219   ---x ----   Unknown/unused  ;\joy1/slot0 or so, used by an UNUSED function (08A0h)
220   ---- x---   Boot mode or so (maybe a jumper, or watchdog-flag, or Bit0 of WRIO/RDIO?)
221   ---- -x--   SNES Transfer DATA from SNES (Bit4 of WRIO/RDIO on SNES side)
222   ---- --x-   SNES Transfer ACK from SNES  (Bit3 of WRIO/RDIO on SNES side)
223   ---- ---x   Int0 Request (Coin-Input, Low for 44ms..80ms) (0=IRQ, 1=No)
224*/
225   UINT8 res;
226
227   res = (machine().primary_screen->vblank() & 1) << 7;
228   res = 1 << 6;
229   res = 0 << 5;
230   res = 0 << 4;
231   res = 0 << 3;
232   res |= ((snes_ram[WRIO] & 0x10) >> 4) << 2; // DATA to main
233   res |= ((snes_ram[WRIO] & 0x08) >> 3) << 1; // ACK to main
234   res = 1 << 0;
235
236   return res;
237}
238
184239WRITE8_MEMBER( sfcbox_state::port_81_w )
185240{
186241   device_set_input_line(m_maincpu, INPUT_LINE_RESET, (data & 1) ? CLEAR_LINE : ASSERT_LINE);
r17563r17564
189244   ioport("OSD_CS")->write(data, 0xff);
190245}
191246
247READ8_MEMBER( sfcbox_state::port_83_r )
248{
249   return 0xff;
250}
251
252WRITE8_MEMBER( sfcbox_state::port_83_w )
253{
254
255}
256
257WRITE8_MEMBER( sfcbox_state::snes_map_0_w )
258{
259   const char *const rom_socket[4] = {   "ROM5", "ROM1/7/12", "ROM3/9", "IC23" };
260
261   printf("%s ROM Socket\n",rom_socket[data & 3]);
262   printf("%02x ROM Slot\n",(data & 4) >> 2);
263   printf("%02x SRAM Enable\n",(data & 8) >> 3);
264   printf("%02x SRAM Slot\n",(data & 0x10) >> 4);
265   printf("%02x DSP Enable\n",(data & 0x20) >> 5);
266   printf("%02x DSP Slot\n",(data & 0x40) >> 6);
267   printf("%s ROM / DSP / SRAM maps\n",(data & 0x80) ? "HiROM" : "LoROM");
268}
269
270WRITE8_MEMBER( sfcbox_state::snes_map_1_w )
271{
272   /* Reserved for ROM DSP SRAM probably means bank ATROM */
273   const char *const rom_dsp_sram[4] = {   "Reserved?", "GSU", "LoROM", "HiROM" };
274   const char *const sram_size[4] = {   "2K", "8K", "Reserved?", "32K" };
275
276   printf("%s ROM / DSP SRAM map 2\n",rom_dsp_sram[data & 3]);
277   printf("%08x SRAM base\n",((data & 0xc) >> 2)*0x8000);
278   printf("%02x GSU Slot\n",((data & 0x10) >> 4));
279   printf("%s SRAM Size\n",sram_size[((data & 0xc0) >> 6)]);
280}
281
192282static ADDRESS_MAP_START( sfcbox_io, AS_IO, 8, sfcbox_state )
193283   AM_RANGE(0x0b, 0x0b) AM_DEVWRITE("mb90092",mb90092_device,write)
194284   AM_RANGE(0x00, 0x3f) AM_RAM // internal i/o
195//   AM_RANGE(0x80, 0x80) // Keyswitch and Button Inputs / SNES Transfer and Misc Output
196   AM_RANGE(0x81, 0x81) AM_WRITE(port_81_w) // SNES Transfer and Misc Input / Misc Output
285   AM_RANGE(0x80, 0x80) AM_READ_PORT("KEY") AM_WRITE(port_80_w) // Keyswitch and Button Inputs / SNES Transfer and Misc Output
286   AM_RANGE(0x81, 0x81) AM_READWRITE(port_81_r,port_81_w) // SNES Transfer and Misc Input / Misc Output
197287//   AM_RANGE(0x82, 0x82) // Unknown/unused
198//   AM_RANGE(0x83, 0x83) // Joypad Input/Status / Joypad Output/Control
288   AM_RANGE(0x83, 0x83) AM_READWRITE(port_83_r,port_83_w) // Joypad Input/Status / Joypad Output/Control
199289//   AM_RANGE(0x84, 0x84) // Joypad 1, MSB (1st 8 bits) (eg. Bit7=ButtonB, 0=Low=Pressed)
200290//    AM_RANGE(0x85, 0x85) // Joypad 1, LSB (2nd 8 bits) (eg. Bit0=LSB of ID, 0=Low=One)
201291//   AM_RANGE(0x86, 0x86) // Joypad 2, MSB (1st 8 bits) (eg. Bit7=ButtonB, 0=Low=Pressed)
202292//  AM_RANGE(0x87, 0x87) // Joypad 2, LSB (2nd 8 bits) (eg. Bit0=LSB of ID, 0=Low=One)
203//   AM_RANGE(0xa0, 0xa0) //  Real Time Clock
204//   AM_RANGE(0xc0, 0xc0) // SNES Mapping Register 0
205//  AM_RANGE(0xc1, 0xc1) // SNES Mapping Register 1
293   AM_RANGE(0xa0, 0xa0) AM_READ_PORT("RTC_R") AM_WRITE_PORT("RTC_W") //  Real Time Clock
294   AM_RANGE(0xc0, 0xc0) AM_WRITE(snes_map_0_w) // SNES Mapping Register 0
295   AM_RANGE(0xc1, 0xc1) AM_WRITE(snes_map_1_w) // SNES Mapping Register 1
206296ADDRESS_MAP_END
207297
208298
209299static INPUT_PORTS_START( snes )
300   PORT_START("RTC_R")
301   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, read_bit)
302
303   PORT_START("RTC_W")
304   PORT_BIT( 0x08, IP_ACTIVE_LOW,  IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, set_clock_line)
305   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, write_bit)
306   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, set_dir_line)
307   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("s3520cf", s3520cf_device, set_cs_line)
308
309   /* TODO: verify these */
310   PORT_START("KEY")
311   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON14 ) PORT_NAME("Reset Button")
312   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON13 ) PORT_NAME("TV/GAME Button")
313   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON12 ) PORT_NAME("Relay Off Button")
314   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON7 )  PORT_NAME("Options Button")
315   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON11 ) PORT_NAME("Self-Test Button")
316   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON10 ) PORT_NAME("Play Mode 3 Button")
317   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON9 )  PORT_NAME("Play Mode 2 Button")
318   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON8 )  PORT_NAME("Play Mode 1 Button")
319
210320   PORT_START("OSD_CS")
211321   PORT_BIT( 0x80, IP_ACTIVE_LOW,  IPT_OUTPUT ) PORT_WRITE_LINE_DEVICE_MEMBER("mb90092", mb90092_device, set_cs_line)
212322
r17563r17564
333443   MCFG_CPU_ADD("soundcpu", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
334444   MCFG_CPU_PROGRAM_MAP(spc_mem)
335445
336   MCFG_QUANTUM_TIME(attotime::from_hz(24000))
446   MCFG_QUANTUM_PERFECT_CPU("maincpu")
337447
338448   MCFG_MACHINE_START( snes )
339449   MCFG_MACHINE_RESET( snes )
r17563r17564
380490   MCFG_CPU_IO_MAP(sfcbox_io)
381491
382492   MCFG_MB90092_ADD("mb90092",XTAL_12MHz / 2) /* TODO: correct clock */
493   MCFG_S3520CF_ADD("s3520cf") /* RTC */
383494
384495   MCFG_MACHINE_START( sfcbox )
385496   MCFG_MACHINE_RESET( sfcbox )
r17563r17564
416527ROM_START( sfcbox )
417528   SFCBOX_BIOS
418529
419   ROM_REGION( 0x8000, "grom", ROMREGION_ERASEFF )
530   ROM_REGION( 0x8000, "grom1", ROMREGION_ERASEFF )
531
532   ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF )
420533ROM_END
421534
422535ROM_START( pss61 )
423536   SFCBOX_BIOS
424537
425   ROM_REGION( 0x8000, "grom", 0 )
538   ROM_REGION( 0x8000, "grom1", 0 )
426539   ROM_LOAD( "grom1-1.ic1", 0x0000, 0x8000, CRC(333bf9a7) SHA1(5d0cd9ca29e5580c3eebe9f136839987c879f979) )
427540
541   ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF )
542
428543   ROM_REGION( 0x380000, "game", 0 )
429544   ROM_LOAD( "shvc-mk-0.rom6", 0x000000, 0x080000, CRC(c8002453) SHA1(cbb853bf911255c1d8eb27cd34fc7855a0dda218) )
430545   ROM_LOAD( "shvc-4m-1.rom3", 0x080000, 0x200000, CRC(91b28d56) SHA1(b83dd73d3d6049450bb8092d73c3af879804f58c) )
431   ROM_LOAD( "shvc-fo-1.ic20", 0x280000, 0x100000, CRC(ad668a41) SHA1(39ff7354a7fa02295c899b7a7ec3556998ac2636) ) /* Super FX hook needed for Star Fox */
546   ROM_LOAD( "shvc-fo-1.ic20", 0x280000, 0x100000, CRC(ad668a41) SHA1(39ff7354a7fa02295c899b7a7ec3556998ac2636) ) /* TODO: Super FX hook needed for Star Fox */
432547ROM_END
433548
434549ROM_START( pss62 )
435550   SFCBOX_BIOS
436551
437   ROM_REGION( 0x8000, "grom", 0 )
552   ROM_REGION( 0x8000, "grom1", 0 )
438553   ROM_LOAD( "grom2-1.ic1", 0x0000, 0x8000, CRC(bcfc5642) SHA1(a96e52685bd3dcdf09d1b7acd6e1c1ab7726a640) )
439554
555   ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF )
556
440557   ROM_REGION( 0x180000, "game", 0 )
441558   ROM_LOAD( "shvc-gc-0.rom1", 0x000000, 0x100000, CRC(b4fd7aff) SHA1(eb553b77418dedba25fc4d5dddcb04f424b0f6a9) )
442559   ROM_LOAD( "shvc-2a-1.rom3", 0x100000, 0x080000, CRC(6b23e2e4) SHA1(684123a12ca1e31115bd6221d96f82461066877f) )
r17563r17564
445562ROM_START( pss63 )
446563   SFCBOX_BIOS
447564
448   ROM_REGION( 0x8000, "grom", 0 )
565   ROM_REGION( 0x8000, "grom1", 0 )
449566   ROM_LOAD( "grom3-1.ic1", 0x0000, 0x8000, CRC(ebec4c1c) SHA1(d638ef1486b4c0b3d4d5b666929ca7947e16efad) )
450567
568   ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF )
569
451570   ROM_REGION( 0x500000, "game", 0 )
452571   ROM_LOAD( "shvc-t2-1.rom3", 0x000000, 0x100000, CRC(4ae93c10) SHA1(5fa25d027940907b769578d7bf85a9d5ba94911a) )
453572   ROM_LOAD( "shvc-8x-1.rom1", 0x100000, 0x400000, CRC(3adef543) SHA1(df02860e691fbee453e345dd343c08b6da08d4ea) )
r17563r17564
456575ROM_START( pss64 )
457576   SFCBOX_BIOS
458577
459   ROM_REGION( 0x8000, "grom", 0 )
578   ROM_REGION( 0x8000, "grom1", ROMREGION_ERASEFF )
460579   ROM_LOAD( "grom4-1.ic1", 0x0000, 0x8000, NO_DUMP )
461580
581   ROM_REGION( 0x8000, "grom2", ROMREGION_ERASEFF )
582
462583   ROM_REGION( 0x500000, "game", 0 )
463584   ROM_LOAD( "shvc-m4-0.rom3", 0x000000, 0x100000, CRC(fb259f4f) SHA1(8faeb56f80e82dd042bdc84d19c526a979c6de8f) )
464585   ROM_LOAD( "shvc-8x-1.rom1", 0x100000, 0x400000, CRC(3adef543) SHA1(df02860e691fbee453e345dd343c08b6da08d4ea) )
trunk/src/mame/drivers/nss.c
r17563r17564
802802   MCFG_CPU_ADD("soundcpu", SPC700, 2048000/2)   /* 2.048 Mhz, but internal divider */
803803   MCFG_CPU_PROGRAM_MAP(spc_mem)
804804
805//  MCFG_QUANTUM_TIME(attotime::from_hz(24000))
806805   MCFG_QUANTUM_PERFECT_CPU("maincpu")
807806
808807   MCFG_MACHINE_START( snes )
trunk/src/emu/video/mb90092.c
r17563r17564
155155         switch(m_cmd)
156156         {
157157            case 0x80: // Preset VRAM address
158               m_osd_addr = dat;
159               //printf("%04x %d %d\n",m_osd_addr,(m_osd_addr & 0x1f),(m_osd_addr & 0x1e0) >> 5);
158               m_osd_addr = dat & 0x1ff;
159               //m_vsl = (dat & 0x200) >> 9);
160160               break;
161            case 0x88: //
162               break;
161163            case 0x90: // Write Character
162164               int x,y;
163               x = (m_osd_addr & 0x1f);
165               x = (m_osd_addr & 0x01f);
164166               y = (m_osd_addr & 0x1e0) >> 5;
165167               //printf("%d %d\n",x,y);
166168               write_word(x+y*24,dat);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team