Previous 15994 Revisions Next

r8286 Thursday 17th June, 2010 at 10:37:51 UTC by Fabio Priuli
[NES] Added preliminary emulation of the famicom keyboard add-on
(through a new driver fami_key, to avoid having to switch between
full and partial keyboard emulation in nes & famicom)
[src/mess]messdriv.c
[src/mess/drivers]nes.c
[src/mess/includes]nes.h
[src/mess/machine]nes.c

src/mess/includes/nes.h
r8285r8286
7171
7272   /* input_related - this part has to be cleaned up (e.g. in_2 and in_3 are not really necessary here...) */
7373   nes_input in_0, in_1, in_2, in_3;
74   UINT8 fck_scan, fck_mode;
7475
7576   int           prg_bank[5];
7677   chr_bank      chr_map[8];  //quick banking structure, because some of this changes multiple times per scanline!
src/mess/messdriv.c
r8285r8286
5252   DRIVER( jaguarcd )  /* Atari Jaguar CD    */
5353
5454   /* Nintendo */
55   DRIVER( nes )      /* Nintendo Entertainment System */
56   DRIVER( nespal )   /* Nintendo Entertainment System    */
57   DRIVER( m82 )      /* Nintendo M82 Display Unit */
58   DRIVER( famicom )
59   DRIVER( famitwin )  /* Sharp Famicom Twin System    */
60   DRIVER( drpcjr )   /* Bung Doctor PC Jr    */
61   DRIVER( dendy )    /* Dendy Classic russian famiclone   */
62   DRIVER( gameboy )   /* Nintendo Game Boy Handheld      */
63   DRIVER( supergb )   /* Nintendo Super Game Boy SNES Cartridge      */
64   DRIVER( gbpocket )  /* Nintendo Game Boy Pocket Handheld    */
65   DRIVER( gblight )   /* Nintendo Game Boy Light Handheld  */
66   DRIVER( gbcolor )   /* Nintendo Game Boy Color Handheld  */
67   DRIVER( snes )      /* Nintendo Super Nintendo NTSC    */
68   DRIVER( snespal )   /* Nintendo Super Nintendo PAL    */
69   DRIVER( snessfx )   /* Nintendo Super Nintendo NTSC w/SuperFX CPU*/
70   DRIVER( snespsfx )   /* Nintendo Super Nintendo PAL w/SuperFX CPU */
71   DRIVER( snesst )   /* Nintendo Super Nintendo NTSC w/Sufami Turbo base cart */
72   DRIVER( snesbsx )   /* Nintendo Super Nintendo NTSC w/BS-X compatible cart  */
73   DRIVER( n64 )      /* Nintendo N64   */
74   DRIVER( pokemini )  /* Nintendo Pokemon Mini    */
75   DRIVER( gba )   /* Nintendo Game Boy Advance Handheld      */
55   DRIVER( nes )       /* Nintendo Entertainment System */
56   DRIVER( nespal )   /* Nintendo Entertainment System PAL */
57   DRIVER( m82 )       /* Nintendo M82 Display Unit */
58   DRIVER( famicom )   /* Nintendo Family Computer (a.k.a. Famicom) + Disk System add-on */
59   DRIVER( fami_key )  /* Nintendo Family Computer (a.k.a. Famicom) + Disk System add-on + Keyboard add-on */
60   DRIVER( famitwin )  /* Sharp Famicom Twin System */
61   DRIVER( drpcjr )    /* Bung Doctor PC Jr */
62   DRIVER( dendy )     /* Dendy (Classic russian famiclone) */
63   DRIVER( gameboy )   /* Nintendo Game Boy Handheld */
64   DRIVER( supergb )   /* Nintendo Super Game Boy SNES Cartridge */
65   DRIVER( gbpocket )  /* Nintendo Game Boy Pocket Handheld */
66   DRIVER( gblight )   /* Nintendo Game Boy Light Handheld */
67   DRIVER( gbcolor )   /* Nintendo Game Boy Color Handheld */
68   DRIVER( gba )       /* Nintendo Game Boy Advance Handheld */
69   DRIVER( snes )      /* Nintendo Super Nintendo NTSC */
70   DRIVER( snespal )   /* Nintendo Super Nintendo PAL */
71   DRIVER( snessfx )   /* Nintendo Super Nintendo NTSC w/SuperFX CPU*/
72   DRIVER( snespsfx )  /* Nintendo Super Nintendo PAL w/SuperFX CPU */
73   DRIVER( snesst )    /* Nintendo Super Nintendo NTSC w/Sufami Turbo base cart */
74   DRIVER( snesbsx )   /* Nintendo Super Nintendo NTSC w/BS-X compatible cart  */
75   DRIVER( n64 )       /* Nintendo N64   */
76   DRIVER( pokemini )  /* Nintendo Pokemon Mini */
7677
7778   DRIVER( megaduck )  /* Megaduck  */
7879
src/mess/machine/nes.c
r8285r8286
288288READ8_HANDLER( nes_IN0_r )
289289{
290290   nes_state *state = (nes_state *)space->machine->driver_data;
291   int cfg = input_port_read(space->machine, "CTRLSEL");
291292   int ret;
292293
293   /* Some games expect bit 6 to be set because the last entry on the data bus shows up */
294   /* in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there. */
295   ret = 0x40;
296
297   ret |= ((state->in_0.i0 >> state->in_0.shift) & 0x01);
298
299   /* zapper */
300   if ((input_port_read(space->machine, "CTRLSEL") & 0x000f) == 0x0002)
294   if ((cfg & 0x000f) == 0x04)   // for now we treat the FC keyboard separately from other inputs!
301295   {
302      int x = state->in_0.i1;   /* read Zapper x-position */
303      int y = state->in_0.i2;   /* read Zapper y-position */
304      UINT32 pix, color_base;
305
306      /* get the pixel at the gun position */
307      pix = ppu2c0x_get_pixel(state->ppu, x, y);
308
309      /* get the color base from the ppu */
310      color_base = ppu2c0x_get_colorbase(state->ppu);
311
312      /* look at the screen and see if the cursor is over a bright pixel */
313      if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
314         (pix == color_base + 0x33) || (pix == color_base + 0x34))
296      // here we should have the tape input
297      ret = 0;
298   }
299   else
300   {
301      /* Some games expect bit 6 to be set because the last entry on the data bus shows up */
302      /* in the unused upper 3 bits, so typically a read from $4016 leaves 0x40 there. */
303      ret = 0x40;
304     
305      ret |= ((state->in_0.i0 >> state->in_0.shift) & 0x01);
306     
307      /* zapper */
308      if ((cfg & 0x000f) == 0x0002)
315309      {
316         ret &= ~0x08; /* sprite hit */
310         int x = state->in_0.i1;   /* read Zapper x-position */
311         int y = state->in_0.i2;   /* read Zapper y-position */
312         UINT32 pix, color_base;
313         
314         /* get the pixel at the gun position */
315         pix = ppu2c0x_get_pixel(state->ppu, x, y);
316         
317         /* get the color base from the ppu */
318         color_base = ppu2c0x_get_colorbase(state->ppu);
319         
320         /* look at the screen and see if the cursor is over a bright pixel */
321         if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
322            (pix == color_base + 0x33) || (pix == color_base + 0x34))
323         {
324            ret &= ~0x08; /* sprite hit */
325         }
326         else
327            ret |= 0x08;  /* no sprite hit */
328         
329         /* If button 1 is pressed, indicate the light gun trigger is pressed */
330         ret |= ((state->in_0.i0 & 0x01) << 4);
317331      }
318      else
319         ret |= 0x08;  /* no sprite hit */
320
321      /* If button 1 is pressed, indicate the light gun trigger is pressed */
322      ret |= ((state->in_0.i0 & 0x01) << 4);
332     
333      if (LOG_JOY)
334         logerror("joy 0 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, cpu_get_pc(space->cpu), state->in_0.shift, state->in_0.i0);
335     
336      state->in_0.shift++;
323337   }
324338
325   if (LOG_JOY)
326      logerror("joy 0 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, cpu_get_pc(space->cpu), state->in_0.shift, state->in_0.i0);
327
328   state->in_0.shift++;
329339   return ret;
330340}
331341
342// row of the keyboard matrix are read 4-bits at time, and gets returned as bit1->bit4
343static UINT8 nes_read_fc_keyboard_line( running_machine *machine, UINT8 scan, UINT8 mode )
344{
345   static const char *const keyport_names[] = { "FCKEY0", "FCKEY1", "FCKEY2", "FCKEY3", "FCKEY4", "FCKEY5", "FCKEY6", "FCKEY7", "FCKEY8" };
346   return ((input_port_read(machine, keyport_names[scan]) >> (mode * 4)) & 0x0f) << 1;
347}
348
332349READ8_HANDLER( nes_IN1_r )
333350{
334351   nes_state *state = (nes_state *)space->machine->driver_data;
352   int cfg = input_port_read(space->machine, "CTRLSEL");
335353   int ret;
336354
337   /* Some games expect bit 6 to be set because the last entry on the data bus shows up */
338   /* in the unused upper 3 bits, so typically a read from $4017 leaves 0x40 there. */
339   ret = 0x40;
340
341   /* Handle data line 0's serial output */
342   ret |= ((state->in_1.i0 >> state->in_1.shift) & 0x01);
343
344   /* zapper */
345   if ((input_port_read(space->machine, "CTRLSEL") & 0x00f0) == 0x0030)
355   if ((cfg & 0x000f) == 0x04)   // for now we treat the FC keyboard separately from other inputs!
346356   {
347      int x = state->in_1.i1;   /* read Zapper x-position */
348      int y = state->in_1.i2;   /* read Zapper y-position */
349      UINT32 pix, color_base;
350
351      /* get the pixel at the gun position */
352      pix = ppu2c0x_get_pixel(state->ppu, x, y);
353
354      /* get the color base from the ppu */
355      color_base = ppu2c0x_get_colorbase(state->ppu);
356
357      /* look at the screen and see if the cursor is over a bright pixel */
358      if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
359         (pix == color_base + 0x33) || (pix == color_base + 0x34))
360      {
361         ret &= ~0x08; /* sprite hit */
362      }
357      if (state->fck_scan < 9)
358         ret = ~nes_read_fc_keyboard_line(space->machine, state->fck_scan, state->fck_mode) & 0x1e;
363359      else
364         ret |= 0x08;  /* no sprite hit */
365
366      /* If button 1 is pressed, indicate the light gun trigger is pressed */
367      ret |= ((state->in_1.i0 & 0x01) << 4);
360         ret = 0x1e;
368361   }
369
370   /* arkanoid dial */
371   else if ((input_port_read(space->machine, "CTRLSEL") & 0x00f0) == 0x0040)
362   else
372363   {
373      /* Handle data line 2's serial output */
374      ret |= ((state->in_1.i2 >> state->in_1.shift) & 0x01) << 3;
375
376      /* Handle data line 3's serial output - bits are reversed */
377      /* NPW 27-Nov-2007 - there is no third subscript! commenting out */
378      /* ret |= ((state->in_1[3] >> state->in_1.shift) & 0x01) << 4; */
379      /* ret |= ((state->in_1[3] << state->in_1.shift) & 0x80) >> 3; */
364      /* Some games expect bit 6 to be set because the last entry on the data bus shows up */
365      /* in the unused upper 3 bits, so typically a read from $4017 leaves 0x40 there. */
366      ret = 0x40;
367     
368      /* Handle data line 0's serial output */
369      ret |= ((state->in_1.i0 >> state->in_1.shift) & 0x01);
370     
371      /* zapper */
372      if ((cfg & 0x00f0) == 0x0030)
373      {
374         int x = state->in_1.i1;   /* read Zapper x-position */
375         int y = state->in_1.i2;   /* read Zapper y-position */
376         UINT32 pix, color_base;
377         
378         /* get the pixel at the gun position */
379         pix = ppu2c0x_get_pixel(state->ppu, x, y);
380         
381         /* get the color base from the ppu */
382         color_base = ppu2c0x_get_colorbase(state->ppu);
383         
384         /* look at the screen and see if the cursor is over a bright pixel */
385         if ((pix == color_base + 0x20) || (pix == color_base + 0x30) ||
386            (pix == color_base + 0x33) || (pix == color_base + 0x34))
387         {
388            ret &= ~0x08; /* sprite hit */
389         }
390         else
391            ret |= 0x08;  /* no sprite hit */
392         
393         /* If button 1 is pressed, indicate the light gun trigger is pressed */
394         ret |= ((state->in_1.i0 & 0x01) << 4);
395      }
396     
397      /* arkanoid dial */
398      else if ((cfg & 0x00f0) == 0x0040)
399      {
400         /* Handle data line 2's serial output */
401         ret |= ((state->in_1.i2 >> state->in_1.shift) & 0x01) << 3;
402         
403         /* Handle data line 3's serial output - bits are reversed */
404         /* NPW 27-Nov-2007 - there is no third subscript! commenting out */
405         /* ret |= ((state->in_1[3] >> state->in_1.shift) & 0x01) << 4; */
406         /* ret |= ((state->in_1[3] << state->in_1.shift) & 0x80) >> 3; */
407      }
408     
409      if (LOG_JOY)
410         logerror("joy 1 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, cpu_get_pc(space->cpu), state->in_1.shift, state->in_1.i0);
411     
412      state->in_1.shift++;
380413   }
381414
382   if (LOG_JOY)
383      logerror("joy 1 read, val: %02x, pc: %04x, bits read: %d, chan0: %08x\n", ret, cpu_get_pc(space->cpu), state->in_1.shift, state->in_1.i0);
384
385   state->in_1.shift++;
386415   return ret;
387416}
388417
r8285r8286
457486WRITE8_HANDLER( nes_IN0_w )
458487{
459488   nes_state *state = (nes_state *)space->machine->driver_data;
460   int cfg;
489   int cfg = input_port_read(space->machine, "CTRLSEL");
461490
462   if (data & 0x01)
463      return;
464
465   if (LOG_JOY)
466      logerror("joy 0 bits read: %d\n", state->in_0.shift);
467
468   /* Toggling bit 0 high then low resets both controllers */
469   state->in_0.shift = 0;
470   state->in_1.shift = 0;
471
472491   /* Check if lightgun has been chosen as input: if so, enable crosshair */
473492   timer_set(space->machine, attotime_zero, NULL, 0, lightgun_tick);
493   
494   if ((cfg & 0x000f) == 0x04)   // for now we treat the FC keyboard separately from other inputs!
495   {
496      // here we should also have the tape output
474497
475   /* Check the configuration to see what's connected */
476   cfg = input_port_read(space->machine, "CTRLSEL");
477
478   /* Read the input devices */
479   nes_read_input_device(space->machine, cfg >>  0, &state->in_0, 0,  TRUE, -1);
480   nes_read_input_device(space->machine, cfg >>  4, &state->in_1, 1,  TRUE,  1);
481   nes_read_input_device(space->machine, cfg >>  8, &state->in_2, 2, FALSE, -1);
482   nes_read_input_device(space->machine, cfg >> 12, &state->in_3, 3, FALSE, -1);
483
484   if (cfg & 0x0f00)
485      state->in_0.i0 |= (state->in_2.i0 << 8) | (0x08 << 16);
486
487   if (cfg & 0xf000)
488      state->in_1.i0 |= (state->in_3.i0 << 8) | (0x04 << 16);
498      if (BIT(data, 2))   // keyboard active
499      {
500         UINT8 out = BIT(data, 1);   // scan
501         
502         if (state->fck_mode && !out && ++state->fck_scan > 9)
503            state->fck_scan = 0;
504         
505         state->fck_mode = out;   // access lower or upper 4 bits
506         
507         if (BIT(data, 0))   // reset
508            state->fck_scan = 0;
509      }
510   }
511   else
512   {
513      if (data & 0x01)
514         return;
515     
516      if (LOG_JOY)
517         logerror("joy 0 bits read: %d\n", state->in_0.shift);
518     
519      /* Toggling bit 0 high then low resets both controllers */
520      state->in_0.shift = 0;
521      state->in_1.shift = 0;
522     
523      /* Read the input devices */
524      nes_read_input_device(space->machine, cfg >>  0, &state->in_0, 0,  TRUE, -1);
525      nes_read_input_device(space->machine, cfg >>  4, &state->in_1, 1,  TRUE,  1);
526      nes_read_input_device(space->machine, cfg >>  8, &state->in_2, 2, FALSE, -1);
527      nes_read_input_device(space->machine, cfg >> 12, &state->in_3, 3, FALSE, -1);
528     
529      if (cfg & 0x0f00)
530         state->in_0.i0 |= (state->in_2.i0 << 8) | (0x08 << 16);
531     
532      if (cfg & 0xf000)
533         state->in_1.i0 |= (state->in_3.i0 << 8) | (0x04 << 16);
534   }
489535}
490536
491537
src/mess/drivers/nes.c
r8285r8286
150150   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3) PORT_NAME("Change Disk Side")
151151INPUT_PORTS_END
152152
153static INPUT_PORTS_START( fc_keyboard )
154   PORT_START("FCKEY0")
155   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F8) PORT_CHAR(UCHAR_MAMEKEY(F8))
156   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_ENTER) PORT_CHAR(13)
157   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_CLOSEBRACE)   PORT_CHAR('[')
158   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH)   PORT_CHAR(']')
159   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Kana")
160   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RSHIFT)
161   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_BACKSLASH2)   PORT_CHAR('\\')
162   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Stop") PORT_CODE(KEYCODE_BACKSPACE)
163
164   PORT_START("FCKEY1")
165   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F7) PORT_CHAR(UCHAR_MAMEKEY(F7))
166   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_OPENBRACE)   PORT_CHAR('@')
167   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COLON)   PORT_CHAR(':')
168   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_QUOTE)   PORT_CHAR(';')
169   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('_')
170   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CHAR('/')
171   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_MINUS)   PORT_CHAR('-')
172   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_EQUALS)   PORT_CHAR('^')
173
174   PORT_START("FCKEY2")
175   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F6) PORT_CHAR(UCHAR_MAMEKEY(F6))
176   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_O)   PORT_CHAR('O')
177   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_L)   PORT_CHAR('L')
178   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_K)   PORT_CHAR('K')
179   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_STOP)   PORT_CHAR('.')
180   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_COMMA)   PORT_CHAR(',')
181   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_P)   PORT_CHAR('P')
182   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_0)   PORT_CHAR('0')
183
184   PORT_START("FCKEY3")
185   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F5) PORT_CHAR(UCHAR_MAMEKEY(F5))
186   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_I)   PORT_CHAR('I')
187   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_U)   PORT_CHAR('U')
188   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_J)   PORT_CHAR('J')
189   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_M)   PORT_CHAR('M')
190   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_N)   PORT_CHAR('N')
191   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_9)   PORT_CHAR('9')
192   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_8)   PORT_CHAR('8')
193
194   PORT_START("FCKEY4")
195   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F4) PORT_CHAR(UCHAR_MAMEKEY(F4))
196   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Y)   PORT_CHAR('Y')
197   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_G)   PORT_CHAR('G')
198   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_H)   PORT_CHAR('H')
199   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_B)   PORT_CHAR('B')
200   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_V)   PORT_CHAR('V')
201   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_7)   PORT_CHAR('7')
202   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_6)   PORT_CHAR('6')
203
204   PORT_START("FCKEY5")
205   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F3) PORT_CHAR(UCHAR_MAMEKEY(F3))
206   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_T)   PORT_CHAR('T')
207   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_R)   PORT_CHAR('R')
208   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_D)   PORT_CHAR('D')
209   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F)   PORT_CHAR('F')
210   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_C)   PORT_CHAR('C')
211   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_5)   PORT_CHAR('5')
212   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_4)   PORT_CHAR('4')
213
214   PORT_START("FCKEY6")
215   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F2) PORT_CHAR(UCHAR_MAMEKEY(F2))
216   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_W)   PORT_CHAR('W')
217   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_S)   PORT_CHAR('S')
218   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_A)   PORT_CHAR('A')
219   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_X)   PORT_CHAR('X')
220   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Z)   PORT_CHAR('Z')
221   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_E)   PORT_CHAR('E')
222   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_3)   PORT_CHAR('3')
223
224   PORT_START("FCKEY7")
225   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_F1) PORT_CHAR(UCHAR_MAMEKEY(F1))
226   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_TAB) PORT_CHAR(UCHAR_MAMEKEY(ESC))
227   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_Q)   PORT_CHAR('Q')
228   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LCONTROL)      PORT_CHAR(UCHAR_SHIFT_2)
229   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LSHIFT)      PORT_CHAR(UCHAR_SHIFT_1)
230   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Grph") PORT_CODE(KEYCODE_LALT)
231   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_1)   PORT_CHAR('1')
232   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_2)   PORT_CHAR('2')
233
234   PORT_START("FCKEY8")
235   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Clr")
236   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_UP)   PORT_CHAR(UCHAR_MAMEKEY(UP))
237   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_RIGHT) PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
238   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_LEFT) PORT_CHAR(UCHAR_MAMEKEY(LEFT))
239   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_DOWN) PORT_CHAR(UCHAR_MAMEKEY(DOWN))
240   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_CODE(KEYCODE_SPACE)      PORT_CHAR(' ')
241   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Del") PORT_CODE(KEYCODE_DEL)
242   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD) PORT_NAME("Ins") PORT_CODE(KEYCODE_INSERT)
243
244INPUT_PORTS_END
245
246static INPUT_PORTS_START( famikey )
247   PORT_INCLUDE( famicom )
248   PORT_INCLUDE( fc_keyboard )
249
250   PORT_MODIFY("CTRLSEL")  /* Select Controller Type */
251   PORT_CATEGORY_CLASS( 0x000f, 0x0004, "P1 Controller")
252   PORT_CATEGORY_ITEM(  0x0000, "Unconnected",      0 )
253   PORT_CATEGORY_ITEM(  0x0001, "Gamepad",         1 )
254   PORT_CATEGORY_ITEM(  0x0002, "Zapper",         5 )
255   PORT_CATEGORY_ITEM(  0x0004, "FC Keyboard",      8 )
256   PORT_CATEGORY_CLASS( 0x00f0, 0x0010, "P2 Controller")
257   PORT_CATEGORY_ITEM(  0x0000, "Unconnected",      0 )
258   PORT_CATEGORY_ITEM(  0x0010, "Gamepad",         2 )
259   PORT_CATEGORY_ITEM(  0x0030, "Zapper",         6 )
260   PORT_CATEGORY_ITEM(  0x0040, "Arkanoid paddle",   7 )
261   PORT_CATEGORY_CLASS( 0x0f00, 0x0000, "P3 Controller")
262   PORT_CATEGORY_ITEM(  0x0000, "Unconnected",      0 )
263   PORT_CATEGORY_ITEM(  0x0100, "Gamepad",         3 )
264   PORT_CATEGORY_CLASS( 0xf000, 0x0000, "P4 Controller")
265   PORT_CATEGORY_ITEM(  0x0000, "Unconnected",      0 )
266   PORT_CATEGORY_ITEM(  0x1000, "Gamepad",         4 )
267INPUT_PORTS_END
268
153269#ifdef UNUSED_FUNCTION
154270/* This layout is not changed at runtime */
155271gfx_layout nes_vram_charlayout =
r8285r8286
234350   MDRV_CARTSLOT_ADD("cart")
235351   MDRV_CARTSLOT_EXTENSION_LIST("nes,unf")
236352   MDRV_CARTSLOT_MANDATORY
237//  MDRV_CARTSLOT_INTERFACE("nes_cart")
353   MDRV_CARTSLOT_INTERFACE("nes_cart")
238354   MDRV_CARTSLOT_LOAD(nes_cart)
239355   MDRV_CARTSLOT_PARTIALHASH(nes_partialhash)
240//  MDRV_SOFTWARE_LIST_ADD("nes")
356   MDRV_SOFTWARE_LIST_ADD("nes")
241357MACHINE_DRIVER_END
242358
243359static MACHINE_DRIVER_START( nespal )
r8285r8286
319435   ROM_REGION( 0x800,   "gfx3", ROMREGION_ERASE00 )  /* CI RAM */
320436ROM_END
321437
438#define rom_fami_key rom_famicom
439
322440ROM_START( famitwin )
323441   ROM_REGION( 0x10000, "maincpu", 0 )  /* Main RAM + program banks */
324442   ROM_LOAD_OPTIONAL( "disksyst.rom", 0xe000, 0x2000, CRC(4df24a6c) SHA1(e4e41472c454f928e53eb10e0509bf7d1146ecc1) )
r8285r8286
367485***************************************************************************/
368486
369487/*     YEAR  NAME      PARENT  COMPAT MACHINE   INPUT    INIT    COMPANY       FULLNAME */
370CONS( 1985, nes,       0,      0,     nes,      nes,     0,      "Nintendo",  "Nintendo Entertainment System / Famicom (NTSC)", GAME_IMPERFECT_GRAPHICS )
371CONS( 1987, nespal,    nes,    0,     nespal,   nes,     0,      "Nintendo",  "Nintendo Entertainment System (PAL)", GAME_IMPERFECT_GRAPHICS )
372CONS( 1983, famicom,   nes,    0,     famicom,  famicom, famicom,"Nintendo",  "Famicom Disk System", GAME_IMPERFECT_GRAPHICS )
373CONS( 1986, famitwin,  nes,    0,     famicom,  famicom, famicom,"Sharp",     "Famicom Twin", GAME_IMPERFECT_GRAPHICS )
374CONS( 198?, m82,       nes,    0,     nes,      nes,     0,      "Nintendo",  "M82 Display Unit", GAME_IMPERFECT_GRAPHICS )
375CONS( 1996, drpcjr,    nes,    0,     famicom,  famicom, famicom,"Bung",      "Doctor PC Jr", GAME_IMPERFECT_GRAPHICS )
376CONS( 1992, dendy,     nes,    0,     dendy,    nes,     0,      "Steepler",  "Dendy Classic", GAME_IMPERFECT_GRAPHICS )
488CONS( 1985, nes,       0,      0,     nes,      nes,     0,       "Nintendo",  "Nintendo Entertainment System / Famicom (NTSC)", GAME_IMPERFECT_GRAPHICS )
489CONS( 1987, nespal,    nes,    0,     nespal,   nes,     0,       "Nintendo",  "Nintendo Entertainment System (PAL)", GAME_IMPERFECT_GRAPHICS )
490CONS( 1983, famicom,   nes,    0,     famicom,  famicom, famicom, "Nintendo",  "Famicom (w/ Disk System add-on)", GAME_IMPERFECT_GRAPHICS )
491CONS( 1983, fami_key,  nes,    0,     famicom,  famikey, famicom, "Nintendo",  "Famicom (w/ Disk System add-on + Keyboard add-on)", GAME_IMPERFECT_GRAPHICS )
492CONS( 1986, famitwin,  nes,    0,     famicom,  famicom, famicom, "Sharp",     "Famicom Twin", GAME_IMPERFECT_GRAPHICS )
493CONS( 198?, m82,       nes,    0,     nes,      nes,     0,       "Nintendo",  "M82 Display Unit", GAME_IMPERFECT_GRAPHICS )
494CONS( 1996, drpcjr,    nes,    0,     famicom,  famicom, famicom, "Bung",      "Doctor PC Jr", GAME_IMPERFECT_GRAPHICS )
495CONS( 1992, dendy,     nes,    0,     dendy,    nes,     0,       "Steepler",  "Dendy Classic", GAME_IMPERFECT_GRAPHICS )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team