| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  | /**
 | 
					
						
							|  |  |  |  * Furnace Tracker - multi-system chiptune tracker | 
					
						
							|  |  |  |  * Copyright (C) 2021-2022 tildearrow and contributors | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software; you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation; either version 2 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU General Public License along | 
					
						
							|  |  |  |  * with this program; if not, write to the Free Software Foundation, Inc., | 
					
						
							|  |  |  |  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include "pet.h"
 | 
					
						
							|  |  |  | #include "../engine.h"
 | 
					
						
							|  |  |  | #include <math.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define CHIP_DIVIDER 16
 | 
					
						
							|  |  |  | #define SAMP_DIVIDER 4
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const char* regCheatSheet6522[]={ | 
					
						
							|  |  |  |   "T2L", "08", | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |   "T2H", "09", | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   "SR", "0A", | 
					
						
							|  |  |  |   "ACR", "0B", | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |   "PCR", "0C", | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   NULL | 
					
						
							|  |  |  | }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const char** DivPlatformPET::getRegisterSheet() { | 
					
						
							|  |  |  |   return regCheatSheet6522; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const char* DivPlatformPET::getEffectName(unsigned char effect) { | 
					
						
							|  |  |  |   switch (effect) { | 
					
						
							|  |  |  |     case 0x10: | 
					
						
							|  |  |  |       return "10xx: Change waveform"; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return NULL; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  | // high-level emulation of 6522 shift register and driver software for now
 | 
					
						
							|  |  |  | void DivPlatformPET::rWrite(unsigned int addr, unsigned char val) { | 
					
						
							|  |  |  |   bool hwSROutput=((regPool[11]>>2)&7)==4; | 
					
						
							|  |  |  |   switch (addr) { | 
					
						
							|  |  |  |     case 9: | 
					
						
							|  |  |  |       // simulate phase reset from switching between hw/sw shift registers
 | 
					
						
							|  |  |  |       if ((regPool[9]==0)^(val==0)) { | 
					
						
							|  |  |  |         chan.sreg=chan.wave; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case 10: | 
					
						
							|  |  |  |       chan.sreg=val; | 
					
						
							|  |  |  |       if (hwSROutput) chan.cnt=2; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   regPool[addr]=val; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  | void DivPlatformPET::acquire(short* bufL, short* bufR, size_t start, size_t len) { | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |   bool hwSROutput=((regPool[11]>>2)&7)==4; | 
					
						
							|  |  |  |   if (chan.enable) { | 
					
						
							|  |  |  |     int reload=regPool[8]*2+4; | 
					
						
							|  |  |  |     if (!hwSROutput) { | 
					
						
							|  |  |  |       reload+=regPool[9]*512; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     for (size_t h=start; h<start+len; h++) { | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |       if (SAMP_DIVIDER>chan.cnt) { | 
					
						
							|  |  |  |         chan.out=(chan.sreg&1)*32767; | 
					
						
							|  |  |  |         chan.sreg=(chan.sreg>>1)|((chan.sreg&1)<<7); | 
					
						
							|  |  |  |         chan.cnt+=reload-SAMP_DIVIDER; | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         chan.cnt-=SAMP_DIVIDER; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       } | 
					
						
							|  |  |  |       bufL[h]=chan.out; | 
					
						
							|  |  |  |       bufR[h]=chan.out; | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |       oscBuf->data[oscBuf->needle++]=chan.out; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |     // emulate driver writes to PCR
 | 
					
						
							|  |  |  |     if (!hwSROutput) regPool[12]=chan.out?0xe0:0xc0; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   } else { | 
					
						
							|  |  |  |     chan.out=0; | 
					
						
							|  |  |  |     for (size_t h=start; h<start+len; h++) { | 
					
						
							|  |  |  |       bufL[h]=0; | 
					
						
							|  |  |  |       bufR[h]=0; | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |       oscBuf->data[oscBuf->needle++]=0; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::writeOutVol() { | 
					
						
							|  |  |  |   if (chan.active && !isMuted && chan.outVol>0) { | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |     chan.enable=true; | 
					
						
							|  |  |  |     rWrite(11,regPool[9]==0?16:0); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |     chan.enable=false; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     rWrite(11,0); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-04-15 16:01:11 -04:00
										 |  |  | void DivPlatformPET::tick(bool sysTick) { | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   chan.std.next(); | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |   if (chan.std.vol.had) { | 
					
						
							|  |  |  |     chan.outVol=chan.std.vol.val&chan.vol; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     writeOutVol(); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |   if (chan.std.arp.had) { | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     if (!chan.inPorta) { | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |       if (chan.std.arp.mode) { | 
					
						
							|  |  |  |         chan.baseFreq=NOTE_PERIODIC(chan.std.arp.val); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       } else { | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |         chan.baseFreq=NOTE_PERIODIC(chan.note+chan.std.arp.val); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     chan.freqChanged=true; | 
					
						
							|  |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |     if (chan.std.arp.mode && chan.std.arp.finished) { | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       chan.baseFreq=NOTE_PERIODIC(chan.note); | 
					
						
							|  |  |  |       chan.freqChanged=true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |   if (chan.std.wave.had) { | 
					
						
							|  |  |  |     if (chan.wave!=chan.std.wave.val) { | 
					
						
							|  |  |  |       chan.wave=chan.std.wave.val; | 
					
						
							| 
									
										
										
										
											2022-03-21 14:37:22 -04:00
										 |  |  |       rWrite(10,chan.wave); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     } | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-04-16 02:39:40 -04:00
										 |  |  |   if (chan.std.pitch.had) { | 
					
						
							|  |  |  |       chan.freqChanged=true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   if (chan.freqChanged || chan.keyOn || chan.keyOff) { | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |     chan.freq=parent->calcFreq(chan.baseFreq,chan.pitch,true,0,chan.pitch2,chipClock,CHIP_DIVIDER)-2; | 
					
						
							|  |  |  |     if (chan.freq>65535) chan.freq=65535; | 
					
						
							|  |  |  |     if (chan.freq<0) chan.freq=0; | 
					
						
							|  |  |  |     rWrite(8,chan.freq&0xff); | 
					
						
							|  |  |  |     rWrite(9,chan.freq>>8); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     if (chan.keyOn) { | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |       if (!chan.std.vol.will) { | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |         chan.outVol=chan.vol; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       chan.keyOn=false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (chan.keyOff) { | 
					
						
							|  |  |  |       chan.keyOff=false; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2022-06-22 15:42:11 -04:00
										 |  |  |     // update mode setting and channel enable
 | 
					
						
							|  |  |  |     writeOutVol(); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |     chan.freqChanged=false; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivPlatformPET::dispatch(DivCommand c) { | 
					
						
							|  |  |  |   switch (c.cmd) { | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_ON: { | 
					
						
							| 
									
										
										
										
											2022-04-21 03:24:06 -04:00
										 |  |  |       DivInstrument* ins=parent->getIns(chan.ins,DIV_INS_PET); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       if (c.value!=DIV_NOTE_NULL) { | 
					
						
							|  |  |  |         chan.baseFreq=NOTE_PERIODIC(c.value); | 
					
						
							|  |  |  |         chan.freqChanged=true; | 
					
						
							|  |  |  |         chan.note=c.value; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       chan.active=true; | 
					
						
							|  |  |  |       chan.keyOn=true; | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |       chan.macroInit(ins); | 
					
						
							| 
									
										
										
										
											2022-05-31 20:03:31 -04:00
										 |  |  |       if (!parent->song.brokenOutVol && !chan.std.vol.will) { | 
					
						
							|  |  |  |         chan.outVol=chan.vol; | 
					
						
							|  |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_OFF: | 
					
						
							|  |  |  |       chan.active=false; | 
					
						
							|  |  |  |       chan.keyOff=true; | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |       chan.macroInit(NULL); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_OFF_ENV: | 
					
						
							|  |  |  |     case DIV_CMD_ENV_RELEASE: | 
					
						
							|  |  |  |       chan.std.release(); | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_INSTRUMENT: | 
					
						
							|  |  |  |       if (chan.ins!=c.value || c.value2==1) { | 
					
						
							|  |  |  |         chan.ins=c.value; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_VOLUME: | 
					
						
							|  |  |  |       if (chan.vol!=c.value) { | 
					
						
							|  |  |  |         chan.vol=c.value; | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |         if (!chan.std.vol.had) { | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |           chan.outVol=chan.vol; | 
					
						
							|  |  |  |           writeOutVol(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_GET_VOLUME: | 
					
						
							|  |  |  |       return chan.vol; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_PITCH: | 
					
						
							|  |  |  |       chan.pitch=c.value; | 
					
						
							|  |  |  |       chan.freqChanged=true; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_WAVE: | 
					
						
							|  |  |  |       chan.wave=c.value; | 
					
						
							| 
									
										
										
										
											2022-03-21 14:37:22 -04:00
										 |  |  |       rWrite(10,chan.wave); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_NOTE_PORTA: { | 
					
						
							|  |  |  |       int destFreq=NOTE_PERIODIC(c.value2); | 
					
						
							|  |  |  |       bool return2=false; | 
					
						
							|  |  |  |       if (destFreq>chan.baseFreq) { | 
					
						
							|  |  |  |         chan.baseFreq+=c.value; | 
					
						
							|  |  |  |         if (chan.baseFreq>=destFreq) { | 
					
						
							|  |  |  |           chan.baseFreq=destFreq; | 
					
						
							|  |  |  |           return2=true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         chan.baseFreq-=c.value; | 
					
						
							|  |  |  |         if (chan.baseFreq<=destFreq) { | 
					
						
							|  |  |  |           chan.baseFreq=destFreq; | 
					
						
							|  |  |  |           return2=true; | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       chan.freqChanged=true; | 
					
						
							|  |  |  |       if (return2) { | 
					
						
							|  |  |  |         chan.inPorta=false; | 
					
						
							|  |  |  |         return 2; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     case DIV_CMD_LEGATO: | 
					
						
							| 
									
										
										
										
											2022-04-10 01:01:55 -04:00
										 |  |  |       chan.baseFreq=NOTE_PERIODIC(c.value+((chan.std.arp.will && !chan.std.arp.mode)?(chan.std.arp.val):(0))); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       chan.freqChanged=true; | 
					
						
							|  |  |  |       chan.note=c.value; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_PRE_PORTA: | 
					
						
							|  |  |  |       if (chan.active && c.value2) { | 
					
						
							| 
									
										
										
										
											2022-04-28 02:31:16 -04:00
										 |  |  |         if (parent->song.resetMacroOnPorta) chan.macroInit(parent->getIns(chan.ins,DIV_INS_PET)); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       } | 
					
						
							| 
									
										
										
										
											2022-07-04 02:43:59 -04:00
										 |  |  |       if (!chan.inPorta && c.value && !parent->song.brokenPortaArp && chan.std.arp.will) chan.baseFreq=NOTE_PERIODIC(chan.note); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |       chan.inPorta=c.value; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_CMD_GET_VOLMAX: | 
					
						
							|  |  |  |       return 1; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     case DIV_ALWAYS_SET_VOLUME: | 
					
						
							|  |  |  |       return 1; | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |     default: | 
					
						
							|  |  |  |       break; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   return 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::muteChannel(int ch, bool mute) { | 
					
						
							|  |  |  |   isMuted=mute; | 
					
						
							|  |  |  |   writeOutVol(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::forceIns() { | 
					
						
							|  |  |  |   chan.insChanged=true; | 
					
						
							|  |  |  |   chan.freqChanged=true; | 
					
						
							|  |  |  |   writeOutVol(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void* DivPlatformPET::getChanState(int ch) { | 
					
						
							|  |  |  |   return &chan; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-05 19:17:00 -04:00
										 |  |  | DivMacroInt* DivPlatformPET::getChanMacroInt(int ch) { | 
					
						
							|  |  |  |   return &chan.std; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  | DivDispatchOscBuffer* DivPlatformPET::getOscBuffer(int ch) { | 
					
						
							|  |  |  |   return oscBuf; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  | unsigned char* DivPlatformPET::getRegisterPool() { | 
					
						
							|  |  |  |   return regPool; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivPlatformPET::getRegisterPoolSize() { | 
					
						
							|  |  |  |   return 16; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::reset() { | 
					
						
							|  |  |  |   memset(regPool,0,16); | 
					
						
							|  |  |  |   chan=Channel(); | 
					
						
							| 
									
										
										
										
											2022-04-15 06:37:23 -04:00
										 |  |  |   chan.std.setEngine(parent); | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | bool DivPlatformPET::isStereo() { | 
					
						
							|  |  |  |   return false; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::notifyInsDeletion(void* ins) { | 
					
						
							|  |  |  |   chan.std.notifyInsDeletion((DivInstrument*)ins); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::poke(unsigned int addr, unsigned short val) { | 
					
						
							|  |  |  |   rWrite(addr,val); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DivPlatformPET::poke(std::vector<DivRegWrite>& wlist) { | 
					
						
							|  |  |  |   for (DivRegWrite& i: wlist) rWrite(i.addr,i.val); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | int DivPlatformPET::init(DivEngine* p, int channels, int sugRate, unsigned int flags) { | 
					
						
							|  |  |  |   parent=p; | 
					
						
							|  |  |  |   dumpWrites=false; | 
					
						
							|  |  |  |   skipRegisterWrites=false; | 
					
						
							|  |  |  |   chipClock=1000000; | 
					
						
							|  |  |  |   rate=chipClock/SAMP_DIVIDER; // = 250000kHz
 | 
					
						
							|  |  |  |   isMuted=false; | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  |   oscBuf=new DivDispatchOscBuffer; | 
					
						
							|  |  |  |   oscBuf->rate=rate; | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  |   reset(); | 
					
						
							|  |  |  |   return 1; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												per-channel oscilloscope, part 5
SAA1099 (SAASound and MAME), Lynx, MMC5, N163, PC Engine, PC Speaker,
PET, QSound, WonderSwan, VERA, VIC-20, VRC6 and X1-010!
											
										 
											2022-05-01 03:40:03 -04:00
										 |  |  | void DivPlatformPET::quit() { | 
					
						
							|  |  |  |   delete oscBuf; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-21 10:02:51 -04:00
										 |  |  | DivPlatformPET::~DivPlatformPET() { | 
					
						
							|  |  |  | } |