src/mess/drivers/super80.c
| r4419 | r4420 | |
| 15 | 15 | #include "super80.h" |
| 16 | 16 | |
| 17 | 17 | |
| 18 | | static UINT8 irq_counter; |
| 19 | | |
| 20 | 18 | static const device_config *super80_z80pio; |
| 21 | 19 | static const device_config *super80_speaker; |
| 22 | 20 | static const device_config *super80_cassette; |
| r4419 | r4420 | |
| 45 | 43 | |
| 46 | 44 | static UINT8 keylatch; |
| 47 | 45 | |
| 48 | | /* Due to pio bug since 128u7, need to eat first interrupt after boot. |
| 49 | | Only works for super80m and super80v. The irq doesn't work at all for the others at this time. */ |
| 46 | /* This activates when Control + C + 4 pressed */ |
| 50 | 47 | static void super80_pio_interrupt(const device_config *device, int state) |
| 51 | 48 | { |
| 52 | | if ((state) && (!irq_counter)) |
| 53 | | irq_counter++; |
| 54 | | else |
| 55 | | { |
| 56 | | cputag_set_input_line(device->machine, "maincpu", 0, state ); |
| 57 | | if (state) irq_counter=0; |
| 58 | | } |
| 49 | cputag_set_input_line(device->machine, "maincpu", 0, state ); |
| 59 | 50 | } |
| 60 | 51 | |
| 61 | 52 | static WRITE8_DEVICE_HANDLER( pio_port_a_w ) |
| r4419 | r4420 | |
| 116 | 107 | |
| 117 | 108 | static UINT8 cass_data[]={ 0, 0, 0, 0 }; |
| 118 | 109 | |
| 119 | | /* This timer runs at 200kHz and emulates the 2 chips in the cassette input circuit |
| 120 | | They are U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, |
| 110 | /* this timer runs at 200khz and does 2 jobs: |
| 111 | 1. Scan the keyboard and present the results to the pio |
| 112 | 2. Emulate the 2 chips in the cassette input circuit |
| 113 | |
| 114 | Reasons why it is necessary: |
| 115 | 1. The real z80pio is driven by the cpu clock and is capable of independent actions. |
| 116 | MAME does not support this at all. If the interrupt key sequence is entered, the |
| 117 | computer can be reset out of a hung state by the operator. |
| 118 | 2. This "emulates" U79 CD4046BCN PLL chip and U1 LM311P op-amp. U79 converts a frequency to a voltage, |
| 121 | 119 | and U1 amplifies that voltage to digital levels. U1 has a trimpot connected, to set the midpoint. |
| 122 | 120 | |
| 123 | 121 | The MDS homebrew input circuit consists of 2 op-amps followed by a D-flipflop. |
| r4419 | r4420 | |
| 141 | 139 | cass_data[2] = ((cass_data[1] < 0x40) ? 1 : 0) | cass_ws | cass_data[3]; |
| 142 | 140 | cass_data[1] = 0; |
| 143 | 141 | } |
| 142 | |
| 143 | z80pio_p_w(super80_z80pio,1,pio_port_b_r(super80_z80pio,0)); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /*************************************** PRINTER ********************************************************/ |