trunk/src/mess/includes/pcw16.h
| r20517 | r20518 | |
| 7 | 7 | #ifndef PCW16_H_ |
| 8 | 8 | #define PCW16_H_ |
| 9 | 9 | |
| 10 | #include "emu.h" |
| 11 | #include "cpu/z80/z80.h" |
| 10 | 12 | #include "machine/upd765.h" /* FDC superio */ |
| 13 | #include "machine/pc_lpt.h" /* PC-Parallel Port */ |
| 14 | #include "machine/pckeybrd.h" /* PC-AT keyboard */ |
| 15 | #include "machine/upd765.h" /* FDC superio */ |
| 16 | #include "machine/ins8250.h" /* pc com port */ |
| 17 | #include "sound/beep.h" /* pcw/pcw16 beeper */ |
| 18 | #include "machine/intelfsh.h" |
| 19 | #include "formats/pc_dsk.h" |
| 20 | #include "machine/ram.h" |
| 11 | 21 | |
| 12 | 22 | #define PCW16_BORDER_HEIGHT 8 |
| 13 | 23 | #define PCW16_BORDER_WIDTH 8 |
| r20517 | r20518 | |
| 23 | 33 | { |
| 24 | 34 | public: |
| 25 | 35 | pcw16_state(const machine_config &mconfig, device_type type, const char *tag) |
| 26 | | : driver_device(mconfig, type, tag) { } |
| 36 | : driver_device(mconfig, type, tag), |
| 37 | m_maincpu(*this, "maincpu"), |
| 38 | m_flash0(*this, "flash0"), |
| 39 | m_flash1(*this, "flash1"), |
| 40 | m_fdc(*this, "fdc"), |
| 41 | m_uart2(*this, "ns16550_2"), |
| 42 | m_speaker(*this, BEEPER_TAG), |
| 43 | m_ram(*this, RAM_TAG), |
| 44 | m_region_rom(*this, "maincpu"), |
| 45 | m_io_extra(*this, "EXTRA") |
| 46 | { } |
| 27 | 47 | |
| 48 | required_device<legacy_cpu_device> m_maincpu; |
| 49 | required_device<intel_e28f008sa_device> m_flash0; |
| 50 | required_device<intel_e28f008sa_device> m_flash1; |
| 51 | required_device<pc_fdc_superio_device> m_fdc; |
| 52 | required_device<ns16550_device> m_uart2; |
| 53 | required_device<beep_device> m_speaker; |
| 54 | required_device<ram_device> m_ram; |
| 55 | required_memory_region m_region_rom; |
| 56 | required_ioport m_io_extra; |
| 57 | |
| 28 | 58 | unsigned long m_interrupt_counter; |
| 29 | 59 | int m_banks[4]; |
| 30 | 60 | int m_4_bit_port; |
trunk/src/mess/drivers/pcw16.c
| r20517 | r20518 | |
| 87 | 87 | epp/ecp modes in parallel port not supported yet |
| 88 | 88 | so ui disabled */ |
| 89 | 89 | |
| 90 | | /* Core includes */ |
| 91 | | #include "emu.h" |
| 92 | | #include "cpu/z80/z80.h" |
| 93 | 90 | #include "includes/pcw16.h" |
| 94 | 91 | |
| 95 | | /* Components */ |
| 96 | | #include "machine/pc_lpt.h" /* PC-Parallel Port */ |
| 97 | | #include "machine/pckeybrd.h" /* PC-AT keyboard */ |
| 98 | | #include "machine/upd765.h" /* FDC superio */ |
| 99 | | #include "machine/ins8250.h" /* pc com port */ |
| 100 | | #include "sound/beep.h" /* pcw/pcw16 beeper */ |
| 101 | | #include "machine/intelfsh.h" |
| 102 | | |
| 103 | | /* Devices */ |
| 104 | | #include "formats/pc_dsk.h" |
| 105 | | #include "machine/ram.h" |
| 106 | | |
| 107 | 92 | // interrupt counter |
| 108 | 93 | /* controls which bank of 2mb address space is paged into memory */ |
| 109 | 94 | |
| r20517 | r20518 | |
| 124 | 109 | /* any bits set excluding vsync */ |
| 125 | 110 | if ((m_system_status & (~0x04))!=0) |
| 126 | 111 | { |
| 127 | | machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); |
| 112 | m_maincpu->set_input_line(0, HOLD_LINE); |
| 128 | 113 | } |
| 129 | 114 | else |
| 130 | 115 | { |
| 131 | | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); |
| 116 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 132 | 117 | } |
| 133 | 118 | } |
| 134 | 119 | |
| r20517 | r20518 | |
| 163 | 148 | { |
| 164 | 149 | if(type & 0x80) // DRAM |
| 165 | 150 | { |
| 166 | | UINT8* RAM = machine().device<ram_device>(RAM_TAG)->pointer(); |
| 167 | | return RAM[((type & 0x7f)*0x4000) + offset]; |
| 151 | return m_ram->pointer()[((type & 0x7f)*0x4000) + offset]; |
| 168 | 152 | } |
| 169 | 153 | else // ROM / Flash |
| 170 | 154 | { |
| 171 | 155 | if(type < 4) |
| 172 | 156 | { |
| 173 | | UINT8* ROM = memregion("maincpu")->base(); |
| 174 | | return ROM[((type & 0x03)*0x4000)+offset+0x10000]; |
| 157 | return m_region_rom->base()[((type & 0x03)*0x4000)+offset+0x10000]; |
| 175 | 158 | } |
| 176 | 159 | if(type < 0x40) // first flash |
| 177 | 160 | { |
| 178 | | intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash0"); |
| 179 | | return flash->read(((type & 0x3f)*0x4000)+offset); |
| 161 | return m_flash0->read(((type & 0x3f)*0x4000)+offset); |
| 180 | 162 | } |
| 181 | 163 | else // second flash |
| 182 | 164 | { |
| 183 | | intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash1"); |
| 184 | | return flash->read(((type & 0x3f)*0x4000)+offset); |
| 165 | return m_flash1->read(((type & 0x3f)*0x4000)+offset); |
| 185 | 166 | } |
| 186 | 167 | } |
| 187 | 168 | } |
| r20517 | r20518 | |
| 190 | 171 | { |
| 191 | 172 | if(type & 0x80) // DRAM |
| 192 | 173 | { |
| 193 | | UINT8* RAM = machine().device<ram_device>(RAM_TAG)->pointer(); |
| 194 | | RAM[((type & 0x7f)*0x4000) + offset] = data; |
| 174 | m_ram->pointer()[((type & 0x7f)*0x4000) + offset] = data; |
| 195 | 175 | } |
| 196 | 176 | else // ROM / Flash |
| 197 | 177 | { |
| r20517 | r20518 | |
| 199 | 179 | return; // first four sectors are write protected |
| 200 | 180 | if(type < 0x40) // first flash |
| 201 | 181 | { |
| 202 | | intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash0"); |
| 203 | | flash->write(((type & 0x3f)*0x4000)+offset,data); |
| 182 | m_flash0->write(((type & 0x3f)*0x4000)+offset,data); |
| 204 | 183 | } |
| 205 | 184 | else // second flash |
| 206 | 185 | { |
| 207 | | intel_e28f008sa_device* flash = machine().device<intel_e28f008sa_device>("flash1"); |
| 208 | | flash->write(((type & 0x3f)*0x4000)+offset,data); |
| 186 | m_flash1->write(((type & 0x3f)*0x4000)+offset,data); |
| 209 | 187 | } |
| 210 | 188 | } |
| 211 | 189 | } |
| r20517 | r20518 | |
| 556 | 534 | } |
| 557 | 535 | } |
| 558 | 536 | // TODO: fix |
| 559 | | subdevice<ns16550_device>("ns16550_2")->ri_w((machine().root_device().ioport("EXTRA")->read() & 0x040) ? 0 : 1); |
| 537 | m_uart2->ri_w((m_io_extra->read() & 0x040) ? 0 : 1); |
| 560 | 538 | } |
| 561 | 539 | |
| 562 | 540 | |
| r20517 | r20518 | |
| 763 | 741 | { |
| 764 | 742 | /* I'll pulse it because if I used hold-line I'm not sure |
| 765 | 743 | it would clear - to be checked */ |
| 766 | | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 744 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); |
| 767 | 745 | } |
| 768 | 746 | } |
| 769 | 747 | } |
| r20517 | r20518 | |
| 809 | 787 | |
| 810 | 788 | WRITE8_MEMBER(pcw16_state::pcw16_system_control_w) |
| 811 | 789 | { |
| 812 | | device_t *speaker = machine().device(BEEPER_TAG); |
| 813 | 790 | //logerror("0x0f8: function: %d\n",data); |
| 814 | 791 | |
| 815 | 792 | /* lower 4 bits define function code */ |
| r20517 | r20518 | |
| 851 | 828 | /* set terminal count */ |
| 852 | 829 | case 0x05: |
| 853 | 830 | { |
| 854 | | machine().device<pc_fdc_superio_device>("fdc")->tc_w(true); |
| 831 | m_fdc->tc_w(true); |
| 855 | 832 | } |
| 856 | 833 | break; |
| 857 | 834 | |
| 858 | 835 | /* clear terminal count */ |
| 859 | 836 | case 0x06: |
| 860 | 837 | { |
| 861 | | machine().device<pc_fdc_superio_device>("fdc")->tc_w(false); |
| 838 | m_fdc->tc_w(false); |
| 862 | 839 | } |
| 863 | 840 | break; |
| 864 | 841 | |
| 865 | 842 | /* bleeper on */ |
| 866 | 843 | case 0x0b: |
| 867 | 844 | { |
| 868 | | beep_set_state(speaker,1); |
| 845 | beep_set_state(m_speaker,1); |
| 869 | 846 | } |
| 870 | 847 | break; |
| 871 | 848 | |
| 872 | 849 | /* bleeper off */ |
| 873 | 850 | case 0x0c: |
| 874 | 851 | { |
| 875 | | beep_set_state(speaker,0); |
| 852 | beep_set_state(m_speaker,0); |
| 876 | 853 | } |
| 877 | 854 | break; |
| 878 | 855 | |
| r20517 | r20518 | |
| 1006 | 983 | /* initialise defaults */ |
| 1007 | 984 | m_fdc_int_code = 2; |
| 1008 | 985 | /* clear terminal count */ |
| 1009 | | machine().device<pc_fdc_superio_device>("fdc")->tc_w(false); |
| 986 | m_fdc->tc_w(false); |
| 1010 | 987 | /* select first rom page */ |
| 1011 | 988 | m_banks[0] = 0; |
| 1012 | 989 | // pcw16_update_memory(machine); |
| r20517 | r20518 | |
| 1032 | 1009 | m_system_status = 0; |
| 1033 | 1010 | m_interrupt_counter = 0; |
| 1034 | 1011 | |
| 1035 | | machine().device<pc_fdc_superio_device>("fdc") |
| 1036 | | ->setup_intrq_cb(pc_fdc_superio_device::line_cb(FUNC(pcw16_state::fdc_interrupt), this)); |
| 1012 | m_fdc->setup_intrq_cb(pc_fdc_superio_device::line_cb(FUNC(pcw16_state::fdc_interrupt), this)); |
| 1037 | 1013 | |
| 1038 | 1014 | /* initialise keyboard */ |
| 1039 | 1015 | at_keyboard_init(machine(), AT_KEYBOARD_TYPE_AT); |
| r20517 | r20518 | |
| 1126 | 1102 | |
| 1127 | 1103 | |
| 1128 | 1104 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ |
| 1129 | | COMP( 1995, pcw16, 0, 0, pcw16, pcw16, driver_device, 0, "Amstrad plc", "PCW16", GAME_NOT_WORKING ) |
| 1105 | COMP( 1995, pcw16, 0, 0, pcw16, pcw16, driver_device, 0, "Amstrad plc", "PcW16", GAME_NOT_WORKING ) |