Example #1
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);
    	}
  }

}
Example #2
0
static WRITE_HANDLER(st300_ctrl_w) {
  if (!st300loc.voiceSw) {
// cycles for 4536
// c0 -> 00 -> 2 clock cycles
// c0 -> 10 -> 4 clock cycles
// c0 -> 20 -> 8 clock cycles
  	snddatst300.c0=data;
  	st300loc.extfreq  = ((data & 0xf0) >> 4) + 1;
  	st300loc.noise    =  (data & 0x08) >> 3;
  	st300loc.conx = (data & 0x04) >> 2;
  	st300loc.altx = (data & 0x02) >> 1;
  	if (snddatst300.c0 & 0x01)  { // count up
  		st300loc.dir  = 1;
  	} else {
  		st300loc.dir  = 0;
  	}
  	logerror("st300_CTRL_W adress C0 data %02x noise %04x \n", data,st300loc.noise);
  	playsamext(0);
  	playsam3(0);
 } else {