perry_m Posted November 27, 2007 Share Posted November 27, 2007 Though, how about a part about 16bit filtering and 2-tone-mode filtering? anyway, what should I do with the .xml files??...as they look incomplete or something. The zip file needs to be unzipped in its own folder. Then open index.xml. There is information in there about the 2-tone mode, in particular that it resets the timers. I don't know about 16bit filtering or the triangle and sawtooth waves. I also need more information about pokey's analogue behaviour. What function gives the output signal level from the digital output volume settings? What is the filter for DC-offset removal? Quote Link to comment Share on other sites More sharing options...
analmux Posted November 28, 2007 Author Share Posted November 28, 2007 (edited) Though, how about a part about 16bit filtering and 2-tone-mode filtering? anyway, what should I do with the .xml files??...as they look incomplete or something. The zip file needs to be unzipped in its own folder. Then open index.xml. There is information in there about the 2-tone mode, in particular that it resets the timers. I don't know about 16bit filtering or the triangle and sawtooth waves. I also need more information about pokey's analogue behaviour. What function gives the output signal level from the digital output volume settings? What is the filter for DC-offset removal? Well, about the analogue effects; this is a quote from myself I posted once on the Retrogamer forum (2007.06.27): -------------------------------------------------------------------------------------------------------------------------------- The circuit for a squarewave produces voltage rise and drop on a regular basis, clocked by the countdown timers (i.e. divide-by-N counters). But this is in the 'platonic'/ideal/theoretical case. In reality a signal cannot immediately rise or fall from one voltage to the other, there are no discontinuities in real life (discontinuous in the mathematical sense), so, talking about a mathematical subject of 'distributions' and/or 'mollifyers', the real signal is a result from taking a convolution integration over the theoretical signal and the mollifyer. The mollifyer always has a finite range (a 'compact support' in math terms). Now, when the width of your pulse waveform is in the same order as the 'support width' of the signal-mollifyer, the integrating effect happens. This means, linearly rising/lowering signals instead of the constant 'wings' of the pulsewave. 2 channels can be combined in a number of ways, let me explain the 2 main types: Triangle/Sawtooth Triangle waveform: No filtering, just interfering.... 2 channels both play a note outside the audible range, with slightly different frequencies. The 'mollifying' makes nearly sine or triangle waves from the (too) high-pitched pulses, but they are still not audible by themselves. Only interference of the two gives a subharmonic combination. The mathematical 'Simpson rule' tells us that this resulting subtone is related to the frequency difference of the 2 channels. This difference falls inside the audible range, and produces the triangle wave. Sawtooth waveform: Using channel 1 clocked by channel 3 (both clocked at 1.79 MHz). First about filtering: countdown timer 1 tells when there should be a transition of the signal from high -> low or vice versa. countdown timer 3 tells only if if the same signal should drop from high to low. This combined controlling of the signal gives the possibility for variable pulsewidth signals. When channel 1 and 3 are clocked with the same frequency, the result is a constant pulse, only the timing/synchronization of the channels determines the pulsewidth. But, when setting the channels to different frequencies, the pulsewidth varies continuously, without CPU intervention. So, doing a similar thing as with the Triangle waveform, we set slightly different frequencies. The pulsewidth is constantly rising or falling --> integrating it with the mollifyer gives us a sawtooth waveform, which can be backwards or forwards. Note: in case of the sawtooth waveform the resulting frequency (expressed as 1.79mhz divided by an integer) is related to the l.c.m. (least common multiple) of both signal frequencies F1+4 and F3+4. In case of F1=F3+1 then it coincides with the simpson relation, so when pitchdifference is 1 notationtables for both sawtooth waveform and triangle waveform are the same. -------------------------------------------------------------------------------------------------------------------------------- ...so mathematically it can be described by a 'mollifyer', which smooths a signal, that has discontinuities, to something that is continuous (...even C^{\infinity}, i.e. infinitely many times continuous-differentiable). Each sound device has it's own characteristic mollifyer. I've done some rough measurements about that: 1) charging time: ±0.00004535 sec. (time from low to high) 2) decharging time: ±0.00245 sec. (half-time) these are in fact characteristics of the capacitors inside pokey. It's a pity I have no knowlegde about how these characteristics depend on output levels etc. In most electric/electronic circuits a capacitor is used to smooth out a signal, that's why it's described mathematically by a mollifyer. The charging time is a good measure for the so-called 'support-width' of the mollifyer. About the exact form of the mollifyer, I'm not sure, but I'm rather sure it could be described that way. It could even be that we're not dealing with an ideal mollifyer anyway, but just a simple windowed mean-value procedure. But, with the right sound tests it should be possible to reconstruct this mollifyer. How this all relates to non-linear effects I don't know, but maybe this clears a few things up. Maybe there's something like 'charging speed' that's thus depending on the amplitude-differences of the signal (thus, the volume). Then the support-width of the mollifyer increases by picking higher volumes, i.e. the analogue effect should be amplified by using higher volumes....but this is still my speculation. About the 16bit filter. I had a look at your picture [counters.png] and it seems that a resynchronization circuit is present. Both 2-tone-filter and 16-bit filter act like a resynchronization of channel 1 with channel 2. Only difference is a logic detail, but the difference in effect is clear. Edited November 28, 2007 by Analogue Multiplexer Quote Link to comment Share on other sites More sharing options...
Bryan Posted November 28, 2007 Share Posted November 28, 2007 I also need more information about pokey's analogue behaviour. What function gives the output signal level from the digital output volume settings? What is the filter for DC-offset removal? Here's Pokey's audio output. There are 4 of these circuits which create a variable resistance to ground via 4 J-FETs, each with twice the capacity of the previous one. This is essentially a 4-bit DAC. A single pull-up resistor is used for all four channels and the value of the internal resistors is pretty easy to figure out by setting the volume bits and watching the voltage drop. Parasitic effects (mostly stray capacitance) cause the wave to not look much like a square wave at higher frequencies, but these don't actually have much of an effect on the sound. Quote Link to comment Share on other sites More sharing options...
raster/c.p.u. Posted November 28, 2007 Share Posted November 28, 2007 But, to be honest, I think you see far more problems than there are actually. Ok, you see less problems than me, but it won't be solving our problems. I'm sure it's possible to do, also in just a music tracker for tunes just used in games. Ok. You sure. Well, what to say?? Isn't it so that RMT player knows when a note starts? Yes, there is routine for start note, but it doesn't means that it's time for polycounters reseting. For example: Typical instrument (can) has some distortion effects at the beginning part of envelope. Other hasn't. And sometimes are this two instruments playing simultaneously by various sound generators. So, there isn't absolutely known right time for polycounters reseting. Well, I don't know this right time. And I will not to implement some feature which correct one problem but evoke other (disturbed sounds). Quote Link to comment Share on other sites More sharing options...
analmux Posted November 28, 2007 Author Share Posted November 28, 2007 (edited) Isn't it so that RMT player knows when a note starts?Yes, there is routine for start note, but it doesn't means that it's time for polycounters reseting. It's up to the user to decide when it is needed exactly. The resetting could eventually be postponed if needed. Typical instrument (can) has some distortion effects at the beginning part of envelope. Other hasn't. OK, but for just simple pure/plain bass-notes I assume this won't be the case...or are you talking about instruments that combine bass and percussion to one channel? And sometimes are this two instruments playing simultaneously by various sound generators. So, there isn't absolutely known right time for polycounters reseting. I'm starting to see your point. But, my solution would be that it's up to the Pokey musician to decide when a poly-reset is desired. You can cancel them in dodgy situations. I think a solution could be to give possibility for some kind of reset-command in the main track/song edit. Then it's also possible to control the precise moment of the wanted poly-reset. And I will not to implement some feature which correct one problem but evoke other (disturbed sounds). OK. that's your choice If I would write a pokey-tracker I'd definately implement this feature.....but I'm afraid maybe it will indeed need a drastically changing of RMT composer to make this possible. Anyway, maybe it would be better to think about such things when pokey.dll would emulate the resetting feature correctly (same for 2-tone-filter). Edited November 28, 2007 by Analogue Multiplexer Quote Link to comment Share on other sites More sharing options...
perry_m Posted November 29, 2007 Share Posted November 29, 2007 (edited) It is possible to add additional filters to the emulation such as FIR and IIR filters. If the output circuitry can be simulated as some DSP filters it could be emulated in atari800. There is already a FIR filter for resampling and ASAP has an IIR DC-offset removal filter. It would be good if someone could test the triangle and sawtooth wave technique on a stereo Pokey or 400/800. See quote below by Piotr: "Audio processing is a little different in 600XL and much different in 1200XL and 400/800 (where GTIA sound is played on the internal speaker). Also, stereo upgrades can use different signal processing." The addition of Pokey channels appears to be non-linear, so empirical tests could be done to determine the function. I guess that the filtering which causes the triangle and sawtooth is done in the external circuitry. Below is an extract of pokeydoc.zip from the DAC module. Is the addition linear?Perry: I found that setting a bit to forced output ON with vol=15 causes other channels to become less loud. Michael: We were measuring the ouput characteristics of Pokey volumes on real Atari. As long as one channel only is operating, the characteristic does not deviate from linear by any measurable amount. When two or more channels generate the same frequency being synchronized (STA STIMER), the things change. Real Pokey becomes non-linear, but this research was not finished to give a plausible formula. I think I should study the Atari schematics, perhaps I'll find the correct dependency. Audio processing outside POKEYRelevant schema part of 65XE, 130XE, XEGS and different versions of 800XL: "SOUND" is connected to POKEY's AUDIO pin and via 1k resistor to +5V. "SIOAUDIO" is an input line of the SIO connector. It is used for the non-data channel of cassette. It can be ignored for emulation. "BELL" is GTIA's S3 pin controlled by CONSOL bit 3. Audio processing is a little different in 600XL and much different in 1200XL and 400/800 (where GTIA sound is played on the internal speaker). Also, stereo upgrades can use different signal processing. Michael: The drawing is incorrect, "+" and "-" labels on opamps should be swapped. Otherwise it would be without any negative feedback. Another suggestion of this are pin numbers. On double opamp packages, pin 2 is usually '-' and pin 3 is '+', whereas on this drawing it is reversed. R9 and R11 are a voltage divider producing DC offset on which all the signals ride after passing through this circuit. First hi-pass stage is U1B, R4, C17, R1. Then there is low-pass stage: R2, C21. Second hi-pass stage U1A, R7, C20, R6. Other elements are for mixing the different signals. Gains are determined, for the first op-amp by R1 and R4, for the second op-amp, by R6 and R7. I'll explore the circuit in more detail later and plot the frequency responses. Edited November 29, 2007 by perry_m Quote Link to comment Share on other sites More sharing options...
analmux Posted November 29, 2007 Author Share Posted November 29, 2007 (edited) It is possible to add additional filters to the emulation such as FIR and IIR filters. If the output circuitry can be simulated as some DSP filters it could be emulated in atari800. There is already a FIR filter for resampling and ASAP has an IIR DC-offset removal filter. Sorry I'm not familiar with those terms FIR, IIR, DSP etc. What do they mean, and how are they related to 16bit filter and 2-tone-filter? Note: the 16bit filter is already emulated. I guess that the filtering which causes the triangle and sawtooth is done in the external circuitry. I doubt that. When you play a really low pitched note you can clearly see that there's exponential decay in the output signal. Shouldn't this be the effect of a capacitor? Isn't this an internal capacitor? That's what I gave the 2 characteristic values of, a few posts back. I suppose the triangle and sawtooth waves are both effects of precisely this capacitor. Edited November 29, 2007 by Analogue Multiplexer Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 29, 2007 Share Posted November 29, 2007 (edited) Here's my theory. Try this in BASIC: SO. 0,43,10,15:SO. 2,44,10,15:POKE 53768,96 POKE 53763,163:POKE 53762,80 Gives a triangle wave, plus a "normal" square wave at a frequency very close to that of our triangle wave. Now, do the maths. Then, check the sampling graphs below. The triangle wave we are hearing is not in fact the closely spaced one, but is the result of the peaks and valley rises and falls. Of course, those are caused due to the flanging going on between voices 1 and 3. The result is a kind of "Pulse Width Modulation" effect. First graph is the square wave (on it's own). Second is the "triangle" on it's own. Third is both (virtually the same - you need to look at it over a much larger timeframe to spot the flanging). Last graph is just a single voice (AUDF1) playing it's 1.79 MHz clocked tone (which is inaudible, but still registers). Edited November 29, 2007 by Rybags Quote Link to comment Share on other sites More sharing options...
analmux Posted November 29, 2007 Author Share Posted November 29, 2007 @ Rybags, could you please also make such a recording of the sawtooth wave? when you actually see that there's so much ultrasonic waves, then a lot of electric 'enery' is wasted when using these type of sounds. I guess maybe that's a reason for Atari to never document such features. I'm still curious how the response differs between the 800xl, 600xl, 400, 800 etc. ..as perry_m said. Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 29, 2007 Share Posted November 29, 2007 OK. I'll do that. Another thing though. What we actually hear is something else again. Thanks to speaker dynamics, obviously the cone can't keep up with such a high-pitched waveform (ie in the 100 KHz or so range). So, we have 3 possible levels of alteration. Inside POKEY, outside POKEY (sound circuitry), and the end product through the speaker. The only microphone I have here is built into my HP monitor. Might try some time later hooking that up and holding a speaker near to it. Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 29, 2007 Share Posted November 29, 2007 Here's a sawtooth sample. AUDF1 = 32 AUDC1 = A6 AUDCTL = 64 (ch1&3 @ 1.79, filter 1 by 3) Quote Link to comment Share on other sites More sharing options...
emkay Posted November 29, 2007 Share Posted November 29, 2007 Here's a sawtooth sample. AUDF1 = 32 AUDC1 = A6 AUDCTL = 64 (ch1&3 @ 1.79, filter 1 by 3) Seeing this explains, why the resulting "saw" sounds a bit like AdLib. Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 29, 2007 Share Posted November 29, 2007 Definately sounds a bit "cheesy". I'll have to hook up the C-64 later on and get some comparos. I'd guess that waveform is oscillating at such a rate that the resultant coming through the speaker would probably be an "average" of the peaks/troughs along it's length (with slight variation either side). But, in the end, it does sound like a sawtooth. Funny enough - I just exported it to a 320 kbps MP3 and that's exactly what it turned out like. I used Audacity to generate a 595 Hz sawtooth tone on the other channel - they're near enough to identical. Left channel is POKEY - right channel is "perfect" sawtooth as per Audacity. Of course, some detail is lost due to it being MP3 - but it sounds near same enough as the 192 kHz sample I have loaded here. Saw50.mp3 Quote Link to comment Share on other sites More sharing options...
analmux Posted November 30, 2007 Author Share Posted November 30, 2007 (edited) OK, I've done some other small experiments. Things can get even more weird, when combining 2-tone-filter and the triangle waveform or the sawtooth waveform (i.e. combination of 2 filters: 2-tone & high-pass) If you do first: P=53760 POKE P,43:POKE P+4,44 POKE P+1,175:POKE P+5,175 POKE P+8,96:POKE P+15,139 FOR Z=0 TO 255:POKE P+2,Z FOR Q=0 TO 99:NEXT Q:NEXT Z Then you'll already get something funny. It's just triangle combined with the 2-tone-mode filter. Ch.1&3 are at 1.79mhz. After that: POKE P+8,97 FOR Z=0 TO 255:POKE P+2,Z FOR Q=0 TO 29:NEXT Q:NEXT Z Baseclock 64khz --> 15khz. This only affects channel 2 which is silent! Things sound a lot different. Now: POKE P+8,100 FOR Z=0 TO 255:POKE P+2,Z FOR Q=0 TO 99:NEXT Q:NEXT Z This turns on highpass filter. Channel 3 is still on though. Now: POKE P+5,0 FOR Z=0 TO 255:POKE P+2,Z FOR Q=0 TO 99:NEXT Q:NEXT Z Silence on ch.3 --> real sawtooth, filtered by the 2-tone-filter You can repeat all the above with different used pitches on ch.1 & ch.3 POKE P,33:POKE P+2,34 Or POKE P,35:POKE P+2,36 (b.t.w. Rybags, thanks for showing the sawtooth recording!) Edited November 30, 2007 by Analogue Multiplexer Quote Link to comment Share on other sites More sharing options...
perry_m Posted November 30, 2007 Share Posted November 30, 2007 I think I have got the triangle wave figured out now. It is not caused by a filter. It is due to the non-linear addition of voices inside Pokey. If F1 and F2 are ultrasounds, then then spectrum of F1+F2 is the sum of the spectrum of F1 and F2. So there can't be any non-ultrasounds in the sum. If you look at the audacity plot Rybags made you can see that the triangle wave looks like a sine wave in the area of construtive interference. In the area of destrutive interference, where it looks flat, the average signal level is greater than 0. This corresponds to the peak of the triangle wave. The trough is the sine-wave portion. Suppose we have two square waves of similar but slightly different frequencies. In the area of maximal constructive intereference they look like this: wave1: 10101010101010101010101 wave2: 10101010101010101010101 sum: 20202020202020202020202 In the area of maximal destructive interference they look like this: wave1: 10101010101010101010101 wave2: 01010101010101010101010 sum: 11111111111111111111111 But the average signal level of both is still 1. When the high-frequency component is removed, the result of both is silence. What if the sum operation is non-linear, as it is supposed to be in Pokey? Suppose the sum is attenuated at higher values: sum(1,1)=1.5 then we get 1.5, 0, 1.5, 0, 1.5, etc. for the area of maximal constructive interference. This has a lower average signal level (=0.75) than the area of maximal destructive interference(=1). In fact, the average signal level is now a function of the amount of overlap between the two square waves. Since the amount of overlap is a triangle wave function, this is what it sounds like. This would be easy to add to the emulation but I need the function which gives the addition. It could be worked out by testing the signal level of different combinations of voices and volume levels. Assuming commutitivity: For 2 voices there are: (16 + 2 - 1) choose 2 = 136 possibilities. For all 4 voices there are: (16 + 4 - 1) choose 4 = 3 876 possibilities. We could write a program that played all 4 voices in sync at different volumes for some frequency and have it go through all the combinations. This could be sampled into a single .wav file, and then processed to compute the average volume level for each portion (using a period of silence or some such to determine the boundaries.) Note that STIMER sets voices 3 and 4 to the opposite phase as voices 1 and 2. It is possible to fix this so they are in phase. Side note about DSP: FIR filter = Finite impulse response. IIR filter = Infinite impulse response. DSP = Digital signal processing. These are used to emulate an analogue filter. A FIR filter is just a linear combination of consecutive sample values, applied to every group of n samples. An IIR filter is a linear combination that includes previously calculated filtered values (feedback). It can simulate an exponential decay for DC-offset removal. Impulse response is what the filtered output looks like when you feed it a signal of 1 followed by an infinite number of zeros (discrete impulse function.) FIR gives its coefficients, IIR gives an infinite signal (such as exponential decay.) Quote Link to comment Share on other sites More sharing options...
Rybags Posted November 30, 2007 Share Posted November 30, 2007 (edited) For comparison, here's some samples from my C-64. They're not as good quality as the Atari samples, probably copping some interference as I have the C-64 going through a VCR, then line-out from there to the computer. Sawtooth, Triangle and pulse wave (at about 50% duty cycle). Last one is Ataris plain old "pure" tone. edit: fixed twice - C64 samplings were being clipped as the volume was too high. Edited November 30, 2007 by Rybags Quote Link to comment Share on other sites More sharing options...
perry_m Posted November 30, 2007 Share Posted November 30, 2007 BTW this portion of Pokeydoc.zip relates to the original topic of this thread. These were two of the new things about Pokey that I learned last year: Are poly inputs identical for all channels?Perry: There is a delay for the poly counters between each audio channel. If channel 1 gets poly5(t) at time t then channel 2 gets poly5(t) at t+1, channel 4 is t+3 etc. This is true of all 3 poly counters if this interpretation is correct. I'm noticing that there are pairs of inverters between each channel on the poly counter lines in the schematics. Perry: UPDATE: this is now confirmed with a test program for the 114 clock and poly4. Since they have a common factor of 3, the phase would be different for each AUDF register and it is. The 5 sampled bits of the poly counter are not the same for each register. AUDF1 is the same as AUDF4 however, since there is phase a difference of 3. Does STIMER affect poly registers, poly5 sampling flip-flops or hi-pass filter flip-flops? STIMER is said to force ch1&2 to high and ch3&4 to low. We thought this was the out bit. But it's not. STIMER does reset the out bit, but it is the same for all 4 channels. According to the schematics, the only difference is due to the high-pass filters. Channel 1 and channel 2 have the filters and the default filter state is to produce an inversion of the output bit. This means that channels 3 & 4 produce opposite output from 1 and 2. Since the poly counter values were deduced from channel 1 not assuming this inversion, they are not correct and should be inverted. Confirmed using a test program. Summary: Do not assume that you get the same sound from different channels. Quote Link to comment Share on other sites More sharing options...
analmux Posted November 30, 2007 Author Share Posted November 30, 2007 But the average signal level of both is still 1. When the high-frequency component is removed, the result of both is silence. But, when I look at the triangle signal Rybags recorded, it looks to me as if it's also clipped. So, then it's not sure what the signal strength is at the 'knots' of the interference. Quote Link to comment Share on other sites More sharing options...
analmux Posted November 30, 2007 Author Share Posted November 30, 2007 (edited) Summary: Do not assume that you get the same sound from different channels. Yep, that's a thing I've already read in your documents. I've made some testprogramms to check on this. This is something to be aware of, but it is still possible to solve 'choosing' a wanted sound timbre from the different polycounter orbits. You just have to use different offset-values. Edited January 2, 2008 by Analogue Multiplexer Quote Link to comment Share on other sites More sharing options...
analmux Posted November 30, 2007 Author Share Posted November 30, 2007 (edited) Does STIMER affect poly registers, poly5 sampling flip-flops or hi-pass filter flip-flops? So I would say NO. It is however possible to choose a different soundtype from one of the degenerate pitch-settings (poly4: pitch+1 = 3*N). This is related to the fact that a write to STIMER changes the timing (or phase) of the divide-by-N counter w.r.t. the phase of the polycounter. For resetting the polycounter a write to STIMER and to SKCTL is needed.... Edited January 2, 2008 by Analogue Multiplexer Quote Link to comment Share on other sites More sharing options...
Cybernoid Posted November 30, 2007 Share Posted November 30, 2007 Do we have a better scan of the pokey.pdf spec? Or, does anyone know what the actual hardware looks like for the poly-counters... Is this implemented as an LFSR (Linear Feedback Shift Register) and if so what bits are tapped to affect which bits in the counter? Quote Link to comment Share on other sites More sharing options...
Clint Thompson Posted December 1, 2007 Share Posted December 1, 2007 OK, I've done some other small experiments. Things can get even more weird, when combining 2-tone-filter and the triangle waveform or the sawtooth waveform (i.e. combination of 2 filters: 2-tone & high-pass) If you do first: P=53760 POKE P,43:POKE P+4,44 POKE P+1,175:POKE P+5,175 POKE P+8,96:POKE P+15,139 FOR Z=0 TO 255:POKE P+2,Z FOR Q=0 TO 99:NEXT Q:NEXT Z Why am I getting an Error -13 after punching in the last line? Quote Link to comment Share on other sites More sharing options...
kenfused Posted December 1, 2007 Share Posted December 1, 2007 OK, I've done some other small experiments. Things can get even more weird, when combining 2-tone-filter and the triangle waveform or the sawtooth waveform (i.e. combination of 2 filters: 2-tone & high-pass) If you do first: P=53760 POKE P,43:POKE P+4,44 POKE P+1,175:POKE P+5,175 POKE P+8,96:POKE P+15,139 FOR Z=0 TO 255:POKE P+2,Z FOR Q=0 TO 99:NEXT Q:NEXT Z Why am I getting an Error -13 after punching in the last line? because you cant split a for next loop like that when you are typing stuff in direct mode. Using line number and make a program you run or if you are typing in direct mode combine the last two lines into would work. Quote Link to comment Share on other sites More sharing options...
Clint Thompson Posted December 1, 2007 Share Posted December 1, 2007 a-ha! Thanks.... Quote Link to comment Share on other sites More sharing options...
perry_m Posted December 2, 2007 Share Posted December 2, 2007 OK here is some code to play all (16 + 4 - 1) choose 4 = 3 876 different values of pokey volume mixes for the 4 channels. I hope someone can record it and send me a .wav or FLAC of it. It should be around 10-15 minutes long. The screen will turn blue when it is finished. The tricky part is to get the 4 voices in phase, since channels 1&2 are inverted. I just put tone2=2*tone+1 and then the frequency of tone2 should be twice that of tone. Then put tone2 in AUDF3 and AUDF4, sta STIMER and put back tone in AUDF3 and AUDF4 so that when one cycle is done they will reload with tone and be in phase. Hopefully we can analyze the results and get the Pokey non-linear addition worked out. Maybe there are some errors so please review this code if you can. I have not tested it on a real Atari. .include equates.m65 *=$4000 begin jmp START iv .byte 0 jv .byte 0 kv .byte 0 lv .byte 0 tone .byte 100 tone2 .byte 0 count .dbyte 0 START lda #$0 sta count sta count+1 sei lda #$0 sta sdmctl sta dmactl sta nmien lda #$0 sta audctl lda #$3 sta skctl lda #$a0 sta audc1 sta audc2 sta audc3 sta audc4 lda tone sta audf1 sta audf2 asl a tax inx stx tone2 ;start of loops lda #$a0 sta iv iloop lda #$a0 sta jv jloop lda #$a0 sta kv kloop lda #$a0 sta lv lloop lda tone2 sta audf3 sta audf4 sta stimer lda tone sta audf3 sta audf4 lda iv sta audc1 lda jv sta audc2 lda kv sta audc3 lda lv sta audc4 ldy #1 delay1b ldx #0 delay1 sta wsync sta wsync sta wsync sta wsync sta wsync sta wsync sta wsync sta wsync sta wsync sta wsync dex bne delay1 dey bne delay1b lda #$a0 sta audc1 sta audc2 sta audc3 sta audc4 ldx #0 delay2 sta wsync dex bne delay2 lda count clc adc #1 sta count lda count+1 adc #0 sta count+1 ldx lv inx stx lv cpx kv bcc jmplloop beq jmplloop lda #0 beq skipjmplloop jmplloop jmp lloop skipjmplloop ldx kv inx stx kv cpx jv bcc jmpkloop beq jmpkloop lda #0 beq skipjmpkloop jmpkloop jmp kloop skipjmpkloop ldx jv inx stx jv cpx iv bcc jmpjloop beq jmpjloop lda #0 beq skipjmpjloop jmpjloop jmp jloop skipjmpjloop ldx iv inx stx iv cpx #$AF bcc jmpiloop beq jmpiloop lda #0 beq skipjmpiloop jmpiloop jmp iloop skipjmpiloop lda #34 sta sdmctl sta dmactl ldy #10 lda count+1 sta (savmsc),y iny lda count sta (savmsc),y iny iny lda #$0f sta (savmsc),y iny lda #$24 sta (savmsc),y loopforever jmp loopforever pokeyvol.zip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.