Previous 15994 Revisions Next

r10067 Monday 17th January, 2011 at 02:46:18 UTC by Angelo Salese
[PC-8801]: Added high RAM support amongst other things
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10066r10067
1414   - joystick / mouse support;
1515   - cursor is 8 x 10, not 8 x 8 as current implementation.
1616   - text DMAC stuff isn't well documented;
17   - CRTC really looks like to be a MCU;
18   - needs to support V1 / V2 properly;
1719
1820   per-game specific TODO:
1921   - 100 Yen disk(s): reads kanji ports;
2022   - Acro Jet: hangs waiting for an irq;
2123   - Adrenalin Connection: seems to have an unemulated screen mode;
22   - Again: hangs waiting for something;
23   - Agress: crashes after that it shows the title screen;
24   - Aggress: crashes after that it shows the title screen;
25   - American Success: uses some ALU characteristics, might be a good test case;
26   - American Success: reads the light pen?
27   - Alphos: test case for text VRAM attributes;
28   - Alphos: text VRAM garbage during gameplay;
29   - Alphos: background is supposed to be blue?
2430   - Xevious: game is too fast
2531
2632   Notes:
r10066r10067
128134static UINT8 i8214_irq_level,i8214_irq_state;
129135static UINT16 dma_counter[4],dma_address[4];
130136static UINT8 dmac_mode;
137static UINT8 alu_ctrl1,alu_ctrl2;
131138
132139static void pc8801_update_irq(running_machine *machine)
133140{
r10066r10067
171178
172179static struct
173180{
174   UINT8 cmd,param_count,cursor_on;
181   UINT8 cmd,param_count,cursor_on,status,irq_mask;
175182   UINT8 param[8][5];
176183}crtc;
177184
r10066r10067
241248      }
242249   }
243250
244   if(!(layer_mask & 1) && dmac_mode & 4)
251   if(!(layer_mask & 1) && dmac_mode & 4 && crtc.status & 0x10 && crtc.irq_mask == 3)
245252   {
246253      for(y=0;y<25;y++)
247254      {
r10066r10067
405412   return WRAM_BASE + (window_offset_bank << 8);
406413}
407414
408/* TODO: this isn't correct */
409415static UINT32 pc8801_bankswitch_3_r(running_machine *machine)
410416{
411417   if(vram_sel == 3)
412418      return WRAM_BASE + 0xc000;
413419
420   if(misc_ctrl & 0x40)
421   {
422      vram_sel = 3;
423      if(alu_ctrl2 & 0x80)
424         return 0xc0000; // TODO: ALU hook-up
425   }
426
414427   return GRAM_BASE + 0x4000 * vram_sel;
415428}
416429
r10066r10067
419432   if(vram_sel == 3)
420433      return WRAM_BASE + 0xc000;
421434
435   if(misc_ctrl & 0x40)
436   {
437      vram_sel = 3;
438      if(alu_ctrl2 & 0x80)
439         return 0xc0000; // TODO: ALU hook-up
440   }
441
422442   return GRAM_BASE + 0x4000 * vram_sel;
423443}
424444
425445static UINT32 pc8801_bankswitch_4_r(running_machine *machine)
426446{
427447   if(vram_sel == 3)
428      return WRAM_BASE + 0xf000;
448   {
449      if(misc_ctrl & 0x10) // high VRAM
450         return WRAM_BASE + 0xf000;
429451
452      return WRAM_BASE + 0xf000 + 0x10000;
453   }
454
455   if(misc_ctrl & 0x40)
456   {
457      vram_sel = 3;
458      if(alu_ctrl2 & 0x80)
459         return 0xc0000; // TODO: ALU hook-up
460   }
461
430462   return GRAM_BASE + 0x3000 + (0x4000 * vram_sel);
431463}
432464
433465static UINT32 pc8801_bankswitch_4_w(running_machine *machine)
434466{
435467   if(vram_sel == 3)
436      return WRAM_BASE + 0xf000;
468   {
469      if(misc_ctrl & 0x10) // high VRAM
470         return WRAM_BASE + 0xf000;
437471
472      return WRAM_BASE + 0xf000 + 0x10000;
473   }
474
475   if(misc_ctrl & 0x40)
476   {
477      vram_sel = 3;
478      if(alu_ctrl2 & 0x80)
479         return 0xc0000; // TODO: ALU hook-up
480   }
481
438482   return GRAM_BASE + 0x3000 + (0x4000 * vram_sel);
439483}
440484
r10066r10067
585629   misc_ctrl = data;
586630
587631   sound_irq_mask = ((data & 0x80) == 0);
632
633   if(data & 0x40)
634      printf("Extra VRAM triggered\n");
588635}
589636
590637static WRITE8_HANDLER( pc8801_palram_w )
r10066r10067
623670
624671static READ8_HANDLER( pc8801_crtc_status_r )
625672{
626   return 0xff;
673   /*
674   ---x ---- video enable
675   ---- x--- DMA is running
676   ---- -x-- special control character IRQ
677   ---- --x- indication end IRQ
678   ---- ---x light pen input
679   */
680
681   return crtc.status;
627682}
628683
629684static const char *const crtc_command[] =
r10066r10067
643698   crtc.cmd = (data & 0xe0) >> 5;
644699   crtc.param_count = 0;
645700
646   if(crtc.cmd == 4) // load cursor position ON/OFF
647      crtc.cursor_on = data & 1;
701   switch(crtc.cmd)
702   {
703      case 0:  // reset CRTC
704         crtc.status &= (~0x10 | ~0x04 | ~0x02);
705         break;
706      case 1:  // start display
707         crtc.status |= 0x10;
708         crtc.status &= (~0x08);
709         if(data & 1)
710            printf("CRTC reverse display ON\n");
648711
649   if((data >> 5) != 4)
650      printf("CRTC cmd %s polled\n",crtc_command[data >> 5]);
712         break;
713      case 2:  // set irq mask
714         crtc.irq_mask = data & 3;
715         break;
716      case 3:  // read light pen
717         crtc.status &= (~0x01);
718         break;
719      case 4:  // load cursor position ON/OFF
720         crtc.cursor_on = data & 1;
721         break;
722      case 5:  // reset IRQ
723      case 6:  // reset counters
724         crtc.status &= (~0x04 | ~0x02);
725         break;
726   }
727
728   //if((data >> 5) != 4)
729   //   printf("CRTC cmd %s polled\n",crtc_command[data >> 5]);
651730}
652731
653732static WRITE8_HANDLER( pc8801_dmac_w )
r10066r10067
667746   dmac_mode = data;
668747}
669748
749static WRITE8_HANDLER( pc8801_extram_sel_w )
750{
751   if(data & 0x11)
752      printf("Extra RAM select %02x\n",data & 0x11);
753}
754
755static WRITE8_HANDLER( pc8801_alu_ctrl1_w )
756{
757   alu_ctrl1 = data;
758}
759
760static WRITE8_HANDLER( pc8801_alu_ctrl2_w )
761{
762   alu_ctrl2 = data;
763   bankr[3] = pc8801_bankswitch_3_r(space->machine);
764   bankr[4] = pc8801_bankswitch_4_r(space->machine);
765   bankw[3] = pc8801_bankswitch_3_w(space->machine);
766   bankw[4] = pc8801_bankswitch_4_w(space->machine);
767}
768
670769static ADDRESS_MAP_START( pc8801_io, ADDRESS_SPACE_IO, 8 )
671770   ADDRESS_MAP_GLOBAL_MASK(0xff)
672771   ADDRESS_MAP_UNMAP_HIGH
r10066r10067
691790   AM_RANGE(0x30, 0x30) AM_READ_PORT("DSW1") //AM_WRITE(pc88sr_outport_30)
692791   AM_RANGE(0x31, 0x31) AM_READ_PORT("DSW2") AM_WRITE(pc8801_gfx_ctrl_w)
693792   AM_RANGE(0x32, 0x32) AM_READWRITE(pc8801_misc_ctrl_r, pc8801_misc_ctrl_w)
694//   AM_RANGE(0x34, 0x35) AM_WRITE(pc88sr_alu)
793   AM_RANGE(0x34, 0x34) AM_WRITE(pc8801_alu_ctrl1_w)
794   AM_RANGE(0x35, 0x35) AM_WRITE(pc8801_alu_ctrl2_w)
695795   AM_RANGE(0x40, 0x40) AM_READWRITE(pc8801_ctrl_r, pc8801_ctrl_w)
696796   AM_RANGE(0x44, 0x45) AM_DEVREADWRITE("ym2203", ym2203_r,ym2203_w)
697797//  AM_RANGE(0x46, 0x47) AM_NOP                                     /* OPNA extra port */
r10066r10067
718818//  AM_RANGE(0xd0, 0xd7) AM_NOP                                     /* music & GP-IB */
719819//  AM_RANGE(0xd8, 0xd8) AM_NOP                                     /* GP-IB */
720820//  AM_RANGE(0xdc, 0xdf) AM_NOP                                     /* MODEM */
721//   AM_RANGE(0xe2, 0xe3) AM_READWRITE(pc88_extmem_r, pc88_extmem_w) /* expand RAM select */
821   AM_RANGE(0xe2, 0xe2) AM_WRITE(pc8801_extram_sel_w)                /* expand RAM select */
722822   AM_RANGE(0xe4, 0xe4) AM_WRITE(pc8801_irq_level_w)
723823   AM_RANGE(0xe6, 0xe6) AM_WRITE(pc8801_irq_mask_w)
724824//  AM_RANGE(0xe7, 0xe7) AM_NOP                                     /* (unknown) */
r10066r10067
10201120   PORT_DIPNAME( 0x20, 0x20, "Duplex" )
10211121   PORT_DIPSETTING(    0x20, "Half" )
10221122   PORT_DIPSETTING(    0x00, "Full" )
1023   PORT_DIPNAME( 0x40, 0x00, "Boot from floppy" )
1123/*   PORT_DIPNAME( 0x40, 0x00, "Boot from floppy" )
10241124   PORT_DIPSETTING(    0x40, DEF_STR( Off ) )
10251125   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
10261126   PORT_DIPNAME( 0x80, 0x80, "Disable floppy" )
10271127   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
1028   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
1128   PORT_DIPSETTING(    0x00, DEF_STR( On ) )*/
1129   PORT_DIPNAME( 0xc0, 0x40, "Basic mode" )
1130   PORT_DIPSETTING(    0x80, "N-BASIC" )
1131   PORT_DIPSETTING(    0xc0, "N88-BASIC (V1)" )
1132   PORT_DIPSETTING(    0x40, "N88-BASIC (V2)" )
10291133
10301134   PORT_START("CFG")      /* EXSWITCH */
1031   PORT_DIPNAME( 0x03, 0x01, "Basic mode" )
1032   PORT_DIPSETTING(    0x02, "N-BASIC" )
1033   PORT_DIPSETTING(    0x03, "N88-BASIC (V1)" )
1034   PORT_DIPSETTING(    0x01, "N88-BASIC (V2)" )
10351135   PORT_DIPNAME( 0x04, 0x04, "Speed mode" )
10361136   PORT_DIPSETTING(    0x00, "Slow" )
10371137   PORT_DIPSETTING(    0x04, DEF_STR( High ) )
r10066r10067
12161316   {
12171317      crtc.param_count = 0;
12181318      crtc.cmd = 0;
1319      crtc.status = 0;
12191320   }
12201321
12211322   beep_set_frequency(machine->device("beeper"),2400);

Previous 15994 Revisions Next


© 1998-2018 The MESS Team