Esempio n. 1
0
static void st300_pulse (int param) {
// param = 0x02 -> internal 6840 clock
// param = 0 -> external 4049 clock
// timpX is the output level of the 6840 (only 0 or 1)
// decrase timers and update interface
// missig is external clock for the 6840 timers
  if (((st300loc.cr1 & 0x02) == param) && (st300loc.cr1 & 0x80) && (st300loc.reset ==0)) {
  	if (snddatst300.timer1 > 0) {
        	snddatst300.timer1--;
  	}
  	if ((snddatst300.timer1 == 0) && (st300loc.timlat1 != 0)) {
    		snddatst300.timer1 = st300loc.timlat1;
    		if (st300loc.timlat1 != st300loc.timlats1) {
    			playsam1(0);
    		}
    		st300loc.timlats1 = st300loc.timlat1;
    		st300loc.timp1 =  (st300loc.timp1 ? 0 : 1);
    	}
  }
  if (((st300loc.cr2 & 0x02) == param) && (st300loc.cr2 & 0x80) && (st300loc.reset ==0)) {
  	if (snddatst300.timer2 > 0) {
        	snddatst300.timer2--;
  	}
  	if ((snddatst300.timer2 == 0) && (st300loc.timlat2 != 0)) {
    		snddatst300.timer2 = st300loc.timlat2;
    		if (st300loc.timlat2 != st300loc.timlats2) {
    			playsam2(0);
    		}
    		st300loc.timlats2 = st300loc.timlat2;
    		st300loc.timp2 =  (st300loc.timp2 ? 0 : 1);

    	}
  }

  if (((st300loc.cr3 & 0x02) == param) && (st300loc.cr3 & 0x80) && (st300loc.reset ==0)) {
  	if (snddatst300.timer3 > 0) {
        	snddatst300.timer3--;
  	}
  	if ((snddatst300.timer3 == 0) && (st300loc.timlat3 != 0)) {
    		snddatst300.timer3 = st300loc.timlat3;
    		st300loc.timp3 =  (st300loc.timp3 ? 0 : 1);
		if (st300loc.timp3) {
			nextvol(0);

			if (setvol(0) == 0) {
				logerror("playsam Q2/EXT noise volume off \n");
			}
			if (setvol(0) == 100) {
				logerror("playsam Q2/EXT noise volume maximum\n");
			}

			mixer_set_volume(st300loc.channel,setvol(0)*ST300_VOL);
			mixer_set_volume(st300loc.channel+2,setvol(0)*ST300_VOL);
    		}
    	}
  }

}
Esempio n. 2
0
static void m6840_pulse (int param) {
// param = 0x02 -> internal 6840 clock
// decrase timers and update interface
  if (((gps_locals.cr1 & 0x02) == param) && (gps_locals.cr1 & 0x80) && (gps_locals.reset ==0)) {
  	if (m6840d.timer1 > 0) {
        	m6840d.timer1--;
  	}
  	if ((m6840d.timer1 == 0) && (gps_locals.timlat1 != 0)) {
    		m6840d.timer1 = gps_locals.timlat1;
    		if (gps_locals.timlat1 != gps_locals.timlats1) {
    			playsam1(0);
    		}
    		gps_locals.timlats1 = gps_locals.timlat1;
    		gps_locals.timp1 =  (gps_locals.timp1 ? 0 : 1);
    	}
  }
  if (((gps_locals.cr2 & 0x02) == param) && (gps_locals.cr2 & 0x80) && (gps_locals.reset ==0)) {
  	if (m6840d.timer2 > 0) {
        	m6840d.timer2--;
  	}
  	if ((m6840d.timer2 == 0) && (gps_locals.timlat2 != 0)) {
    		m6840d.timer2 = gps_locals.timlat2;
    		if (gps_locals.timlat2 != gps_locals.timlats2) {
    			playsam2(0);
    		}
    		gps_locals.timlats2 = gps_locals.timlat2;
    		gps_locals.timp2 =  (gps_locals.timp2 ? 0 : 1);

    	}
  }

  if (((gps_locals.cr3 & 0x02) == param) && (gps_locals.cr3 & 0x80) && (gps_locals.reset ==0)) {
  	if (m6840d.timer3 > 0) {
        	m6840d.timer3--;
  	}
  	if ((m6840d.timer3 == 0) && (gps_locals.timlat3 != 0)) {
    		m6840d.timer3 = gps_locals.timlat3;

    		if (gps_locals.timlat3 != gps_locals.timlats3) {
    			playsam3(0);
    		}
    		gps_locals.timlats3 = gps_locals.timlat3;


    		gps_locals.timp3 =  (gps_locals.timp3 ? 0 : 1);
    	}
  }

}
Esempio n. 3
0
static WRITE_HANDLER(m6840_w ) {
  int w;
  long int w1;
//  logerror("M6840: offset %d = %02x\n", offset, data);
  m6840d.ax[offset]=data;
  if (offset == 3) {
	gps_locals.timlat1 = m6840d.ax[offset] + m6840d.ax[(offset-1)] * 256;
	m6840d.timer1 = gps_locals.timlat1;
	w1 = MSU1_INTCLOCK / (2 * (m6840d.timer1 + 1));
	gps_locals.tfre1 = w1;
    	logerror("%04x: m6840_w  timlat1 loaded %04x freq %04d  \n", activecpu_get_previouspc(), gps_locals.timlat1,gps_locals.tfre1);
  	if (gps_locals.timlat1 == 0) {
		gps_locals.timlats1 = 0;
  	 	mixer_stop_sample(gps_locals.channel);
		logerror ("Playsam Q1 off\n");
	}
  }
  if (offset == 5) {
	gps_locals.timlat2 = m6840d.ax[offset] + m6840d.ax[(offset-1)] * 256;
	m6840d.timer2 = gps_locals.timlat2;
	gps_locals.tfre2 = MSU1_INTCLOCK / (2 * (m6840d.timer2 + 1));
    	logerror("%04x: m6840_w  timlat2 loaded %04x freq %04d  \n", activecpu_get_previouspc(), gps_locals.timlat2,gps_locals.tfre2);
  	if (gps_locals.timlat2 == 0) {
		gps_locals.timlats2 = 0;
  	 	mixer_stop_sample(gps_locals.channel+1);
		logerror ("Playsam Q2 off\n");
	}

  }
  if (offset == 7) {
	gps_locals.timlat3 = m6840d.ax[offset] + m6840d.ax[(offset-1)] * 256;
	m6840d.timer3 = gps_locals.timlat3;
	gps_locals.tfre3 = (MSU1_INTCLOCK / (2 * (m6840d.timer3 + 1)));
  	logerror("%04x: m6840_w  timlat3 loaded %04x freq %04d  \n", activecpu_get_previouspc(), gps_locals.timlat3,gps_locals.tfre3);
  	if (gps_locals.timlat3 == 0) {
  	 	mixer_stop_sample(gps_locals.channel+2);
		gps_locals.timlats3 = 0;
		logerror ("Playsam Q3 off\n");
	}


  }
  if (offset == 1)  {
	gps_locals.cr2= m6840d.ax[offset];
 	logerror("%04x: m6840_w  CR2 %02x       ", activecpu_get_previouspc(), gps_locals.cr2);
	if ((gps_locals.cr2 & 0x80) == 0) {
  	}
	if (gps_locals.cr2 & 0x80)  {
		logerror ("Output enabl ");
    		if (gps_locals.timlat2 != gps_locals.timlats2) {
    			playsam2(0);
    			gps_locals.timlats2 = gps_locals.timlat2;
    		}
	} else {
//		logerror ("Output OFF   ");
		logerror ("PlaysamQ2off ");	
		gps_locals.timlats2 = 0;
		mixer_stop_sample(gps_locals.channel+1);
	}
	if (gps_locals.cr2 & 0x40)  {
		logerror ("Inter  ENABLE ");
	} else {
		logerror ("Inter  off    ");
	}
	w = (gps_locals.cr2 & 0x38) >> 3;
 	logerror ("Mode (N 2)   %01x ",w);
	if (gps_locals.cr2 & 0x04)  {
		logerror ("count d 8 ");
	} else {
		logerror ("count 16  ");
	}
	if (gps_locals.cr2 & 0x02)  {
		logerror ("int clock ");
	} else {
		logerror ("ext clock ");
	}
	logerror ("\n");
        }