src/mess/drivers/pasopia.c
| r9019 | r9020 | |
| 7 | 7 | TODO: |
| 8 | 8 | - floppy support (but floppy images are unobtainable at current time) |
| 9 | 9 | - Z80PIO keyboard irq doesn't work at all, kludged keyboard inputs to work for now |
| 10 | - cassette device; |
| 10 | 11 | |
| 11 | 12 | ***************************************************************************************************/ |
| 12 | 13 | |
| r9019 | r9020 | |
| 25 | 26 | static UINT8 cursor_blink,cursor_raster; |
| 26 | 27 | static UINT8 plane_reg,attr_data,attr_wrap,attr_latch,pal_sel,x_width,gfx_mode; |
| 27 | 28 | |
| 29 | static UINT8 nmi_mask,nmi_enable_reg,nmi_trap,nmi_reset; |
| 30 | |
| 28 | 31 | #define VDP_CLOCK XTAL_3_579545MHz/4 |
| 29 | 32 | |
| 30 | 33 | static VIDEO_START( paso7 ) |
| r9019 | r9020 | |
| 509 | 512 | } |
| 510 | 513 | } |
| 511 | 514 | |
| 515 | static 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 | |
| 512 | 526 | static READ8_HANDLER( pasopia7_io_r ) |
| 513 | 527 | { |
| 514 | 528 | static UINT16 io_port; |
| r9019 | r9020 | |
| 532 | 546 | else if(io_port >= 0x0c && io_port <= 0x0f) { return i8255a_r(space->machine->device("ppi8255_1"), (io_port-0x0c) & 3); } |
| 533 | 547 | // else if(io_port == 0x10 || io_port == 0x11) { M6845 read } |
| 534 | 548 | 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 | } |
| 536 | 554 | else if(io_port >= 0x28 && io_port <= 0x2b) { return z80ctc_r(space->machine->device("ctc"), (io_port-0x28) & 3); } |
| 537 | 555 | else if(io_port == 0x30) { return z80pio_d_r(space->machine->device("z80pio_0"), (io_port-0x30) & 1); } |
| 538 | 556 | else if(io_port == 0x31) { return z80pio_c_r(space->machine->device("z80pio_0"), (io_port-0x31) & 1); } |
| r9019 | r9020 | |
| 569 | 587 | else if(io_port >= 0x0c && io_port <= 0x0f) { i8255a_w(space->machine->device("ppi8255_1"), (io_port-0x0c) & 3, data); } |
| 570 | 588 | else if(io_port >= 0x10 && io_port <= 0x11) { pasopia7_6845_w(space, io_port-0x10, data); } |
| 571 | 589 | 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 | } |
| 573 | 595 | else if(io_port >= 0x28 && io_port <= 0x2b) { z80ctc_w(space->machine->device("ctc"), (io_port-0x28) & 3,data); } |
| 574 | 596 | else if(io_port >= 0x30 && io_port <= 0x31) { z80pio_d_w(space->machine->device("z80pio_0"), (io_port-0x30) & 1, data); } |
| 575 | 597 | else if(io_port >= 0x32 && io_port <= 0x33) { z80pio_c_w(space->machine->device("z80pio_0"), (io_port-0x32) & 1, data); } |
| r9019 | r9020 | |
| 750 | 772 | --x- ---- (related to the data rec) |
| 751 | 773 | ---x ---- data rec out |
| 752 | 774 | ---- --x- sound off |
| 753 | | ---- ---x reset NMI (writes to port B = clears bits 1 & 2) (???) |
| 775 | ---- ---x reset NMI & trap |
| 754 | 776 | */ |
| 755 | 777 | // printf("SYSTEM MISC %02x\n",data); |
| 756 | 778 | |
| 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 | } |
| 759 | 785 | |
| 760 | 786 | } |
| 761 | 787 | |
| r9019 | r9020 | |
| 767 | 793 | |
| 768 | 794 | static READ8_DEVICE_HANDLER( nmi_reg_r ) |
| 769 | 795 | { |
| 796 | //printf("C\n"); |
| 770 | 797 | return 0xfc | bank_reg;//mame_rand(device->machine); |
| 771 | 798 | } |
| 772 | 799 | |
| 773 | | static UINT8 nmi_mask,nmi_enable_reg; |
| 774 | | |
| 775 | 800 | static WRITE8_DEVICE_HANDLER( nmi_reg_w ) |
| 776 | 801 | { |
| 777 | 802 | /* |
| 778 | 803 | x--- ---- NMI mask |
| 779 | | -x-- ---- enable NMI regs (?) |
| 804 | -x-- ---- NMI enable trap on PPI8255 2 r/w |
| 780 | 805 | */ |
| 781 | 806 | nmi_mask = data & 0x80; |
| 782 | 807 | nmi_enable_reg = data & 0x40; |
| 808 | } |
| 783 | 809 | |
| 784 | | if(!nmi_mask && nmi_enable_reg) |
| 785 | | cputag_set_input_line(device->machine, "maincpu", INPUT_LINE_NMI, PULSE_LINE); |
| 810 | static READ8_DEVICE_HANDLER( nmi_porta_r ) |
| 811 | { |
| 812 | return 0xff; |
| 786 | 813 | } |
| 787 | 814 | |
| 815 | static READ8_DEVICE_HANDLER( nmi_portb_r ) |
| 816 | { |
| 817 | return 0xf9 | nmi_trap | nmi_reset; |
| 818 | } |
| 788 | 819 | |
| 789 | | |
| 790 | 820 | static I8255A_INTERFACE( ppi8255_intf_0 ) |
| 791 | 821 | { |
| 792 | 822 | DEVCB_HANDLER(unk_r), /* Port A read */ |
| r9019 | r9020 | |
| 809 | 839 | |
| 810 | 840 | static I8255A_INTERFACE( ppi8255_intf_2 ) |
| 811 | 841 | { |
| 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 */ |
| 814 | 844 | DEVCB_HANDLER(nmi_reg_r), /* Port C read */ |
| 815 | 845 | DEVCB_HANDLER(nmi_mask_w), /* Port A write */ |
| 816 | 846 | DEVCB_NULL, /* Port B write */ |
| r9019 | r9020 | |
| 825 | 855 | memory_set_bankptr(machine, "bank2", bios + 0x10000); |
| 826 | 856 | // memory_set_bankptr(machine, "bank3", bios + 0x10000); |
| 827 | 857 | // memory_set_bankptr(machine, "bank4", bios + 0x10000); |
| 858 | |
| 859 | nmi_reset |= 4; |
| 828 | 860 | } |
| 829 | 861 | |
| 830 | 862 | static PALETTE_INIT( pasopia7 ) |