Previous 15994 Revisions Next

r4103 Saturday 10th January, 2009 at 08:12:56 UTC by Robbbert
[MZ700] Enabled cassette loading.
[src/mess/machine]mz700.c

src/mess/machine/mz700.c
r4102r4103
4343static emu_timer *ne556_timer[2] = {NULL,};     /* NE556 timer */
4444static UINT8 ne556_out[2] = {0,};      /* NE556 current output status */
4545
46static UINT8 mz700_motor_on = 0;   /* cassette motor key (play key) */
47
4846static READ8_DEVICE_HANDLER ( pio_port_a_r );
4947static READ8_DEVICE_HANDLER ( pio_port_b_r );
5048static READ8_DEVICE_HANDLER ( pio_port_c_r );
r4102r4103
157155
158156static READ8_DEVICE_HANDLER (pio_port_c_r )
159157{
160    UINT8 data = pio_port_c_output & 0x0f;
158   UINT8 data = pio_port_c_output & 0x0f;
161159
162160    /*
163161     * bit 7 in     vertical blank
r4102r4103
165163     * bit 5 in     tape data (RDATA)
166164     * bit 4 in     motor (1 = on)
167165     */
168    if (mz700_motor_on)
169        data |= 0x10;
170166
171    if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.0038)
172        data |= 0x20;       /* set the RDATA status */
167   /* note: this is actually connected to Q output of the motor-control flip-flop (see below) */
168   if ((cassette_get_state(devtag_get_device(device->machine, CASSETTE, "cassette")) & CASSETTE_MASK_UISTATE) != CASSETTE_STOPPED)
169      data |= 0x10;
173170
171   if (cassette_input(devtag_get_device(device->machine, CASSETTE, "cassette")) > 0.0038)
172      data |= 0x20;       /* set the RDATA status */
173
174174   if (ne556_out[0])
175        data |= 0x40;           /* set the 556OUT status */
175      data |= 0x40;           /* set the 556OUT status */
176176
177    data |= input_port_read(device->machine, "STATUS");   /* get VBLANK in bit 7 */
177   data |= input_port_read(device->machine, "STATUS");   /* get VBLANK in bit 7 */
178178
179179   LOG(2,"mz700_pio_port_c_r",("%02X\n", data),device->machine);
180180
181    return data;
181   return data;
182182}
183183
184184static WRITE8_DEVICE_HANDLER (pio_port_a_w )
r4102r4103
213213     * bit 1 out    tape data (WDATA)
214214     * bit 0 out    unused
215215     */
216   LOG(2,"mz700_pio_port_c_w",("%02X\n", data),device->machine);
217   pio_port_c_output = data;
218216
217//   UINT8 state = cassette_get_state(devtag_get_device(device->machine, CASSETTE, "cassette"));
218//   UINT8 action = ((~pio_port_c_output & 8) & (data & 8));      /* detect low-to-high transition */
219
220   /* The motor control circuit consists of a resistor, capacitor, invertor, nand-gate, and D flip-flop.
221      The sense input from the cassette player goes low whenever play, rewind or fast-forward is pressed.
222      This connects to most of the above components.
223      The Q output enables the motor, and also connects to Bit 4 (input).
224      Bit 3 outputs a string of pulses to the Clock pin, and therefore cannot be used to control
225      the motor directly.
226      For the moment, the user can use the UI to select play, stop, etc.
227      If you load from the command-line or the software-picker, type in L <enter> immediately.
228
219229   cassette_change_state(
220230      devtag_get_device(device->machine, CASSETTE, "cassette"),
221231      ((data & 0x08) && mz700_motor_on) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED,
222232      CASSETTE_MOTOR_DISABLED);
223233
224    cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x02) ? +1.0 : -1.0);
234   */
235
236   LOG(2,"mz700_pio_port_c_w",("%02X\n", data),device->machine);
237
238   cassette_output(devtag_get_device(device->machine, CASSETTE, "cassette"), (data & 0x02) ? +1.0 : -1.0);
239
240   pio_port_c_output = data;
225241}
226242
227243/************************ MMIO ***********************************************/

Previous 15994 Revisions Next


© 1998-2018 The MESS Team