Previous 15994 Revisions Next

r2851 Saturday 14th June, 2008 at 06:33:08 UTC by Robbbert
[SUPER80] Improved cassette interface.
[src/mess/drivers]super80.c

src/mess/drivers/super80.c
r2850r2851
386386
387387/********************************************* TIMER ************************************************/
388388
389static UINT8 wave_length, last_wave_state=0, cass_out;
389static UINT8 cass_data[]={ 0, 0, 0, 0 };
390390
391391/* this timer runs at 200khz and does 2 jobs:
392392   1. Scan the keyboard and present the results to the pio
r2850r2851
401401
402402static TIMER_CALLBACK( super80_timer )
403403{
404   UINT8 wave_state=0, i, mask=1, out_f8=z80pio_p_r(0,0), in_fa=255;
404   UINT8 cass_ws=0, i, mask=1, out_f8=z80pio_p_r(0,0), in_fa=255;
405405   char port[6];
406406
407407   for ( i=0; i < 8;i++)
r2850r2851
413413
414414   z80pio_p_w(0,1,in_fa);
415415
416   if (cassette_input(cassette_device_image()) > +0.03) wave_state+=6;
416   cass_data[1]++;
417   cass_ws = (cassette_input(cassette_device_image()) > +0.03) ? 4 : 0;
417418
418   if (wave_state == last_wave_state)
419      wave_length++;
420   else
419   if (cass_ws != cass_data[0])
421420   {
422      last_wave_state = wave_state;
423      cass_out = wave_state;
424      if (wave_length < 0x40) cass_out++;
425      wave_length = 0;
421      if (cass_ws) cass_data[3] ^= 2;
422      cass_data[0] = cass_ws;
423      cass_data[2] = ((cass_data[1] < 0x40) ? 1 : 0) | cass_ws | cass_data[3];
424      cass_data[1] = 0;
426425   }
427426}
428427
r2850r2851
439438static READ8_HANDLER( super80_f2_r )
440439{
441440   UINT8 data = input_port_read(machine, "DSW") & 0xf0;   // dip switches on pcb
442   data |= cass_out;         // bit 0 = output of U1, bit 1 = current wave_state
443   data |= 0x08;            // bits 2,3 - not used
441   data |= cass_data[2];         // bit 0 = output of U1, bit 2 = current wave_state
442   data |= 0x08;            // bit 3 - not used
444443   return data;
445444}
446445

Previous 15994 Revisions Next


© 1998-2018 The MESS Team