Previous 15994 Revisions Next

r9020 Thursday 2nd September, 2010 at 16:17:25 UTC by Angelo Salese
[PASOPIA7]: Implemented NMI trap
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r9019r9020
77    TODO:
88    - floppy support (but floppy images are unobtainable at current time)
99    - Z80PIO keyboard irq doesn't work at all, kludged keyboard inputs to work for now
10    - cassette device;
1011
1112***************************************************************************************************/
1213
r9019r9020
2526static UINT8 cursor_blink,cursor_raster;
2627static UINT8 plane_reg,attr_data,attr_wrap,attr_latch,pal_sel,x_width,gfx_mode;
2728
29static UINT8 nmi_mask,nmi_enable_reg,nmi_trap,nmi_reset;
30
2831#define VDP_CLOCK XTAL_3_579545MHz/4
2932
3033static VIDEO_START( paso7 )
r9019r9020
509512   }
510513}
511514
515static void pasopia_nmi_trap(running_machine *machine)
516{
517   if(nmi_enable_reg)
518   {
519      nmi_trap |= 2;
520
521      if(nmi_mask == 0)
522         cputag_set_input_line(machine, "maincpu", INPUT_LINE_NMI, ASSERT_LINE);
523   }
524}
525
512526static READ8_HANDLER( pasopia7_io_r )
513527{
514528   static UINT16 io_port;
r9019r9020
532546   else if(io_port >= 0x0c && io_port <= 0x0f) { return i8255a_r(space->machine->device("ppi8255_1"), (io_port-0x0c) & 3); }
533547//  else if(io_port == 0x10 || io_port == 0x11) { M6845 read }
534548   else if(io_port >= 0x18 && io_port <= 0x1b) { return pac2_r(space, (io_port-0x18) & 3);  }
535   else if(io_port >= 0x20 && io_port <= 0x23) { return i8255a_r(space->machine->device("ppi8255_2"), (io_port-0x20) & 3); }
549   else if(io_port >= 0x20 && io_port <= 0x23)
550   {
551      pasopia_nmi_trap(space->machine);
552      return i8255a_r(space->machine->device("ppi8255_2"), (io_port-0x20) & 3);
553   }
536554   else if(io_port >= 0x28 && io_port <= 0x2b) { return z80ctc_r(space->machine->device("ctc"), (io_port-0x28) & 3);  }
537555   else if(io_port == 0x30)                { return z80pio_d_r(space->machine->device("z80pio_0"), (io_port-0x30) & 1); }
538556   else if(io_port == 0x31)                { return z80pio_c_r(space->machine->device("z80pio_0"), (io_port-0x31) & 1); }
r9019r9020
569587   else if(io_port >= 0x0c && io_port <= 0x0f) { i8255a_w(space->machine->device("ppi8255_1"), (io_port-0x0c) & 3, data); }
570588   else if(io_port >= 0x10 && io_port <= 0x11) { pasopia7_6845_w(space, io_port-0x10, data); }
571589   else if(io_port >= 0x18 && io_port <= 0x1b) { pac2_w(space, (io_port-0x18) & 3, data);  }
572   else if(io_port >= 0x20 && io_port <= 0x23) { i8255a_w(space->machine->device("ppi8255_2"), (io_port-0x20) & 3, data); }
590   else if(io_port >= 0x20 && io_port <= 0x23)
591   {
592      i8255a_w(space->machine->device("ppi8255_2"), (io_port-0x20) & 3, data);
593      pasopia_nmi_trap(space->machine);
594   }
573595   else if(io_port >= 0x28 && io_port <= 0x2b) { z80ctc_w(space->machine->device("ctc"), (io_port-0x28) & 3,data);  }
574596   else if(io_port >= 0x30 && io_port <= 0x31) { z80pio_d_w(space->machine->device("z80pio_0"), (io_port-0x30) & 1, data); }
575597   else if(io_port >= 0x32 && io_port <= 0x33) { z80pio_c_w(space->machine->device("z80pio_0"), (io_port-0x32) & 1, data); }
r9019r9020
750772    --x- ---- (related to the data rec)
751773    ---x ---- data rec out
752774    ---- --x- sound off
753    ---- ---x reset NMI (writes to port B = clears bits 1 & 2) (???)
775    ---- ---x reset NMI & trap
754776    */
755777//  printf("SYSTEM MISC %02x\n",data);
756778
757//  if(data & 1)
758//      i8255a_w(devtag_get_device(device->machine, "ppi8255_2"), 1, 0);
779   if(data & 1)
780   {
781      nmi_reset &= ~4;
782      nmi_trap &= ~2;
783      //cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, CLEAR_LINE); //guess
784   }
759785
760786}
761787
r9019r9020
767793
768794static READ8_DEVICE_HANDLER( nmi_reg_r )
769795{
796   //printf("C\n");
770797   return 0xfc | bank_reg;//mame_rand(device->machine);
771798}
772799
773static UINT8 nmi_mask,nmi_enable_reg;
774
775800static WRITE8_DEVICE_HANDLER( nmi_reg_w )
776801{
777802   /*
778803        x--- ---- NMI mask
779        -x-- ---- enable NMI regs (?)
804        -x-- ---- NMI enable trap on PPI8255 2 r/w
780805    */
781806   nmi_mask = data & 0x80;
782807   nmi_enable_reg = data & 0x40;
808}
783809
784   if(!nmi_mask && nmi_enable_reg)
785      cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE);
810static READ8_DEVICE_HANDLER( nmi_porta_r )
811{
812   return 0xff;
786813}
787814
815static READ8_DEVICE_HANDLER( nmi_portb_r )
816{
817   return 0xf9 | nmi_trap | nmi_reset;
818}
788819
789
790820static I8255A_INTERFACE( ppi8255_intf_0 )
791821{
792822   DEVCB_HANDLER(unk_r),         /* Port A read */
r9019r9020
809839
810840static I8255A_INTERFACE( ppi8255_intf_2 )
811841{
812   DEVCB_NULL,                  /* Port A read */
813   DEVCB_NULL,                  /* Port B read */
842   DEVCB_HANDLER(nmi_porta_r),      /* Port A read */
843   DEVCB_HANDLER(nmi_portb_r),      /* Port B read */
814844   DEVCB_HANDLER(nmi_reg_r),      /* Port C read */
815845   DEVCB_HANDLER(nmi_mask_w),      /* Port A write */
816846   DEVCB_NULL,                  /* Port B write */
r9019r9020
825855   memory_set_bankptr(machine, "bank2", bios + 0x10000);
826856//  memory_set_bankptr(machine, "bank3", bios + 0x10000);
827857//  memory_set_bankptr(machine, "bank4", bios + 0x10000);
858
859   nmi_reset |= 4;
828860}
829861
830862static PALETTE_INIT( pasopia7 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team